mazazino Posted September 1, 2007 Share Posted September 1, 2007 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?.. Quote Link to comment https://forums.phpfreaks.com/topic/67553-_session-error/ Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered() and session_unregister(). Quote Link to comment https://forums.phpfreaks.com/topic/67553-_session-error/#findComment-339308 Share on other sites More sharing options...
mazazino Posted September 1, 2007 Author Share Posted September 1, 2007 If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered() and session_unregister(). then what funcctions should i use? Quote Link to comment https://forums.phpfreaks.com/topic/67553-_session-error/#findComment-339314 Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 you dont need it id what im saying it will work without it. as long as you have $_SESSION[barneyisapurplegaydinosaur]; Quote Link to comment https://forums.phpfreaks.com/topic/67553-_session-error/#findComment-339315 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.