Advertisement
Guest User

Untitled

a guest
Dec 25th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.69 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include 'inc/koneksi.php';
  4. ?>
  5.  
  6. <!DOCTYPE html>
  7. <html lang="en">
  8. <head>
  9.     <meta charset="UTF-8">
  10.     <title>Login</title>
  11.     <meta name="viewport" content="width=device-width, initial-scale=1">
  12.     <link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.min.css">
  13.     <link rel="stylesheet" href="css/styles.css">
  14. </head>
  15. <body>
  16.     <section>
  17.         <div class="container">
  18.             <div class="row">
  19.                 <div class="col-md-4 col-md-offset-4 login-form">
  20.                     <h2 class="text-center">Login</h2>
  21.                     <form action="" method="POST">
  22.                         <div class="form-group">
  23.                             <label for="username">Nama</label>
  24.                             <input type="text" class="form-control" name="username">
  25.                         </div>
  26.                         <div class="form-group">
  27.                             <label for="password">Password</label>
  28.                             <input type="password" class="form-control" name="password">
  29.                         </div>
  30.                         <div class="form-group">
  31.                             <input type="submit" value="Log in" class="btn btn-primary" name="login">
  32.                         </div>
  33.                         <p><a href="">Lupa password Anda?</a></p>
  34.                     </form>
  35.  
  36.                     <?php
  37.                     $user = @$_POST['username'];
  38.                     $passs = @$_POST['password'];
  39.                     $login = @$_POST['login'];
  40.  
  41.                     if ($login) {
  42.                         if ($user == "" || $pass = "") {
  43.                             echo "<script>alert('Username atau Password tidak boleh kosong');</script>";
  44.                         } else {
  45.                             $query = mysql_query("SELECT * FROM tb_login  WHERE username = '$user' AND password = '$passs'") or die(mysql_error());
  46.                             $check_login = mysql_num_rows($query);
  47.  
  48.                             if ($check_login >= 1) {
  49.                                 echo "Login Berhasil";
  50.                             } else {
  51.                                 echo "Login Gagal";
  52.                             }
  53.                         }
  54.                     }
  55.                     ?>
  56.  
  57.                 </div>
  58.             </div>
  59.         </div>
  60.     </section>
  61. </body>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement