Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. <?php
  2.  
  3. class User
  4. {
  5.     private $userSession; // holds username session
  6.     private $idSession; // holds user id session
  7.     private $database; // holds database object
  8.     private $isLoggedIn; // boolean for easy checking
  9.  
  10.     function __construct($userSession = NULL)
  11.     {
  12.         $this->userSession = $_SESSION['username']; // getting session of the user
  13.         $this->idSession = $_SESSION['user_id']; // getting id session of the user
  14.         $this->database = new DB (); // creates instance of the class DB
  15.         $this->isLoggedIn = false; // just a property for easy work
  16.  
  17.     }
  18.  
  19.     public function isLogged($username){
  20.  
  21.         if($this->userSession == TRUE){
  22.  
  23.             $this->isLoggedIn = TRUE;
  24.  
  25.         }else{
  26.             echo 'You are not logged in';
  27.         }
  28.  
  29.     }
  30.    
  31.     public function changePassword(){
  32.        
  33.     }
  34.    
  35.     public function userLogout(){
  36.        
  37.     }
  38.    
  39.     public function userLogin(){
  40.        
  41.     }
  42.    
  43.    
  44.    
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement