alejandron Posted April 25, 2007 Share Posted April 25, 2007 hello, i have a problem, my web show this error: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/profile/public_html/profile/carpeta/list.php:63) in /home/profile/public_html/profile/conect.php on line 2 it is the code for conect.php <?php session_start(); $_SESSION['Titulo']="title"; $strUsuario=$_REQUEST['usuario']; $strContrasena=$_REQUEST['contrasena']; //echo "Usuario: ".$strUsuario." ".$strContrasena. "<br>"; if(($strUsuario!="")||($strContrasena!="")){ $conn=mysql_connect("localhost","dates","dates"); $bd=mysql_select_db("dates",$conn); $sql = "SELECT id FROM aso WHERE usuario='".$strUsuario."' AND password='".$strContrasena."'"; //echo $sql. "<br>"; $orden_fecha = mysql_query($sql, $conn) or die(mysql_error()); $result = mysql_fetch_assoc($orden_fecha)or die("errores"); $total = mysql_num_rows($result); //echo "total: ".$total. "<br>"; //if($total!=0){ $_SESSION['usuario']=$result['id']; //echo "[".$_SESSION['usuario']. "]"; //} }else{ header("Location: ../index.php"); } ?> thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/48626-problem-session_start-functionsession-start/ Share on other sites More sharing options...
MadTechie Posted April 25, 2007 Share Posted April 25, 2007 read here then here then check line 63 of list.php Quote Link to comment https://forums.phpfreaks.com/topic/48626-problem-session_start-functionsession-start/#findComment-238109 Share on other sites More sharing options...
taith Posted April 25, 2007 Share Posted April 25, 2007 whats on list.php, line 63? Quote Link to comment https://forums.phpfreaks.com/topic/48626-problem-session_start-functionsession-start/#findComment-238111 Share on other sites More sharing options...
alejandron Posted April 25, 2007 Author Share Posted April 25, 2007 thanks for the fast reply my system administrator said to me that the problem is: header("Location: ../index.php"); but he not said the solution Quote Link to comment https://forums.phpfreaks.com/topic/48626-problem-session_start-functionsession-start/#findComment-238120 Share on other sites More sharing options...
MadTechie Posted April 25, 2007 Share Posted April 25, 2007 header("Location: ../index.php"); will fails due to line 63 of list.php printing something to the page Quote Link to comment https://forums.phpfreaks.com/topic/48626-problem-session_start-functionsession-start/#findComment-238130 Share on other sites More sharing options...
alejandron Posted April 27, 2007 Author Share Posted April 27, 2007 thanks, i solution all problems but only have 1 is this: Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/subdomain/index.php:4) in /home/user/public_html/subdomain/conectar.php on line 22 and the conectar.php <?php session_start(); $_SESSION['Titulo']="title"; $strUsuario=$_REQUEST['usuario']; $strContrasena=$_REQUEST['contrasena']; //echo "Usuario: ".$strUsuario." ".$strContrasena. "<br>"; if(($strUsuario!="")||($strContrasena!="")){ $conn=mysql_connect("localhost","dates","dates"); $bd=mysql_select_db("dates",$conn); $sql = "SELECT id FROM aso WHERE usuario='".$strUsuario."' AND password='".$strContrasena."'"; //echo $sql. "<br>"; $orden_fecha = mysql_query($sql, $conn) or die(mysql_error()); $result = mysql_fetch_assoc($orden_fecha)or die("errores"); $total = mysql_num_rows($result); //echo "total: ".$total. "<br>"; //if($total!=0){ $_SESSION['usuario']=$result['id']; //echo "[".$_SESSION['usuario']. "]"; //} }else{ header("Location: ../index.php"); //<<<<------ line 22 } ?> thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/48626-problem-session_start-functionsession-start/#findComment-239493 Share on other sites More sharing options...
alejandron Posted April 27, 2007 Author Share Posted April 27, 2007 is small the error? i can add to htaccess php_value display_errors off ?? Quote Link to comment https://forums.phpfreaks.com/topic/48626-problem-session_start-functionsession-start/#findComment-239647 Share on other sites More sharing options...
MadTechie Posted April 27, 2007 Share Posted April 27, 2007 show the first 5 lines of the index.php file Quote Link to comment https://forums.phpfreaks.com/topic/48626-problem-session_start-functionsession-start/#findComment-239718 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.