Jump to content

$_SESSION error!


mazazino

Recommended Posts

hi..i wrote this code for when i sign in, it sends another file the id and registers the session...heres the file where i check if the user is a member..

 

$sqluser="select id from members_tbl where username='".$user."' and    password='".$pass."'";

$resuser=mysql_query($sqluser);

$rowsuser=mysql_num_rows($resuser);

if($rowsuser>0)

{

$rows = mysql_fetch_array($resuser);

$id = $rows[0];

$_SESSION['authorized_user']=true;

echo "<script>location.href('../index.php?member=$id');</script>";

}

 

 

heres the second file where i check if the session is registered...and if it is, i print out the user's first and last name..

 

 

<? if(isset($_REQUEST['member'])){

session_save_path("sessions");

session_start();

if(session_is_registered('authorized_user'))

{

if($_SESSION['authorized_user']==true)

{

$idd = $_REQUEST['member'];

$sqlUser =  "select firstname,lastname from members_tbl where id ='".$idd."'";

$resUser = mysql_query($sqlUser);

$rowUser = mysql_fetch_array($resUser);

$first = $rowUser[0];

$last = $rowUser[1];

 

echo "<tr><td><center>Welcome $first $last!</td></tr></center>";

}

}

}

 

 

 

and finally, it does actually print out the name..but this error comes out as well:

 

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\program files\easyphp1-7\www\work\baleish\menu.js:11) in c:\program files\easyphp1-7\www\work\baleish\index.php on line 50

 

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\program files\easyphp1-7\www\work\baleish\menu.js:11) in c:\program files\easyphp1-7\www\work\baleish\index.php on line 50

 

 

 

any ideas?..

Link to comment
https://forums.phpfreaks.com/topic/67553-_session-error/
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.