Advertisement
lamhottt

Controller-Satu

Aug 26th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. <?php
  2. defined('sys_run_app') OR exit('403 You dont have permission to access / on this server...');
  3.  
  4. use System\GF_Router;
  5.  
  6.  
  7. class User_Controller extends GF_Router
  8. {
  9.    
  10.     // membuat session login
  11.     public function login($session_name,$session_value)
  12.     {
  13.         _createSession($session_name,$session_value);
  14.         return true;
  15.     }
  16.  
  17.     // mengambil data session
  18.     public function getSessionLogin($session_name)
  19.     {
  20.         if (_checkSession($session_name))
  21.         {
  22.             return _getSession($session_name);
  23.         }
  24.     }
  25.  
  26.    
  27.     // destroy session saat logout
  28.     public function logout($session_name)
  29.     {
  30.         _destroySession($session_name);
  31.     }
  32.  
  33.     // check login apakah session ada atau tidak?
  34.     public function checkLogin($session_name)
  35.     {
  36.         // jika session sudah dibuat, maka
  37.         if (_checkSession($session_name))
  38.         {
  39.             // alihkan ke halaman welcome
  40.             self::setView("welcome");
  41.             // lalu exit
  42.             exit;
  43.         }
  44.         else
  45.         {
  46.             // jika tidak, kembalikan nilai FALSE
  47.             return false;
  48.         }
  49.     }
  50.  
  51.    
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement