mqnoy

dapuk.php

Jul 29th, 2015
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.56 KB | None | 0 0
  1. <?php
  2. /*--------------------
  3.                     file :dapuk.php
  4.                     */
  5.     session_start();
  6.    
  7.     $use="risky";
  8.     $pas="risky";
  9.  ?>
  10. <!DOCTYPE html>
  11. <html>
  12. <head>
  13.     <meta charset="utf-8">
  14.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  15.     <title></title>
  16.     <link rel="stylesheet" href="">
  17. </head>
  18. <body>
  19.         <form action="" method="post" accept-charset="utf-8" enctype="multipart/form-data">
  20.         Username : <input type="text" name="username" value="" placeholder="Username"><br><br>
  21.         Password : <input type="password" name="password" value="" placeholder="Password"><br><br>
  22.         <input type="submit" name="submit" value="Login">
  23.         <?php
  24.             if (isset($_POST["submit"])) {
  25.                 if (empty($_POST['username']) OR (empty($_POST['username'])))
  26.                 {
  27.                     echo "username atau password kosong !";
  28.                 }
  29.                  else
  30.                  //($_POST["username"]=="$use" && $_POST["password"]=="$pas")
  31.                  {
  32.                     $_SESSION["user"] = $_POST["username"];
  33.                     $_SESSION["pass"] = $_POST["password"];
  34.                     //echo "selamat datang ".$_SESSION["user"];
  35.                     /*--------------------
  36.                     file :ho.php
  37.                     <?php
  38.                         session_start();
  39.                             echo "selamat datang ".$_SESSION["user"];
  40.                             ?>
  41.                             <a href="lo.php"><b>Logout</a>
  42.                     /*--------------------
  43.                     file :lo.php
  44.                     <?php
  45.                         session_start();
  46.                         unset($_SESSION['user']);
  47.                         unset($_SESSION['pass']);
  48.                         ?>
  49. <center>
  50. <h2>Anda telah berhasil logout..</h2>
  51. Silahkan klik <a href="dapuk.php">disini</a> untuk login kembali
  52. </center>
  53.                     */
  54.                     header('location:ho.php');
  55.                 }
  56.                
  57.             }
  58.            
  59.          ?>
  60.     </form>
  61.  
  62. </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment