Tema: Error de
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 07/06/2011, 11:08
alexg88
 
Fecha de Ingreso: abril-2011
Mensajes: 1.342
Antigüedad: 13 años
Puntos: 344
Respuesta: Error de

Tienes que llamar a session_start antes de enviar el html.
Código PHP:
Ver original
  1. <?php  
  2. include("../conexiones/bizarrejuegos.php");
  3. include("../funciones.php");
  4. ?>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  9. <link href="../styles/noticias/<?php echo estilo(); ?>" rel="stylesheet" type="text/css" />
  10. </head>
  11. <body>
  12. <?php
  13.  
  14. if(isset($_POST['admin']) && isset($_POST['clave']))
  15. {
  16.     if($_POST['clave']=='*****') {
  17.         $sql="SELECT *
  18.              FROM usuariosbj
  19.              WHERE email='".$_POST['admin']."'";
  20.         $res=mysql_query($sql,$conexion) or die(mysql_error()."<br />".$sql."<hr />");
  21.          
  22.         if(mysql_fetch_assoc($res)==false) {
  23.             echo "El usuario y/o la contraseña no son correctos<br />";
  24.         }
  25.         else {
  26.             $_SESSION['email']=$_POST['admin'];
  27.             $_SESSION['clave_sec']=$_POST['clave'];
  28.             header("Location: ../noticias.php");
  29.         }
  30.      
  31.     }  
  32.     else {
  33.         $sql="SELECT *
  34.              FROM usuariosbj
  35.              WHERE nombre='".$_POST['admin']."'AND clave='".$_POST['clave']."'";
  36.         $res=mysql_query($sql,$conexion) or die(mysql_error()."<br />".$sql."<hr />");
  37.      
  38.         //si el nombre y/o la contrase単a no son correctos
  39.         if(mysql_fetch_assoc($res)==false)
  40.                     echo "El usuario y/o la contraseña no son correctos<br />";
  41.      
  42.         //si el nombre y/o la contrase単a si son correctos
  43.         else {
  44.             $_SESSION['recordar']=$_POST['recordar'];
  45.             $_SESSION['nombre']=$_POST['admin'];
  46.             $_SESSION['clave']=$_POST['clave'];
  47.             header("Location: ../noticias.php");
  48.         }
  49.     }
  50. }
  51. ?>
  52. </body>
  53. </html>