Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 9th, 2012  |  syntax: None  |  size: 0.95 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function beforeFilter(){
  2.  
  3.         $this->Cookie->name = 'Snowbird';
  4.         $this->Cookie->time =  3600*24*3;  // 3 jours
  5.         $this->Cookie->path = '/';
  6.         $this->Cookie->domain = $_SERVER['SERVER_NAME'];
  7.         $this->Cookie->secure = false;
  8.  
  9.                 $this->Auth->loginAction = array('controller'=>'users','action'=>'login');
  10.                 $this->Auth->fields = array('username' => 'login','password' => 'pass');
  11.                 $this->Auth->autoRedirect = false;
  12.        
  13.                 $this->Auth->allow();
  14.  
  15.         if (!$this->Auth->user('id_membre') && $this->Cookie->read("User")) {
  16.             if ($this->Auth->login(array("User" => $this->Cookie->read("User")))) {
  17.                 $this->Cookie->write(array("User" => $this->Cookie->read("User")), null, true, "3 days");
  18.             } else {
  19.                 $this->Cookie->delete('User');
  20.             }
  21.         }
  22.  
  23.        
  24.         if ($this->RequestHandler->isAjax()){
  25.             $this->layout = null;
  26.         }
  27.  
  28.  
  29.                
  30.         }