Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- function isLogged() {
- return $_SESSION['admin']>time();
- }
- function login($timeout=-1) {
- $timeout=24*60*60;
- $_SESSION['timeout']=$timeout;
- $_SESSION['admin']=time()+$timeout;
- return true;
- }
- function logout() {
- if(isset($_SESSION['admin'])) {
- unset($_SESSION['admin']);
- unset($_SESSION['timeout']);
- return true;
- }
- return false;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment