Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/03/2008, 14:21
Albertair1
 
Fecha de Ingreso: noviembre-2007
Mensajes: 49
Antigüedad: 17 años, 2 meses
Puntos: 0
contraseña y confirmar contraseña

hola estoy haciendo una pagina y estoy en la parte, donde la gente se registrara pero quiero hacer un campo con contraseña y otro que confirme la contraseña entonces si no coinsiden me diga que no coinsiden o que no son iguales y si estan iguales pues que se suban los datos a la base de datos.

mi codigo es el siguiente:

Código PHP:
<?php require_once('Connections/prosperidad.php'); ?>
<?php
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"] == "formu")) {
  
$insertSQL sprintf("INSERT INTO usuarios (usuario, nombre, apellido, Pais, ciudad, Email, Sexo, pass) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['usuadio'], "text"),
                       
GetSQLValueString($_POST['nombre'], "text"),
                       
GetSQLValueString($_POST['apellido'], "text"),
                       
GetSQLValueString($_POST['pais'], "text"),
                       
GetSQLValueString($_POST['ciudad'], "text"),
                       
GetSQLValueString($_POST['email'], "text"),
                       
GetSQLValueString($_POST['sexo'], "text"),
                       
GetSQLValueString($_POST['contrasena1'], "text"));

  
mysql_select_db($database_prosperidad$prosperidad);
  
$Result1 mysql_query($insertSQL$prosperidad) or die(mysql_error());
}

mysql_select_db($database_prosperidad$prosperidad);
$query_Usuarios "SELECT * FROM usuarios";
$Usuarios mysql_query($query_Usuarios$prosperidad) or die(mysql_error());
$row_Usuarios mysql_fetch_assoc($Usuarios);
$totalRows_Usuarios mysql_num_rows($Usuarios);
?><!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Registrarse</title>
<style type="text/css">
<!--
#Layer1 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:1;
    left: 262px;
    top: 14px;
}
#Layer2 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:2;
    left: 261px;
    top: 393px;
}
#Layer3 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:3;
    left: 261px;
    top: 225px;
}
#Layer4 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:4;
}
#Layer5 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:4;
    left: 6px;
    top: 3px;
}
#Layer6 {
    position:absolute;
    width:700px;
    height:166px;
    z-index:5;
    left: 261px;
    top: 398px;
}
#Layer7 {
    position:absolute;
    width:132px;
    height:82px;
    z-index:6;
    left: 20px;
    top: 287px;
}
body {
    background-image: url(imagenes/mainbox_bg.jpg);
}
#Layer8 {
    position:absolute;
    width:205px;
    height:208px;
    z-index:7;
    left: 260px;
    top: 4px;
}
#Layer9 {
    position:absolute;
    width:479px;
    height:400px;
    z-index:1;
    left: 7px;
    top: 7px;
}
#Layer10 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:2;
}
#Layer11 {
    position:absolute;
    width:525px;
    height:115px;
    z-index:1;
    left: 9px;
    top: 5px;
}
.Estilo5 {color: #FFFFFF}
-->
</style></head>

<body>
<div id="Layer11">
  <form action = "<?php echo $editFormAction?>" method="POST" name="formu" id="formu">
    <table width="398" border="0" cellpadding="3" cellspacing="3">
      <tr>
        <td width="180"><div align="left" class="Estilo5">Usuario:</div></td>
        <td width="197"><label>
          <div align="left">
            <input name="usuadio" type="text" id="usuadio" size="30" />
          </div>
          </label></td>
      </tr>
      <tr>
        <td><div align="left" class="Estilo5">Contrase&ntilde;a</div></td>
        <td>
          <div align="left">
            <input name="contrasena1" type="password" size="30" />
          </div></td>
      </tr>
      <tr>
        <td><div align="left" class="Estilo5">Reconfirme contrase&ntilde;a </div></td>
        <td>
          <div align="left">
            <input name="contrasena2" type="password" size="30" />
          </div></td>
      </tr>
      <tr>
        <td><div align="left" class="Estilo5">Nombre:</div></td>
        <td>
          <div align="left">
            <input name="nombre" type="text" id="nombre" size="30" />
          </div></td>
      </tr>
      <tr>
        <td><div align="left" class="Estilo5">Apellido:</div></td>
        <td>
          <div align="left">
            <input name="apellido" type="text" id="apellido" size="30" />
          </div></td>
      </tr>
      <tr>
        <td height="49"><div align="left" class="Estilo5">Sexo</div></td>
        <td><label>
          <label></label>
</label>
          <p>
            <label>
              <input type="radio" name="sexo" value="masculino" />
              <span class="Estilo5">masculino</span></label>
            <span class="Estilo5"><br />
            <label>
              <input type="radio" name="sexo" value="femenino" />
              femenino</label>
            </span><br />
          </p></td>
      </tr>
      <tr>
        <td><div align="left" class="Estilo5">pais</div></td>
        <td>
          <div align="left">
            <input name="pais" type="text" id="pais" size="30" />
          </div></td>
      </tr>
      <tr>
        <td><div align="left" class="Estilo5">ciudad</div></td>
        <td>
          <div align="left">
            <input name="ciudad" type="text" id="ciudad" size="30" />
          </div></td>
      </tr>
      <tr>
        <td><div align="left" class="Estilo5">E-mail</div></td>
        <td>
          <div align="left">
            <input name="email" type="text" id="email" size="30" />
          </div></td>
      </tr>
      <tr>
        <td><div align="left" class="Estilo5">
          <input type="submit" name="submit" value="Ingresar datos" />
        </div></td>
        <td><div align="left"></div></td>
      </tr>
    </table>
    <p>&nbsp; </p>
      <input type="hidden" name="MM_insert" value="formu">
  </form> 
</div>
</body>
</html>
<?php
mysql_free_result
($Usuarios);
?>
ayudenme porfavor !!!!!!!