Ver Mensaje Individual
  #14 (permalink)  
Antiguo 29/03/2011, 15:01
Avatar de bUllan9ebrio
bUllan9ebrio
 
Fecha de Ingreso: enero-2011
Ubicación: Chile
Mensajes: 1.128
Antigüedad: 13 años, 3 meses
Puntos: 128
Respuesta: Posibles errores en mi código para autentificar usuario

Prueba con esto :

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>SUBIR FICHEROS AMA</title>
  5. </head>
  6.     <form name="contacto" method="post" action="identifica.php">
  7.         <table width="50%" align="center">
  8.             <tr>
  9.                 <td colspan="2" align="center">
  10.                     AUTENTIFICACI&Oacute;N
  11.                 </td>
  12.             </tr>
  13.             <tr>
  14.                 <td>
  15.                     NOMBRE DE USUARIO :
  16.                 </td>
  17.                 <td>
  18.                     <input name="usuario" type="text" size="50">
  19.                </td>
  20.             </tr>
  21.             <tr>
  22.                 <td>
  23.                     CONTRASE&Ntilde;A :
  24.                 </td>
  25.                 <td>
  26.                     <input name="cont" type="clave" size="50">
  27.                 </td>
  28.             </tr>
  29.             <tr>
  30.                 <td colspan="2" align="center">
  31.                     <input type="submit" name"envio" value="Enviar datos">
  32.                 </td>
  33.             </tr>
  34.             </table>                
  35.     </form>
  36. </body>
  37. </html>

y recibes de esta forma :

Código PHP:
Ver original
  1. <?
  2. $host="localhost";
  3. $user="root";
  4. $password="password";
  5. $db="subirficheros";
  6. $enlace = mysql_connect($host,$user,$password);
  7. mysql_select_db($db,$enlace);
  8. $usuario=$_POST['usuario'];
  9. $clave=$_POST['clave'];
  10. $consulta = mysql_query("SELECT nombre FROM usuarios WHERE nombre='$usuario' AND contrasena='$clave'");
  11. $dato= mysql_fetch_array ($consulta);
  12. $total=mysql_fetch_row($dato);
  13. if ($total!="")
  14. {
  15.     $nombre = $dato['nombre'];
  16.     echo "<STRONG>Bienvenido $usuario a nuestra web </STRONG>";
  17. }
  18. else {
  19.     echo "<script>alert('Verifique sus datos de acceso'); location.href='formregistrados.html';</script>";
  20. }
  21. ?>

Saqué toda la basura que contenia tu codigo, procura utilizar Css, es mucho más ordenado, óptimo y aplicado utilizar, saludos
__________________
Si no vivimos como pensamos, pronto empezaremos a pensar como vivimos.
Más vale un Gracias sincero, que un número que aumente "popularidad" ¬¬°

Universidad de chile, campeón