Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*--------------------
- file :dapuk.php
- */
- session_start();
- $use="risky";
- $pas="risky";
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title></title>
- <link rel="stylesheet" href="">
- </head>
- <body>
- <form action="" method="post" accept-charset="utf-8" enctype="multipart/form-data">
- Username : <input type="text" name="username" value="" placeholder="Username"><br><br>
- Password : <input type="password" name="password" value="" placeholder="Password"><br><br>
- <input type="submit" name="submit" value="Login">
- <?php
- if (isset($_POST["submit"])) {
- if (empty($_POST['username']) OR (empty($_POST['username'])))
- {
- echo "username atau password kosong !";
- }
- else
- //($_POST["username"]=="$use" && $_POST["password"]=="$pas")
- {
- $_SESSION["user"] = $_POST["username"];
- $_SESSION["pass"] = $_POST["password"];
- //echo "selamat datang ".$_SESSION["user"];
- /*--------------------
- file :ho.php
- <?php
- session_start();
- echo "selamat datang ".$_SESSION["user"];
- ?>
- <a href="lo.php"><b>Logout</a>
- /*--------------------
- file :lo.php
- <?php
- session_start();
- unset($_SESSION['user']);
- unset($_SESSION['pass']);
- ?>
- <center>
- <h2>Anda telah berhasil logout..</h2>
- Silahkan klik <a href="dapuk.php">disini</a> untuk login kembali
- </center>
- */
- header('location:ho.php');
- }
- }
- ?>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment