Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/03/2012, 11:19
Avatar de lukazz
lukazz
 
Fecha de Ingreso: marzo-2011
Mensajes: 88
Antigüedad: 13 años, 1 mes
Puntos: 3
error al iniciar sesion, cuando crea las cookie

hola tengo un problema que cuando inicio sesion en una pagina que estoy haciendo me aparece esto

Cita:
Warning: Cannot modify header information - headers already sent by (output started at /home/likespos/public_html/entrar.php:2) in /home/likespos/public_html/entrar.php on line 18

Warning: Cannot modify header information - headers already sent by (output started at /home/likespos/public_html/entrar.php:2) in /home/likespos/public_html/entrar.php on line 19

Warning: Cannot modify header information - headers already sent by (output started at /home/likespos/public_html/entrar.php:2) in /home/likespos/public_html/entrar.php on line 20

Warning: Cannot modify header information - headers already sent by (output started at /home/likespos/public_html/entrar.php:2) in /home/likespos/public_html/entrar.php on line 21

Warning: Cannot modify header information - headers already sent by (output started at /home/likespos/public_html/entrar.php:2) in /home/likespos/public_html/entrar.php on line 22

Warning: Cannot modify header information - headers already sent by (output started at /home/likespos/public_html/entrar.php:2) in /home/likespos/public_html/entrar.php on line 23

Warning: Cannot modify header information - headers already sent by (output started at /home/likespos/public_html/entrar.php:2) in /home/likespos/public_html/entrar.php on line 24






este es el php



Código PHP:
<?php
require 'config.php' ;
if(
$_POST[enviar]) {
    function 
quitar($texto) {
        
$texto trim($texto) ;
        
$texto htmlspecialchars($texto) ;
        
$texto str_replace(chr(160),'',$texto) ;
        return 
$texto ;
    }
    
$nick quitar($_POST[nick]) ;
    
$contrasena quitar($_POST[contrasena]) ;
    
$con mysql_query("select id,contrasena,imagen,exten,voto_usuario from usuarios where nick='$nick'") ;
    
$datos mysql_fetch_assoc($con) ;
    if(
mysql_num_rows($con)) {
        if(
$datos[contrasena] == $contrasena) {
            
setcookie('uid',$datos[id],time()+604800) ;
            
setcookie('unick',$nick,time()+604800) ;
            
setcookie('ucontrasena',$contrasena,time()+604800) ;
            
setcookie('uimagen',$datos[imagen],time()+604800) ;
            
setcookie('uexten',$datos[exten],time()+604800) ;
            
setcookie('uvoto_usuario',$datos[voto_usuario],time()+604800) ;
            
header("location: $_SERVER[HTTP_REFERER]") ;
        }
        else {
            echo 
'<style type="text/css">
body {
    background-color: #333;
}
</style><p style="color:#EFEFEF; font-size: 36px; font-weight: bold; font-family: Verdana, Geneva, sans-serif;">La contraseña es incorrecta. Haz click <a href="javascript:history.back(-1)">aquí</a> para regresar.</p>' 
;
        }
    }
    else {
        echo 
'<style type="text/css">
body {
    background-color: #333;
}
</style><p style="color:#EFEFEF; font-size: 36px; font-weight: bold; font-family: Verdana, Geneva, sans-serif;">El nick no existe. Haz click <a href="javascript:history.back(-1)">aquí</a> para regresar.</p>' 
;
    }
}
?>


parase ser un error al crear las cookie espero que alguien pueda ayudarme :S