Example #1
0
 function beforeFilter()
 {
     parent::beforeFilter();
     // Contador de visitas
     if (!$this->Session->check('Ip')) {
         $this->Session->write('Ip', 'echo');
         $ip = new Ip();
         $ip->create(array('ip' => env('REMOTE_ADDR'), 'navegador' => env('HTTP_USER_AGENT'), 'fecha' => getdate()));
         $ip->save();
     }
     $this->Company_Nombre = 'Rubén Toca Lucio';
     $this->Company_Email = '*****@*****.**';
     $this->set('Company_Email', $this->Company_Email);
     $this->set('Company_Nombre', $this->Company_Nombre);
     // hay que comprobar que estás registrado como administrador
     if (isset($this->params['admin'])) {
         $this->checkAdminSession();
     }
     // si no estás registrado Tipo = invitado
     if (!$this->Session->check('Tipo')) {
         $this->Session->write('Tipo', 'invitado');
     }
 }