Advertisement
Guest User

Untitled

a guest
Sep 7th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 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. if($user == "" || $pass == ""){
  72. ?><script type="text/javascript">alert("username tidak boleh kosong");</script><?php
  73. }else{
  74. $sql = mysql_query("select * from tb_login where username ='$user' and password = md5('$pass')")or die(mysql_error());
  75. $data = mysql_fetch_array($sql);
  76. $cek = mysql_num_rows($sql);}
  77. if($cek>= 1){
  78. if($data['level']=="admin"){
  79. @$_SESSION['admin']= $data['kode_user'];
  80. header("location: index.php");
  81. } else if($data['level']=="operator"){
  82. @$_SESSION['operator']= $data['kode_user'];
  83. header("location: index.php");
  84. }
  85. }
  86. }
  87. }else {
  88. echo"Login gagal";
  89. }
  90. ?>
  91. </div>
  92. </div>
  93. </body>
  94. </html>
  95. <?php
  96. }
  97. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement