Example #1
0
 function logIn($user, $user_type)
 {
     if (!$user) {
         return;
     }
     $this->username = $_SESSION['username'] = $user;
     $this->usertype = $_SESSION['usertype'] = $user_type;
     $this->loggedin = true;
     if ($this->usertype == session::USER_DOCTOR || $this->usertype == session::USER_REGULAR) {
         //add to online table.
         $date = date('Y-m-d h:i:s');
         OnlineUser::destroy(['id' => $this->username]);
         $u = OnlineUser::create(['id' => $this->username, 'lastseen' => $date]);
     }
 }