aeroson

Untitled

Aug 14th, 2013
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. function isLogged() {
  6. return $_SESSION['admin']>time();
  7. }
  8.  
  9. function login($timeout=-1) {
  10. $timeout=24*60*60;
  11. $_SESSION['timeout']=$timeout;
  12. $_SESSION['admin']=time()+$timeout;
  13. return true;
  14. }
  15.  
  16. function logout() {
  17. if(isset($_SESSION['admin'])) {
  18. unset($_SESSION['admin']);
  19. unset($_SESSION['timeout']);
  20. return true;
  21. }
  22. return false;
  23. }
  24.  
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment