Advertisement
Guest User

login

a guest
Jun 23rd, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <?php session_start();
  3. include 'koneksi.php';
  4. if (isset($_POST['username']) && isset($_POST['password']))
  5. {
  6. $username = mysqli_real_escape_string($conn, $_POST['username']);
  7. $password = md5(mysqli_real_escape_string($conn, $_POST['password']));
  8. $result = mysqli_query($conn, "SELECT * FROM tb_user WHERE u_username='$username' and u_password='$password'");
  9. $count = mysqli_num_rows($result);
  10. $row = mysqli_fetch_array($result, MYSQLI_ASSOC);
  11. if($row['level'] == 1){
  12. $_SESSION['login_user']=$username;
  13. echo '<script language="javascript">alert("Anda berhasil Login Admin!"); document.location="inventory/index.php";</script>';
  14. }else if($row['level'] == 2){
  15. $_SESSION['login_user']=$username;
  16. echo '<script language="javascript">alert("Anda berhasil Login Admin!"); document.location="pengiriman/index.php";</script>';
  17. }else if($row['level'] == 3){
  18. $_SESSION['login_user']=$username;
  19. echo '<script language="javascript">alert("Anda berhasil Login Admin!"); document.location="general/index.php";</script>';
  20.  
  21. }else
  22. {
  23.  
  24. echo '<script language="javascript">alert("Maaf Username Password anda salah!"); document.location="index.php";</script>';
  25. }
  26. } ?>
  27.  
  28.  
  29. <html lang="en">
  30.  
  31. <head>
  32. <meta charset="UTF-8" />
  33. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
  34. <title>
  35. My Site
  36. </title>
  37. <link rel="stylesheet" href="css/bootstrap.css"/>
  38. <link rel="stylesheet" href="css/custom.css"/>
  39. <script src="js/jquery.min.js">
  40. </script>
  41. <script src="js/jquery.ui.shake.js">
  42. </script>
  43. <script>
  44.  
  45. </script>
  46. </head>
  47.  
  48. <body>
  49. <div class="container">
  50. <div id="box" class="">
  51. <div class="card card-container wella">
  52. <div align="center">
  53. <h4>Application Inventory</h4>
  54. <img id="profile-img" class="" src="images/perhutani.png" width="50px" height="50px" align="center" />
  55. </div>
  56. <p id="profile-name" class="profile-name-card">
  57. </p>
  58. <form action="" method="post">
  59. <label>
  60. Username
  61. </label>
  62. <input type="text" name="username" class="form-control" autocomplete="off" id="username" required/>
  63. <label>
  64. Password
  65. </label>
  66. <input type="password" name="password" class="form-control" autocomplete="off" id="password" required/>
  67. <br/>
  68. <input type="submit" class="btn btn-lg btn-primary btn-block btn-signin" value="Login" id="login"/>
  69. <span class='alert'>
  70. </span>
  71. <div id="error">
  72. </div>
  73. </form>
  74. </div>
  75. </div>
  76. </div>
  77. <script src="js/jquery.backstretch.js">
  78. </script>
  79. <script>
  80. $.backstretch(["images/1.jpg", "images/2.jpg", "images/3.jpg", "images/4.jpg"], {
  81. fade: 750,
  82. duration: 4000
  83. });
  84. </script>
  85. </body>
  86.  
  87. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement