Advertisement
sidik98

login

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