Shadowing Posted December 2, 2011 Share Posted December 2, 2011 I"m doing a online tutor and the guy who wrote the tutor his code isnt working. Its supposed to create a cookie but I searched for the cookie and it doesnt exists if someone could please help me id really appreciate it. my server connect file has this code at the top <?php session_start(); ob_start(); then another page with this code below $_SESSION['user_id'] = $row['id'];// this line of code is very important. This saves the user id in the php session so we can use it in the game to display information to the user. $result = mysql_query("UPDATE users SET userip='".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."',login_ip='".mysql_real_escape_string($row['login_ip'])."' WHERE id='".mysql_real_escape_string($_SESSION['user_id'])."'") or die(mysql_error()); // to test that the session saves well we are using the sessions id update the database with the ip information we have received. header("Location: Sample.php"); // this header redirects me to the Sample.php i made earlier if(isset($_SESSION['user_id'])) { // if already logged in. session_unset(); session_destroy(); echo "You have been logged out."; Quote Link to comment Share on other sites More sharing options...
Shadowing Posted December 2, 2011 Author Share Posted December 2, 2011 I just ran a session test using a view counter and now I understand what a session is lol. no wonder why its not creating a cookie cause there is no create cookie code I thought creating a session was creating a cookie but apparently a session is just something temporary stored on the server. 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.