Permalink
Browse files

Cookie reading display change to log.

  • Loading branch information...
1 parent bb7f755 commit bfd17530959df53c9de6a466d4db0038a08c7d07 @ardissoebrata committed Mar 15, 2012
Showing with 10 additions and 8 deletions.
  1. +10 −8 application/libraries/Auth.php
@@ -33,7 +33,7 @@ class Auth
// default values
private $cookie_name = 'autologin';
private $cookie_encrypt = TRUE;
- private $autologin_expire = 5184000;
+ private $autologin_expire = 604800;
private $hash_algorithm = 'sha256';
private $ci;
private $em;
@@ -173,8 +173,11 @@ private function delete_autologin()
{
// remove current series
$autologin = $this->em->find('auth\models\Autologin', array('user' => $cookie['id'], 'series' => $cookie['series']));
- $this->em->remove($autologin);
- $this->em->flush();
+ if ($autologin)
+ {
+ $this->em->remove($autologin);
+ $this->em->flush();
+ }
// delete cookie
$this->ci->input->set_cookie(array('name' => $this->cookie_name, 'value' => '', 'expire' => ''));
@@ -192,13 +195,13 @@ private function autologin()
{
// remove expired keys
$time = new DateTime();
- $query = $this->em->createQuery('DELETE u FROM auth\models\Autologin u WHERE (u.created < :expired)')
- ->setParameter('expired', $time->sub(new DateInterval('P' . $this->autologin_expire . 'S')));
+ $query = $this->em->createQuery('DELETE auth\models\Autologin u WHERE (u.created < :expired)')
+ ->setParameter('expired', $time->sub(new DateInterval('PT' . $this->autologin_expire . 'S')));
$query->execute();
// get private key
$private = $this->em->createQuery('SELECT u.privatekey FROM auth\models\Autologin u WHERE (u.user = :user) AND (u.series = :series)')
- ->setParameter(array(
+ ->setParameters(array(
'user' => $cookie['id'],
'series' => $cookie['series']
))
@@ -269,8 +272,7 @@ private function read_cookie()
$data = @unserialize($data);
- echo 'reading cookie<br>';
- print_r($data);
+ log_message('debug', 'reading cookie<br />' . print_r($data, TRUE));
if (isset($data['id']) && isset($data['series']) && isset($data['key']))
{

0 comments on commit bfd1753

Please sign in to comment.