示例#1
0
 public function view_user_password()
 {
     $user_password_tbl = user_password::all();
     $title = "Test View Display";
     return view('test.view', compact('user_password_tbl', 'title'));
 }
 public function usr_login_check()
 {
     // Check if all session variables are set
     if (isset($_SESSION['user_id'], $_SESSION['username'], $_SESSION['login_string'])) {
         $user_id = $_SESSION['user_id'];
         $login_string = $_SESSION['login_string'];
         $username = $_SESSION['username'];
         // Get the user-agent string of the user.
         $user_browser = $_SERVER['HTTP_USER_AGENT'];
         if ($login = user_password::where('usr_id', '=', $user_id)->take(1)) {
             if ($login->count() == 1) {
                 // If the user exists get variables from result.
                 $login->password = $password;
                 $login_check = hash('sha512', $password . $user_browser);
                 if ($login_check == $login_string) {
                     // Logged In!!!!
                     return true;
                 } else {
                     // Not logged in
                     return false;
                 }
             } else {
                 // Not logged in
                 return false;
             }
         } else {
             // Not logged in
             return false;
         }
     } else {
         // Not logged in
         return false;
     }
 }