KingdomX Posted January 3, 2012 Share Posted January 3, 2012 This works fine on localhost, but the same code just won't update my live website cookie. Here's the code: index.php $lg->updateCookies($username, $hashSalt[0]); updateCookies function: $site = '.ciadacapa.com.br'; // --------------------------------------------------- // Updates the cookies // --------------------------------------------------- function updateCookies($username, $hash){ setcookie('ciadacapaUser', '', time()-3600, '/', $this->site); setcookie('ciadacapaHash', '', time()-3600, '/', $this->site); setcookie('ciadacapaUser', $username, time()+3600*24*7, '/', $this->site); setcookie('ciadacapaHash', $hash, time()+3600*24*7, '/', $this->site); return true; } Although the class is receiving the correct values, the cookie just retains the old value it had and never updates. Any ideas on this? Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/254271-problem-updating-cookie-on-live-host/ Share on other sites More sharing options...
AyKay47 Posted January 3, 2012 Share Posted January 3, 2012 $site = 'ciadacapa.com.br'; //remove period my guess is this error lies within the $domain argument. Quote Link to comment https://forums.phpfreaks.com/topic/254271-problem-updating-cookie-on-live-host/#findComment-1303684 Share on other sites More sharing options...
KingdomX Posted January 3, 2012 Author Share Posted January 3, 2012 That shouldn't be the problem, but i changed and tested it and it didn't work. I attached an image with the problem... the new is what it should be updated with. What i'm trying to do is update the cookie Hash every page so that the old hashes are invalidated for security purposes. Again, works fine on localhost, but it just doesn't updates the value on live website. Any more ideas i could try? Quote Link to comment https://forums.phpfreaks.com/topic/254271-problem-updating-cookie-on-live-host/#findComment-1303698 Share on other sites More sharing options...
PFMaBiSmAd Posted January 3, 2012 Share Posted January 3, 2012 The dot . was there for a specific purpose (it makes the cookie match all sub-domains of the domain.) Do you have php's error_reporting set to E_ALL and either display_errors set to ON or log_errors set to ON for your live server so that php would report and display or log all the errors it detects? Quote Link to comment https://forums.phpfreaks.com/topic/254271-problem-updating-cookie-on-live-host/#findComment-1303706 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.