Advertisement
Guest User

Untitled

a guest
Sep 7th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. <?php
  2. @session_start();
  3. include "inc/koneksi.php";
  4. if (@$_SESSION['admin'] || @$_SESSION['operator'])
  5. {?>
  6. <!DOCTYPE html>
  7. <html>
  8. <head>
  9. <title>Log Masuk</title>
  10. <style type="text/css">
  11. body{
  12. font-family:arial;
  13. font-size:14px;
  14. background-color:#222;
  15. }
  16. #utama{
  17. width:300px;
  18. margin:0 auto;
  19. margin-top:12%;
  20.  
  21. }
  22. #judul{
  23. padding:15px;
  24. text-align:center;
  25. color:#fff;
  26. font-size:20px;
  27. background-color:#339966;
  28. border-top-right-radius:10px;
  29. border-top-left-radius:10px;
  30. border-bottom:3px solid #336666;
  31. }
  32. #inputan{
  33. background-color:#ccc;
  34. padding:20px;
  35. border-bottom-right-radius:10px;
  36. border-bottom-left-radius:10px;
  37. }
  38. input{
  39. padding:10px;
  40. border:0;
  41. }
  42. .lg{
  43. width:240px;
  44. }
  45. .btn{
  46. background-color:#339966;
  47. border-radius:10px;
  48. color:#fff;
  49. width:260px;
  50. }
  51. .btn:hover{
  52. background-color:#336666;
  53. cursor:pointer;
  54. }
  55. </style>
  56. </head>
  57. <body>
  58. <div id="utama">
  59. <div id="judul">Login eProfil</div>
  60. <div id="inputan">
  61. <form action="" method="post">
  62. <div><input type="text" name="user" placeholder="Isi No. KP" class="lg"></div>
  63. <div style="margin-top:10px;"><input type="password" name="pass" placeholder="Isi Katalaluan" class="lg"></div>
  64. <div style="margin-top:10px;"><input type="submit" name="login" value="login" class="btn" ></div>
  65. </form>
  66. <?php
  67. $user = @$_POST['user'];
  68. $pass = @$_POST['pass'];
  69. $login = @$_POST['login'];
  70. if ($login)
  71. {
  72. if ($user == "" || $pass == "")
  73. {
  74. ?><script type="text/javascript">alert("username tidak boleh kosong");</script><?php
  75. }
  76. else
  77. {
  78. $sql = mysql_query("select * from tb_login where username ='$user' and password = md5('$pass')") or die(mysql_error());
  79. $data = mysql_fetch_array($sql);
  80. $cek = mysql_num_rows($sql);
  81. }
  82. if ($cek >= 1)
  83. {
  84. if ($data['level'] == "admin")
  85. {
  86. @$_SESSION['admin'] = $data['kode_user'];
  87. header("location: index.php");
  88. }
  89. else if ($data['level'] == "operator")
  90. {
  91. @$_SESSION['operator'] = $data['kode_user'];
  92. header("location: index.php");
  93. }
  94. }
  95. }
  96. ?>
  97. </div>
  98. </div>
  99. </body>
  100. </html>
  101. <?php
  102. }
  103. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement