SHARE
TWEET

Untitled

a guest May 26th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. session_start(); // Start session nya
  3. // Kita cek apakah user sudah login atau belum
  4. // Cek nya dengan cara cek apakah terdapat session username atau tidak
  5. if(isset($_SESSION['username'])){ // Jika session username ada berarti dia sudah login
  6.   header("location: welcome.php"); // Kita Redirect ke halaman welcome.php
  7. }
  8. ?>
  9. <html>
  10. <head>
  11.   <title>Halaman Sebelum Login</title>
  12. </head>
  13. <body>
  14.   Silahkan untuk login terlebih dahulu ya...
  15.  
  16.   <div style="color: blue;margin-bottom: 15px;">
  17.     <?php
  18.     // Cek apakah terdapat cookie dengan nama message
  19.     if(isset($_COOKIE["message"])){ // Jika ada
  20.       echo $_COOKIE["message"]; // Tampilkan pesannya
  21.     }
  22.     ?>
  23.   </div>
  24.  
  25.   <form method="post" action="login.php">
  26.     <label>Username</label><br>
  27.     <input type="text" name="username" placeholder="Username"><br><br>
  28.     <label>Password</label><br>
  29.     <input type="password" name="password" placeholder="Password"><br><br>
  30.     <button type="submit">Login</button>
  31.   </form>
  32. </body>
  33. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top