Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. session_start();
  4.  
  5. if (empty($_SESSION['username']) AND empty($_SESSION['password'])){
  6.     echo 'INI HALAMAN DEPAN, ANDA BELUM <a href="?modul=login">Login</a>';
  7. }else{
  8.     echo 'ANDA SUDAH LOGIN DENGAN username: <b>'.$_SESSION['username'].'</b> password: <b>'.$_SESSION['password'].'</b> <a href="?modul=logout">Logout</a>';
  9. }
  10.  
  11. switch ($_GET['modul']){
  12.     case "login":
  13.          echo '
  14.          <form name="login" action="ceksession.php" method="POST">
  15.          Username :
  16.          <input type="text" name="username">
  17.          Password :
  18.          <input type="text" name="password" >
  19.          <button type="submit">Login</button>
  20.          </form>';
  21.     break;
  22.  
  23.     case 'logout':
  24.         session_destroy();
  25.         echo "<center>Anda telah sukses keluar sistem </center>";
  26.         echo "<meta http-equiv='refresh' content='1;url=session.php'>";
  27.     break;
  28.  
  29.     default:
  30.         echo 'HALAMAN DEPAN <a href="?modul=login">Login</a>';
  31.     break;
  32. }
  33.  
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement