Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title></title>
  5. <link rel="stylesheet" type="text/css" href="style.css">
  6. </head>
  7. <body>
  8. <br/>
  9. <br/>
  10. <center><h2>SISTEM PENDUKUNG KEPUTUSAN</h2>
  11. <h2>PEMILIHAN KARYAWAN TERBAIK</H2>
  12. </center>
  13. <br/>
  14. <div class="login">
  15. <br/>
  16. <form action="login.php" method="post" onSubmit="return validasi()">
  17. <div>
  18. <label>Username:</label>
  19. <input type="text" name="username" id="username" />
  20. </div>
  21. <div>
  22. <label>Password:</label>
  23. <input type="password" name="password" id="password" />
  24. </div>
  25. <div>
  26. <input type="submit" value="Login" class="tombol">
  27. </div>
  28. </form>
  29. <?php
  30. include 'config.php';
  31.  
  32. $username = $_POST['username'];
  33. $password = $_POST['password'];
  34.  
  35. $login = mysql_query("select * from tbl_admin where username='$username' and password='$password'");
  36. $cek = mysql_num_rows($login);
  37.  
  38. if($cek > 0){
  39. session_start();
  40. $_SESSION['username'] = $username;
  41. $_SESSION['status'] = "login";
  42. header("location:index.php");
  43. }else{
  44. header("location:admin/halaman/index.php");
  45. }
  46. ?>
  47. </div>
  48. </body>
  49.  
  50. <script type="text/javascript">
  51. function validasi() {
  52. var username = document.getElementById("username").value;
  53. var password = document.getElementById("password").value;
  54. if (username != "" && password!="") {
  55. return true;
  56. }else{
  57. alert('Username dan Password harus di isi !');
  58. return false;
  59. }
  60. }
  61. </script>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement