0

I have issues sometimes with CakePhp.

1 - When they users logged in, I save the username in Session, and also do some Cache logic to avoid some useless queries:

    $cacheTime = '24h';
    $cacheKey = md5(self::SITE_NAME . ' - ' . $login);

    $cachedLogin = Cache::read($cacheKey, $cacheTime);
    if ($cachedLogin) {

        $this->log('Already logged in : ' . $cachedLogin, 'curl');

        $this->Session->write('user_logged', 1);
        $this->Session->write('username', $cachedLogin);

        $this->redirect(array('controller' => 'interactions', 'action' => 'pronostics', '?' => array('disclaimer_popup' => 1)));
    }

Then when they click on disconnect, sometimes, I don't have the username set in the Session:

if ($this->Session) {
    $cacheKey = md5(self::SITE_NAME . ' - ' . $this->Session->read('username'));
    $cacheTime = '24h';
    Cache::delete($cacheKey, $cacheTime);

    $this->log('Logout : ' . $this->Session->read('username'), 'curl');

    $this->Session->destroy();
}

When I check logs, sometimes I don't have username set (I get : Logout : instead of Logout : kamelmah for example )

2 - I have the same issue on my payments controller : I use Paypal in order to make users subscribing my services. For 95% of the transactions everything goes well, but for 5% of them , I lost datas between the beginning and the end of the process. Beginning is to choose username, email, password ; I set this in a Session. When the payment is done, I create the entry in db with informations stored in the session but I have issues with 5% of them because datas stored in session are lost and I dunno why.

Is theses kind of issues happens often for you also ? What did you do to fix it ?

Thanks.

4

0 回答 0