Esempio n. 1
0
 public function confirmation()
 {
     $verify = new Verify($this->db);
     $mobile = $this->f3->get('SESSION.mobile');
     //$verify->load(array('user=?',$mobile));
     if (!$this->f3->get('SESSION.mobile')) {
         // Invalid session
         $this->f3->reroute('/user/login');
     }
     if ($this->f3->exists('POST.confirm_code')) {
         $user = new User($this->db);
         $user->load(array('mobile=?', $mobile));
         $confirm_details = $verify->find(array('user=?', $mobile), array('order' => 'id DESC', 'limit' => 1));
         foreach ($confirm_details as $obj) {
             $confirm_code = $obj->code;
         }
         $code = $this->f3->get('POST.code');
         if ($code == $confirm_code) {
             $user->verify = 'yes';
             $user->save();
             $this->f3->reroute('/home');
         } else {
             $this->f3->reroute('/confirmation/Invalid confirmation code entered');
         }
     }
     if ($this->f3->exists('SESSION.mobile') && !$this->f3->exists('POST.confirm_code')) {
         $this->f3->set('message', $this->f3->get('PARAMS.message'));
         $this->f3->set('view', 'confirmation.htm');
     } else {
         $this->f3->reroute('/user/login');
     }
 }