Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/01/2013, 10:18
alvarols
 
Fecha de Ingreso: diciembre-2008
Mensajes: 738
Antigüedad: 15 años, 5 meses
Puntos: 15
Warning: Cannot modify header information - headers already sent by (output started a

Hola:

Tengo un problema:

Estoy tratando de hacer que cuando un usuario coloque el usuario y contraseña correctos te mande a la página de resultados. Pero en el hosting que tengo (En localhost funciona bien) me tira este error.

Este es el código que estoy usando. ¿Qué tengo que hacer?

Saludos

Código PHP:
Ver original
  1. <?php
  2. ?>
  3. <?php include ('connect.php'); ?>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  8. <link href="style.css" rel="stylesheet" type="text/css" />
  9. <title>Historial de Compras</title>
  10. <style>
  11.     #contenido{
  12.         width:700px;
  13.         margin:0 auto;
  14.     }
  15. </style>
  16. </head>
  17.  
  18. <body>
  19. <div id="cabezal">
  20.         <div id="logo">
  21.         </div>
  22.     </div>
  23. <div id="contenido">
  24.     <h1>Ingresa tus datos</h1>
  25.         <?php
  26.             $aceptar=$_POST['aceptar'];
  27.             if ($aceptar=="") // SI EL BOTON DE ACEPTAR NO HA SIDO PRESIONADO
  28.              {
  29.         ?>  
  30.         <form method="post" action="<?php $PHP_SELF ?>">
  31.         Usuario: <br /><input type="text" name="login"> <br>
  32.         Password: <br /><input type="password" name="password"><br>
  33.        <input type="submit" name="aceptar" value="aceptar">&nbsp&nbsp
  34.        <input type="reset" name="borrar" value="Borrar">
  35.         </form>
  36.        
  37.         <?php
  38.           } // CERRAMOS EL IF($ACEPTAR=="" )
  39.           else // EN CASO CONTRARIO, EN EL QUE SE HAYA PRESIONADO ACEPTAR
  40.           {
  41.             //password
  42.             $login=$_POST['login'];
  43.             $password=$_POST['password'];
  44.             $encriptado=md5($password);
  45.             $nombre = "cong13cruz";
  46.             $contraseña = md5("daridaiaa1");
  47.                 if (($nombre!=$login)||($contraseña!=$encriptado)) {
  48.         ?>
  49.         <h2>Alguno de los datos que ingresaste es incorrecto</h2>
  50.        
  51.         <form method="post" action="<?php $PHP_SELF ?>">
  52.         Usuario: <br /><input type="text" name="login"> <br>
  53.         Password: <br /><input type="password" name="password"><br>
  54.  
  55.        <input type="submit" name="aceptar" value="aceptar">&nbsp&nbsp
  56.        <input type="reset" name="borrar" value="Borrar">
  57.         </form>
  58.        
  59.         <?php  
  60.                 } else {
  61.                     $_SESSION['login']=$login;
  62.                     $_SESSION['password']=$encriptado;
  63.                     header('Location: resultados.php');
  64.                 }
  65.         ?>
  66.         <?php  } ?>
  67.  
  68. </div>
  69. </body>
  70. </html>