Jump to content

Help needed


dannybrazil

Recommended Posts

Hello

I dont know why I get this warning message always, I have tried many times and I still cannot figure it out

 

This is themessage:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home2/english4/public_html/student_login.php:2) in /home2/english4/public_html/student_login.php on line 23

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home2/english4/public_html/student_login.php:2) in /home2/english4/public_html/student_login.php on line 23

 

Warning: Cannot modify header information - headers already sent by (output started at /home2/english4/public_html/student_login.php:2) in /home2/english4/public_html/student_login.php on line 29

 

This is the code:

<?php 
include 'dbc.php';

$path_to_page=$_REQUEST['path'];


$user_email = mysql_real_escape_string($_POST['email']);

if ($_POST['submit']=='OK')
{
$md5pass = md5($_POST['password']);
$sql = "SELECT id,Name,user_email FROM Students WHERE 
            user_email = '$user_email' AND 
            user_pwd = '$md5pass' AND user_activated='1'  "; 

$result = mysql_query($sql) or die (mysql_error()); 
$num = mysql_num_rows($result);

    if ( $num != 0 ) { 

        // A matching row was found - the user is authenticated. 
       session_start(); 
   list($user_id,$name,$user_email) = mysql_fetch_row($result);
	// this sets variables in the session 
	$_SESSION['user']= $user_email;  
	$_SESSION['nome']= $name;

	header("Location: student_page.php");

	//echo "Logged in...";
	exit();
    } 

header("Location: $_REQUEST[path]");
//echo "Error:";
exit();		
}

?>

Link to comment
https://forums.phpfreaks.com/topic/212694-help-needed/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.