Advertisement
Guest User

Untitled

a guest
Mar 30th, 2019
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.48 KB | None | 0 0
  1. <?php require '../config/database.php'; ?>
  2.  
  3. <!DOCTYPE html>
  4. <html lang="en" >
  5. <head>
  6.   <meta charset="UTF-8">
  7.   <title>Login Area</title>
  8.  
  9.   <!-- Bootstrap css -->
  10.   <link rel='stylesheet' href='../assets/bootstrap/css/bootstrap.css'>
  11.  
  12.    <!-- custom premade css -->
  13.   <link rel="stylesheet" href="../assets/custom/login.css">
  14.  
  15. </head>
  16.  
  17. <body>
  18. <div class="container">
  19. <?php
  20.  
  21. if (isset($_POST['login'])) {
  22.   $username = trim(mysqli_real_escape_string($koneksi,$_POST['username']));
  23.   $password = trim(mysqli_real_escape_string($koneksi,$_POST['password']));
  24.  
  25.   $login = mysqli_query($koneksi,"SELECT * FROM login_asisten WHERE id_asisten = '$username' AND password = '$password'") or die (mysqli_error($koneksi));
  26.  
  27.   if (mysqli_num_rows($login) > 0 ) {
  28.     $akun = mysqli_fetch_array($login);
  29.     $_SESSION['id'] = $akun["id_asisten"];
  30.     $_SESSION['level'] = $akun["level"];
  31. } else { ?>
  32.  
  33. <div class="row">
  34.             <div class="col-lg-6 col-lg-offset-3">
  35.                 <div class="alert alert-danger alert-disamissable" role="alert">
  36.                     <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
  37.                     <span class="glyphicon glyphicon-excalamtion-sign" aria-hidden="true"></span>
  38.                     <strong>Login Gagal!</strong>Username atau Password Salah
  39.                 </div>
  40.             </div>
  41.         </div>
  42.  
  43. <?php } } ?>
  44.  
  45.   <!-- Login Box -->
  46.   <div class="card panel-login my-5 mx-auto p-5 w-50">
  47.   <div class="row">
  48.     <div class="col"><hr></div>
  49.     <div class="col-auto"><h3>Login Area</h3></div>
  50.     <div class="col"><hr></div>
  51.   </div>
  52.  
  53.  
  54.   <form action="" method="post" class="login-form">
  55.     <div class="form-group">
  56.       <label for="username">Username</label>
  57.       <div class="input-group">
  58.         <input type="text" name="username" class="form-control username" placeholder="Username" required autofocus>
  59.       </div>
  60.     </div>
  61.     <div class="form-group">
  62.       <label for="password">Password</label>
  63.       <div class="input-group">
  64.         <input type="password" name="password" class="form-control password" placeholder="Password" required>
  65.       </div>
  66.     </div>
  67.     <hr>
  68.     <div class="input-group">
  69.          <input type="submit" name="login" class="btn btn-md btn-block" value="Login">
  70.     </div>
  71.   </form>
  72.  
  73. </div>
  74. </div>
  75. </div>
  76. </body>
  77.  
  78. </html>
  79.  
  80. <script src="../assets/bootstrap/js/bootstrap.js"></script>
  81. <script src="../assets/bootstrap/js/jquery.js"></script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement