Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.