Ver Mensaje Individual
  #5 (permalink)  
Antiguo 18/01/2008, 14:57
lisen
 
Fecha de Ingreso: agosto-2007
Mensajes: 123
Antigüedad: 16 años, 9 meses
Puntos: 0
Re: comparar contraseñas

ok, aqui se los dejo. gracias

<?php require_once('Connections/gsp_1.php'); ?>
<?php
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
$MM_dupKeyRedirect="error1.php";
$loginUsername = $_POST['num_empleado'];
$LoginRS__query = "SELECT num_empleado FROM g_s_p_1 WHERE num_empleado='" . $loginUsername . "'";
mysql_select_db($database_gsp_1, $gsp_1);
$LoginRS=mysql_query($LoginRS__query, $gsp_1) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);


$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 g_s_p_1 (num_empleado, nombre, apellidos, contraseña, nivel, extension, banco, sucursal, cuenta) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['num_empleado'], "int"),
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['apellidos'], "text"),
GetSQLValueString($_POST['contrasea'], "text"),
GetSQLValueString($_POST['radiobutton'], "text"),
GetSQLValueString($_POST['extension'], "int"),
GetSQLValueString($_POST['banco'], "text"),
GetSQLValueString($_POST['sucursal'], "int"),
GetSQLValueString($_POST['cuenta'], "int"));

mysql_select_db($database_gsp_1, $gsp_1);
$Result1 = mysql_query($insertSQL, $gsp_1) or die(mysql_error());

$insertGoTo = "login.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}

$colname_Recordset1 = "-1";
if (isset($_GET['banco'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['banco'] : addslashes($_GET['banco']);
}
mysql_select_db($database_gsp_1, $gsp_1);
$query_Recordset1 = sprintf("SELECT banco FROM g_s_p_1 WHERE banco = '%s' ORDER BY banco ASC", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $gsp_1) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

mysql_select_db($database_gsp_1, $gsp_1);
$query_Recordset2 = "SELECT nivel, nivel2 FROM nivel";
$Recordset2 = mysql_query($query_Recordset2, $gsp_1) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
var nav4 = window.Event ? true : false;
function acceptNum1(evt)
{
var key = nav4 ? evt.which : evt.keyCode;
return (key >= 48 && key <= 57);
}
</script>
<script type="text/javascript">
var nav4 = window.Event ? true : false;
function acceptNum(evt)
{

var key = nav4 ? evt.which : evt.keyCode;

return (key >= 65 && key <= 90) || (key >= 97 && key <= 122) || (key == 164 && key == 165) || (key == 209 || key == 241 || key == 225 || key == 233 || key == 237 || key == 243 || key == 250) || (key <= 32) ;

}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
// if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' debe contener un número.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
// min=test.substring(8,p); max=test.substring(p+1);
// if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es requerido.\n'; }
} if (errors) alert('!ATENCION¡:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
<script>
function validar(form1) {
if (form1.contrasea.value != form1.contrasea2.value) {
alert('las contraseñas no coinciden')
form1.contrasea.value='';
form1.contrasea2.value='';
form1.contrasea.focus();
}
}
</script>
</head>

<body>
<div align="center">
<h2>!!! Bienvenido, por favor llene este formulario para acceder al sistema !!! </h2>
</div>
<form method="post" onsubmit="return validar(this)" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">* N&uacute;mero de empleado:</td>
<td><input name="num_empleado" type="text" onkeypress="return acceptNum1(event)" onfocus="" size="25" maxlength="5"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">* Nombre:</td>
<td><input name="nombre" type="text" style="width=50%" onkeypress="return acceptNum(event)" onkeyup="this.value=this.value.replace(/^\s+/,'');" size="25" maxlength="25" /></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">* Apellidos:</td>
<td><input name="apellidos" style="width=50%" type="text" onkeypress="return acceptNum(event)" onkeyup="this.value=this.value.replace(/^\s+/,'');" maxlength="30" size="25" /></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">* Contraseña:</td>
<td><input type="password" name="contrasea" onkeyup="this.value=this.value.replace(/^\s+/,'');" value="" size="25"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">*Repita contrase&ntilde;a </td>
<td><input type="password" name="contrasea2" onkeyup="this.value=this.value.replace(/^\s+/,'');" value="" size="25" /></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">* Nivel:</td>
<td><label>
<input <?php if (!(strcmp($row_Recordset2['nivel'],"RP"))) {echo "checked=\"checked\"";} ?> name="radiobutton" type="radio" value="RP" />
RP
<input <?php if (!(strcmp($row_Recordset2['nivel'],"lll"))) {echo "checked=\"checked\"";} ?> name="radiobutton" type="radio" value="lll" />
III
</label></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">* Extensi&oacute;n:</td>
<td><input name="extension" type="text" value="" onkeypress="return acceptNum1(event)" size="25" maxlength="4"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">* Banco:</td>
<td><label>
<input name="banco" type="text" id="banco" value="" onkeypress="return acceptNum(event)" onkeyup="this.value=this.value.replace(/^\s+/,'');" size="25" maxlength="20" />
</label></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">* Sucursal:</td>
<td><input name="sucursal" type="text" value="" onkeypress="return acceptNum1(event)" size="25" maxlength="6"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">* Cuenta:</td>
<td><input name="cuenta" type="text" value="" onkeypress="return acceptNum1(event)" size="25" maxlength="6"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td><input name="submit" type="submit" onclick="MM_validateForm('num_empleado','','RisNum ','nombre','','R','apellidos','','R','extension',' ','RisNum','banco','','R','sucursal','','RisNum',' cuenta','','RisNum','contrasea','','R','contrasea2 ','','R');return document.MM_returnValue" value="Enviar Datos" />
<label>
<input type="reset" name="Reset" value="Lipiar" />
<br />
* Campos obligatorios </label></td>
</tr>
</table>


<div align="left">
<input type="hidden" name="MM_insert" value="form1">
</div>
</form>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset2);
?>