karlokokkak

Untitled

Apr 20th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. <?php
  2.     error_reporting(E_ALL);
  3.     ini_set("display_errors", 1);
  4.     session_start();
  5.     print_r( $_SESSION );
  6.     print_r( $_COOKIE );
  7.     //when user is logged in with session
  8.     if (isset($_SESSION['Mobile'])) {
  9.         echo $_SESSION['Mobile']  . " Session <a href='logout.php'>logout</a>";
  10.     }else if(isset($_COOKIE['Mobile'])){ //when user is logged with cookies
  11.         echo $_COOKIE['Mobile']  . " cookie <a href='logout.php'>logout</a>";
  12.     }else{ //when user is not loggedin
  13.         header("Location: login.php");
  14.         exit();
  15.     }
  16. ?>
  17. Welcome $Mobile
Advertisement
Add Comment
Please, Sign In to add comment