Ver Mensaje Individual
  #8 (permalink)  
Antiguo 04/09/2010, 12:18
nexu
 
Fecha de Ingreso: agosto-2010
Mensajes: 66
Antigüedad: 13 años, 8 meses
Puntos: 1
Respuesta: redireccionar a otra pagina con sistema login

Aqui esta el codigo tal y como lo tengo

Código PHP:
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. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Sistema de Placas 2010</title>
  6. <style type="text/css">
  7. <!--
  8. body {
  9.     background-color: #FFF;
  10.     background-image: url(mapa_sp.jpg);
  11.     background-repeat: repeat;
  12. }
  13. -->
  14. </style></head>
  15. <body>
  16. <?php
  17. mysql_connect('localhost','usuario', "unknown");
  18. mysql_select_db('automoviles');
  19. $usuario = strtolower($_POST["usuario"]);
  20.     $password = $_POST["password"];
  21. if($usuario!= "" && $password!= "")
  22. {
  23.     $sql = mysql_query('SELECT password, usuario FROM administradores WHERE usuario="'.$usuario.'"');
  24.     if($f= mysql_fetch_array($sql)){
  25.         if($f["password"] == $password){
  26.             $_SESSION["k_username"] = $f['usuario'];
  27.             header("location:paneldecontrol.php");
  28.             exit();
  29.        
  30.         }else{
  31.             echo 'Password incorrecto';
  32.                     }
  33.     }else{
  34.         echo 'Usuario no existente en la base de datos ';
  35.        
  36.     }
  37.    
  38. }
  39. ?>
  40. <form id="form1" name="form1" method="post" action="">
  41.   <p align="center">&nbsp;</p>
  42.   <p align="center">&nbsp;</p>
  43.   <p align="center">&nbsp;</p>
  44.   <div align="center">
  45.     <table width="305" height="158" border="1">
  46.       <tr bgcolor="#0099CC">
  47.         <td bgcolor="#CCCCCC"><p align="left"><a href="index.php"><img src="REGRESAR.png" width="85" height="57" alt="REGRESAR" /></a></p>
  48.           <p align="center"><img src="usuarios.png" width="56" height="56" alt="usuarios" /></p>
  49.         <h2 align="center"><strong>ADMINISTRADOR</strong></h2></td>
  50.       </tr>
  51.       <tr bgcolor="#0099CC">
  52.         <td><p align="left">&nbsp;</p>
  53.           <p align="center"><strong>USUARIO:</strong>
  54.             <input name="usuario" type="text" id="usuario" size="25" maxlength="25" />
  55.           </p>
  56.           <p align="center"><strong>CONTRASEÑA:</strong>
  57.             <input name="password" type="password" id="password" size="25" maxlength="25" />
  58.           </p>
  59.           <p align="center">
  60.            
  61.           </p>
  62.           <p align="center">&nbsp;</p>
  63.           <p align="center">
  64.            
  65.             <input type="submit" name="boton1" id="boton1" value="INICIAR SESION" />
  66.         </p></td>
  67.       </tr>
  68.     </table>
  69.   </div>
  70.   <p align="center">&nbsp;</p>
  71. </form>
  72. <p>&nbsp;</p>
  73. </body>
  74. </html>