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