Advertisement
02190319693

login2.php

Jan 12th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.93 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include "inc/koneksi.php";
  4.  
  5. if(@$_SESSION['admin'] || @$_SESSION['operator']) {
  6. header("location: index.php");
  7. } else {
  8. ?>
  9.  
  10. <!DOCTYPE html>
  11. <html lang="en">
  12. <head>
  13. <meta charset="utf-8">
  14. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  15. <meta name="viewport" content="width=device-width, initial-scale=1">
  16. <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  17. <title>NF Jati Mekar</title>
  18.  
  19. <!-- Bootstrap -->
  20. <link href="css/bootstrap.min.css" rel="stylesheet">
  21.  
  22. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  23. <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  24. <!--[if lt IE 9]>
  25. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  26. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  27. <![endif]-->
  28. <style type="text/css">
  29. body{
  30. background-color: #eee;
  31. }
  32. </style>
  33. </head>
  34. <body>
  35.  
  36. <div class="container">
  37. <p><br/></p>
  38. <div class="row">
  39. <div class="col-xs-6 col-sm-4"></div>
  40. <div class="col-xs-6 col-sm-4"></div>
  41. <div class="clearfix visible-xs-block"></div>
  42. <div class="col-xs-6 col-sm-4">
  43. <div class="panel panel-info">
  44. <div class="panel-body">
  45. <div class="page-header">
  46. <h3><p class="text-center">Login Area</p></h3>
  47. </div>
  48. <form role="form" action="" method="post">
  49.  
  50. <?php
  51. $user = @$_POST['user'];
  52. $pass = @$_POST['pass'];
  53. $login = @$_POST['login'];
  54.  
  55. if($login) {
  56. if($user == "") {
  57. echo "Username tidak boleh Kosong";
  58. } else if($pass == "") {
  59. echo "Password tidak boleh kosong";
  60. } else {
  61. $sql = mysql_query("select * from tb_login where username = '$user' and password = md5('$pass')") or die (mysql_error());
  62. $data = mysql_fetch_array($sql);
  63. $cek = mysql_num_rows($sql);
  64. if($cek >= 1) {
  65. if($data['level'] == "admin") {
  66. @$_SESSION['admin'] = $data['kode_user'];
  67. header("location: index.php");
  68. } else if($data['level'] == "operator") {
  69. @$_SESSION['operator'] = $data['kode_user'];
  70. header("location: index.php");
  71. }
  72. } else {
  73. echo "login gagal";
  74. }
  75. }
  76. }
  77. ?>
  78. <div class="form-group">
  79. <label for="exampleInputEmail1">Username</label>
  80. <div class="input-group">
  81. <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
  82. <input type="text" name="user" class="form-control" id="exampleInputEmail1" placeholder="username">
  83. </div>
  84. </div>
  85. <div class="form-group">
  86. <label for="exampleInputPassword1">Password</label>
  87. <div class="input-group">
  88. <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
  89. <input type="password" name="pass" class="form-control" id="exampleInputPassword1" placeholder="Password">
  90. </div>
  91. </div>
  92. <hr/>
  93. <button type="button" class="btn btn-success"><span class="glyphicon glyphicon-plus"></span> Daftar</button>
  94. <button type="submit" name="login" value="Login" class="btn btn-primary"><span class="glyphicon glyphicon-log-in"></span> Login</button>
  95. <p><br/></p>
  96. </form>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102.  
  103. <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
  104. <script src="https://ajax.googleapis.com/ajax/li/jquery/1.11.3/jquery.min.js"></script>
  105. <!-- Include all compiled plugins (below), or include individual files as needed -->
  106. <script src="js/bootstrap.min.js"></script>
  107. </body>
  108. </html>
  109.  
  110. <?php
  111. }
  112. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement