Jump to content

Problem updating Cookie on live host


Recommended Posts

This works fine on localhost, but the same code just won't update my live website cookie. Here's the code:





$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?  :wtf:


Thanks in advance!

Link to comment
Share on other sites

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?  :shrug:


Link to comment
Share on other sites

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?

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.