turkman Posted September 17, 2010 Share Posted September 17, 2010 when i expire a cookie, it expires on stand alone files but any references to $_COOKIE in include files still show the old cookie. How can i expire the cookie in include files. Quote Link to comment Share on other sites More sharing options...
rwwd Posted September 17, 2010 Share Posted September 17, 2010 unset($_COOKIE) would usually do the trick, but sometimes you need to set a cookie with the same name to have a lifespan of 0 mins as well as unsetting it Rw Quote Link to comment Share on other sites More sharing options...
turkman Posted September 17, 2010 Author Share Posted September 17, 2010 didn't work. still on one page its the new cookie, go to a different page and displays old cookie. try yourself i have debugging on. supercookie is what you are looking for. go to the site it will create a cookie. go to stuff, log out you will be redirected to main page and have a new cookie click on post, bulletins, faq and you will have old cookie back www.imgboard.co.uk Quote Link to comment Share on other sites More sharing options...
Miss_Rebelx Posted September 17, 2010 Share Posted September 17, 2010 Hey OP, just saying: Rule #13: Duplication of topics is strictly prohibited. Users will not post duplicate topics, if a topic needs moved please use the "Report to Moderator" button and a staff member will move the topic as soon as possible. (http://www.phpfreaks.com/forums/index.php/topic,310296.0.html) Also, trying to post out all the meaningful bits of code helps - for example the log out bit, both places where you set cookies, etc. Quote Link to comment Share on other sites More sharing options...
turkman Posted September 17, 2010 Author Share Posted September 17, 2010 the other thread didn't make sense. Thought this was more clear. Its just stupid problems now. I can log in and override the existing cookie and get a new one. But using basically the same function i CANNOT get it to change. This bit works, if i have a cookie and log in. It will override the cookie. if($p==$row['pass']){ $n = $row['uname']; $_SESSION['uname'] =$row['uname']; $_SESSION['ID']= $row['ID']; $_SESSION['LEVEL'] = $row['level']; $_SESSION['lv'] = $row['lv']; setcookie("supercookie",$row['scookie'],time() + 60 *60 *24 *30); $cc = $row['scookie']; unset($_SESSION['lf']); echo "<script>location.href='http://www.imgboard.co.uk'</script>."; header("Location: http://www.imgboard.co.uk"); this bit doesnt work, despite being just below the above code in the file. else if(isset($_GET['logout'])){ unset($_SESSION['uname']); unset($_SESSION['ID']); unset($_SESSION['LEVEL']) ; unset($_SESSION['lv']); $cr = $_COOKIE['supercookie']; setcookie("supercookie",$cr ,time() -3600); $charlist = "abcdefghijklmnopqrstuvwxyz0123456789"; $c = ""; for($i = 0; $i < 25; $i++ ){ $r = rand() % strlen($charlist); $c .= $charlist[$r]; } setcookie("supercookie",$c,time() + 60 * 60 * 24 * 30); echo "<script>location.href='http://www.imgboard.co.uk'</script>."; header("Location: http://www.imgboard.co.uk"); } Its practically the same code! yet it doesn't work when i try to logout. However it works when i log in. So fukkn annoying. 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.