Advertisement
Guest User

Untitled

a guest
Jan 30th, 2019
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.03 KB | None | 0 0
  1. <?php
  2. include('konfig.php');
  3. session_start();
  4. error_reporting(0);
  5. if(isset($_SESSION['user_id'])) { //jika user telah login maka session
  6. header("location: user/index.php"); // akan kembali ke dashboard
  7. }
  8. // If form submitted, insert values into the database.
  9. if (isset($_POST['user_id'])){
  10. // removes backslashes
  11. $username = stripslashes($_REQUEST['user_id']);
  12. //escapes special characters in a string
  13. $username = mysqli_real_escape_string($con,$username);
  14. $password = stripslashes($_REQUEST['password']);
  15. $password = mysqli_real_escape_string($con,$password);
  16. //Checking is user existing in the database or not
  17. $query = "SELECT * FROM `users` WHERE user_id='$username' and password='".md5($password)."'";
  18. $result = mysqli_query($con,$query) or die(mysql_error());
  19. $rows = mysqli_num_rows($result);
  20. if($rows == 0){
  21. echo '<script>
  22. alert("Username/password is incorrect");history.go(-1);
  23. </script>';
  24. }else{
  25. if($row['level'] == 1){
  26. $_SESSION['user_id'] = $username;
  27. $_SESSION['admin']=$username;
  28. echo '<script language="javascript">alert("Anda berhasil Login Admin!"); document.location="admin/index.php";</script>';
  29. }else{
  30. $_SESSION['user_id'] = $username;
  31. $_SESSION['operator']=$username;
  32. echo '<script language="javascript">alert("Anda berhasil Login Operator"); document.location="user/index.php";</script>';
  33. }
  34. }
  35. }
  36. ?>
  37. <!DOCTYPE html>
  38. <html lang="en">
  39. <head>
  40. <meta charset="utf-8">
  41. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  42. <meta name="description" content="Bootstrap Admin App + jQuery">
  43. <meta name="keywords" content="app, responsive, jquery, bootstrap, dashboard, admin">
  44. <title>Bank Sumsel Babel</title>
  45. <!-- =============== VENDOR STYLES ===============-->
  46. <!-- FONT AWESOME-->
  47. <link rel="stylesheet" href="../vendor/fontawesome/css/font-awesome.min.css">
  48. <!-- SIMPLE LINE ICONS-->
  49. <link rel="stylesheet" href="../vendor/simple-line-icons/css/simple-line-icons.css">
  50. <!-- =============== BOOTSTRAP STYLES ===============-->
  51. <link rel="stylesheet" href="css/bootstrap.css" id="bscss">
  52. <!-- =============== APP STYLES ===============-->
  53. <link rel="stylesheet" href="css/app.css" id="maincss">
  54. </head>
  55.  
  56. <body>
  57. <div class="wrapper">
  58. <div class="block-center mt-xl wd-xl">
  59. <!-- START panel-->
  60. <div class="panel panel-dark panel-flat">
  61. <div class="panel-heading text-center">
  62. <a href="#">
  63. <img src="img/logo_bank.png" alt="Image" class="block-center img-rounded">
  64. </a>
  65. </div>
  66. <div class="panel-body">
  67. <p class="text-center pv">SIGN IN TO CONTINUE.</p>
  68. <form role="form" data-parsley-validate="" novalidate="" class="mb-lg" action="" method="post">
  69. <div class="form-group has-feedback">
  70. <input id="user" type="user_id" placeholder="Enter UserID" autocomplete="off" required class="form-control" name="user_id">
  71. <span class="fa fa-user form-control-feedback text-muted"></span><br>
  72. </div>
  73. <div class="form-group has-feedback">
  74. <input id="pass" type="password" placeholder="Password" required class="form-control" name="password">
  75. <span class="fa fa-lock form-control-feedback text-muted"></span>
  76. </div>
  77. <div class="clearfix">
  78. <div class="checkbox c-checkbox pull-left mt0">
  79. <label>
  80. <input type="checkbox" value="" name="remember">
  81. <span class="fa fa-check"></span>Remember Me</label>
  82. </div>
  83. <div class="pull-right"><a href="recover.html" class="text-muted">Forgot your password?</a>
  84. </div>
  85. </div>
  86. <button type="submit" class="btn btn-block btn-primary mt-lg">Login</button>
  87. </form>
  88. </div>
  89. </div>
  90. <!-- END panel-->
  91. <div class="p-lg text-center">
  92. <span>Copyrighted</span>
  93. <span>&copy;</span>
  94. <span>2019</span><br>
  95. <span>All Rights Reserved</span>
  96. </span>
  97. </div>
  98. </div>
  99. </div>
  100. <!-- =============== VENDOR SCRIPTS ===============-->
  101. <!-- MODERNIZR-->
  102. <script src="../vendor/modernizr/modernizr.custom.js"></script>
  103. <!-- JQUERY-->
  104. <script src="../vendor/jquery/dist/jquery.js"></script>
  105. <!-- BOOTSTRAP-->
  106. <script src="../vendor/bootstrap/dist/js/bootstrap.js"></script>
  107. <!-- STORAGE API-->
  108. <script src="../vendor/jQuery-Storage-API/jquery.storageapi.js"></script>
  109. <!-- PARSLEY-->
  110. <script src="../vendor/parsleyjs/dist/parsley.min.js"></script>
  111. <!-- =============== APP SCRIPTS ===============-->
  112. <script src="js/app.js"></script>
  113. </body>
  114. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement