corillo181 Posted April 28, 2006 Share Posted April 28, 2006 i'm clueless this was working just fine.. and sudddunly it stopped working i never even touche dit after i made it work.. every user function stopped working..this a quick exaplem so someone can tell me if i did something wrong..[code]<?phpsession_start(); ?><? if(isset($_SESSION['username'])){ echo " <table align='left' id='useroptions'> <tr> <td background='images/BOTTLOM.jpg'><p> ".$_SESSION['username'] . " </p> </td> </tr> <tr> <td> </td> </tr> <tr> <td background='images/BOTTLOM.jpg'><a href='phpscript/logout.php'><font color='#000000'>LogOut</font></a></td> </tr> </table>"; }?>[/code]and the user check side looks a litle like this[code]<?phpsession_start(); // Start Sessionsession_register("username");include '../config/db.php';// Conver to simple variables$username = $_POST['username'];$password = $_POST['password'];if($login_check > 0){ while($row = mysql_fetch_array($sql)){ foreach( $row AS $key => $val ){ $$key = stripslashes( $val ); } // Register some session variables! session_register('username'); $_SESSION['username'] = $username; session_register('password'); $_SESSION['password'] = $password; mysql_query("UPDATE users SET last_login=now() WHERE username='$username'"); header("Location: ../index.php"); }}[/code]i know the rule say to chekc out the firs tpost if any one has any session problems.. but is that i wont find any problme with my scrip because it was working fine for few days..i don't know why stopped working and i keep chekcing it and it don't work when the user tries to log in..also in the data base shows the user is online and evn tell if they viewing a page but on the page all the users tools are not display Quote Link to comment Share on other sites More sharing options...
toplay Posted April 28, 2006 Share Posted April 28, 2006 Not to use session_register() and $_SESSION. Just use $_SESSION. Read first caution box at:[a href=\"http://us2.php.net/manual/en/function.session-register.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.session-register.php[/a]FYI: Take a look at our session troubleshooting guide:[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=31047&view=findpost&p=157705\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?...ndpost&p=157705[/a] Quote Link to comment Share on other sites More sharing options...
corillo181 Posted April 28, 2006 Author Share Posted April 28, 2006 i trying with that simple code to test it..[code]<?PHPsession_start();$_SESSION['test'] = 'Hello World!';header('Location: read.php?' . SID);exit;?>[/code][code]<?PHPsession_start();echo isSet($_SESSION['test']) ? $_SESSION['test'] : 'Not Set';?>[/code]and is coming out as not set, but i done everything i let my computer accept any kind of cokies.. you think might be the server? becuse yaho is a big company they shouldn't be having those kind of problem i think..and for something as usefull as session i know they must have it aneble.. i was just using it yesterday it just out of no where stopped working.. i tryed al possible way and it doesn't work :.(.. Quote Link to comment Share on other sites More sharing options...
corillo181 Posted April 28, 2006 Author Share Posted April 28, 2006 oh forget it thank you for your help. i delete my tmp folder an di didn't even notice :|..NOOBS! :D Quote Link to comment Share on other sites More sharing options...
SharkBait Posted April 28, 2006 Share Posted April 28, 2006 toplay: So you're saying not use use both session_register('blah') and $_SESSION['blah']?If I read the first caution right, it means that $_SESSION[] registers the session for me? So I'm just duplicating my code? Quote Link to comment Share on other sites More sharing options...
toplay Posted April 29, 2006 Share Posted April 29, 2006 [!--quoteo(post=369732:date=Apr 28 2006, 03:20 PM:name=SharkBait)--][div class=\'quotetop\']QUOTE(SharkBait @ Apr 28 2006, 03:20 PM) [snapback]369732[/snapback][/div][div class=\'quotemain\'][!--quotec--]toplay: So you're saying not use use both session_register('blah') and $_SESSION['blah']?[/quote]Yes.[!--quoteo(post=369732:date=Apr 28 2006, 03:20 PM:name=SharkBait)--][div class=\'quotetop\']QUOTE(SharkBait @ Apr 28 2006, 03:20 PM) [snapback]369732[/snapback][/div][div class=\'quotemain\'][!--quotec--]If I read the first caution right, it means that $_SESSION[] registers the session for me?[/quote]Yes.[!--quoteo(post=369732:date=Apr 28 2006, 03:20 PM:name=SharkBait)--][div class=\'quotetop\']QUOTE(SharkBait @ Apr 28 2006, 03:20 PM) [snapback]369732[/snapback][/div][div class=\'quotemain\'][!--quotec--]So I'm just duplicating my code?[/quote]Yes, and possibly making it worse because you would be having register_globals on (a security risk) for session_register() to work properly. Plus taking up more memory for the extra variables and the values they hold. Quote Link to comment 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.