Guest User

Untitled

a guest
Jul 14th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. //Example Login Code:
  2. if($username=="ok" && $password =="ok"){
  3. ....//Create login sessions and send cookies
  4.  
  5. if(!isset($_SESSION['time'])){//Save login datetime to the session
  6. $_SESSION['time']=time();
  7. }
  8.  
  9. }
  10.  
  11. //Example Logout Code:
  12. $duration=time() - $_SESSION['time'];//calculate duration
  13. echo "Time user was logged in is".$duration;
  14. session_destroy();
Add Comment
Please, Sign In to add comment