Advertisement
Guest User

Modifed By Agus Fikri Suyuthi

a guest
Jun 29th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.76 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. $user["adm"] = "adm";
  5.  
  6. if (!isset($_SESSION['logged_in']))
  7. {
  8.     if ($_SERVER['REQUEST_METHOD'] == 'POST')
  9.     {
  10.         if (empty($_POST['username']) || empty($_POST['password']))
  11.         {
  12.             echo '<center><span style="color:red; font-weight: bold">Please fill in all fields!</span></center>';
  13.         }
  14.         elseif ($user[$_POST['username']] != $_POST['password'])
  15.         {
  16.             echo '<span style="color:red; font-weight: bold">Your username/password is wrong!</span>';
  17.         }
  18.         else
  19.         {
  20.             $_SESSION['ingelogd'] = true;
  21.             echo '<span style="color:green; font-weight: bold">You are now logged in!</span>';
  22.         }
  23.     }
  24.    
  25. }
  26.  
  27. if (isset($_SESSION['ingelogd'])) {
  28.  
  29.  
  30. ?> <br /><br />
  31.  
  32. <html>
  33. <head>
  34. <title> RAHASIA NEGARA </title>
  35. </head>
  36. <body>
  37. <?php
  38.       if(isset($_GET['fikri']) == 'tamvans'){
  39.        
  40.         @session_start();
  41.  
  42.  
  43. @session_destroy();
  44. header("location:tes-baru.php");
  45.    
  46.       }
  47.       ?>
  48. Welcome , <span style="color:blue; font-weight: bold"><?php echo $user["adm"] ?>    </span> | <a href='?fikri=tamvans'>Mau Logout ?</a><br/><br/>
  49. Ini Hanya contoh , Daftar Pengguna / Siswa :<br />
  50. - Nama Siswa (KELAS)<br />
  51. - Nama Siswa (KELAS)<br />
  52.  
  53.  
  54. </body>
  55. </html>
  56. <?php
  57. }
  58.  
  59. else
  60.     {
  61.         exit('<title>Login Dulu Pea</title><center>You need to log-in to view this page.<br /><br />
  62.        <form method="POST" action=""><p>
  63.        Username:<br />
  64.        <input required type="text" name="username" /><br /><br />
  65.        Password:<br />
  66.        <input required type="password" name="password" /><br /><br />
  67.        <input type="submit" value="Login" /> <input type="reset" value="Empty fields" />
  68.        </form></center>');
  69.     }
  70. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement