File: /home/asjudine/www/Correspon/Registro1.php
<?php
require_once("../config.php");
require_once("../includes/bd.php");
$dbi = sql_connect($dbhost, $dbuname, $dbpass, $dbname);
$mainfile = 1;
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO usuarios (Id, Login, Password, Nombres_Completos, Cedula, Cargo, Oficina, Telefono) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Id'], "int"),
GetSQLValueString($_POST['Login'], "text"),
GetSQLValueString($_POST['Password'], "text"),
GetSQLValueString($_POST['Nombres_Completos'], "text"),
GetSQLValueString($_POST['Cedula'], "text"),
GetSQLValueString($_POST['Cargo'], "text"),
GetSQLValueString($_POST['Oficina'], "text"),
GetSQLValueString($_POST['Telefono'], "text"));
mysql_select_db($database_LOCAL, $dbi);
$Result1 = mysql_query($insertSQL, $dbi) or die(mysql_error());
}
?>
<script languaje="JavaScript">
function Mostrar_Fecha()
{
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado")
var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
document.write("<b><font face='Arial, Helvetica, sans-serif'>"+dayarray[day]+" "+daym+" de "+montharray[month]+" de "+year+"</font></b>")
}
</script>
<style type="text/css">
<!--
.Estilo7 {color: #000099; font-family: Arial, Helvetica, sans-serif; }
.Estilo8 {font-family: Arial, Helvetica, sans-serif}
-->
</style>
</head>
<body OnLoad="document.form1.Login.focus()">
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table width="480" border="1" align="center" cellpadding="1" cellspacing="1">
<tr bgcolor="#0099FF"><td colspan="2"><div align="center" class="Estilo7"><p class="Estilo9 "><strong>INGRESAR DATOS DE USUARIOS</strong></p></div></td></tr>
<tr bgcolor="#FFFFCC"><td colspan="2"><div align="center" class="Estilo8"><span class="Estilo12"><script languaje="JavaScript">Mostrar_Fecha()</script></span></div></td></tr>
<tr valign="baseline">
<td nowrap align="right"><span class="Estilo7"><strong>Login:</strong></span></td>
<td><input name="Login" type="text" value="" size="20" maxlength="20"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"><span class="Estilo7"><strong>Password:</strong></span></td>
<td><input name="Password" type="password" value="" size="10" maxlength="10"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"><span class="Estilo7"><strong>Nombres Completos:</strong></span></td>
<td><input name="Nombres_Completos" type="text" value="" size="50" maxlength="50"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"><span class="Estilo7"><strong>Cedula:</strong></span></td>
<td><input name="Cedula" type="text" value="" size="10" maxlength="10"></td>
</tr>
<tr valign="baseline">
<td colspan="2" align="right" nowrap><div align="center">
<input type="submit" class="Estilo7" value="INGRESAR USUARIOS">
</div></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>