sonicphc Posted July 2, 2008 Share Posted July 2, 2008 Maybe I'm missing something really obvious here, but today my site while I was working on it decided that it would no longer log people in and out. I worked out that it is not setting cookies anymore. The problematic piece of code is here: setcookie("logid", $user['id'], time()+400000, "/", ".chaossector.com"); echo "ok"; It's called via AJAX and is set that if it doesn't return "OK" to flag an error. It's not flagging an error, and is more or less behaving like the "setcookie" call doesn't exist. I can set cookies all I want via javascript, but PHP just isn't working. I also tried the following after manually setting the logid cookie through javascript: setcookie("logid", "", time()-400000, "/", ".chaossector.com"); echo $_COOKIE['logid']; and it keeps returning the value I set it to every time. When I go to check if the cookie has been deleted, firefox says the cookie is still there. I just can't seem to fathom why it is completely ignoring any calls to setcookie when it was working just fine yesterday. Any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/112860-cookie-confusion/ Share on other sites More sharing options...
.josh Posted July 2, 2008 Share Posted July 2, 2008 how is $user['id'] being assigned? My very first thought is that you were depending on register globals being on, and your server got upgraded and they are now off. Quote Link to comment https://forums.phpfreaks.com/topic/112860-cookie-confusion/#findComment-579679 Share on other sites More sharing options...
sonicphc Posted July 2, 2008 Author Share Posted July 2, 2008 the $user array is retrieved from a database using mysql_fetch_array() Quote Link to comment https://forums.phpfreaks.com/topic/112860-cookie-confusion/#findComment-579682 Share on other sites More sharing options...
sonicphc Posted July 2, 2008 Author Share Posted July 2, 2008 I decided to go back to basics and try a simple call of setcookie <?php $name = "moose"; $value = "alsowik"; setcookie($name, $value, time()+(60*60*24*365), '/', '.chaossector.com'); ?> And still nothing. No cookie, and also no errors. As there something wrong with my call to setcookie here? Quote Link to comment https://forums.phpfreaks.com/topic/112860-cookie-confusion/#findComment-579690 Share on other sites More sharing options...
Bendude14 Posted July 2, 2008 Share Posted July 2, 2008 Have you looked on your Web Hosts site to make sure they are not doing any server maintainence this could be the problem. Quote Link to comment https://forums.phpfreaks.com/topic/112860-cookie-confusion/#findComment-579707 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.