Advertisement
arief676

villa

May 20th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.97 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include("config.php");
  4. ?>
  5. <!DOCTYPE html>
  6. <!--[if lt IE 7 ]><html lang="en" class="ie6 ielt7 ielt8 ielt9"><![endif]--><!--[if IE 7 ]><html lang="en" class="ie7 ielt8 ielt9"><![endif]--><!--[if IE 8 ]><html lang="en" class="ie8 ielt9"><![endif]--><!--[if IE 9 ]><html lang="en" class="ie9"> <![endif]--><!--[if (gt IE 9)|!(IE)]><!-->
  7. <html lang="en"><!--<![endif]-->
  8.     <head>
  9.         <meta charset="utf-8">
  10.         <title>Admin Login</title>
  11.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  12.         <link href="css/bootstrap.min.css" rel="stylesheet">
  13.         <link href="css/bootstrap-responsive.min.css" rel="stylesheet">
  14.         <link href="css/site.css" rel="stylesheet">
  15.         <!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
  16.     </head>
  17.     <body>
  18.         <div id="login-page" class="container">
  19.             <h1>Admin Login</h1>
  20.             <form id="login-form" class="well" action="" method="post">
  21.             <input type="text" class="span2" placeholder="Username" name="user" /><br />
  22.             <input type="password" class="span2" placeholder="Password" name="pass" /><br />
  23.             <button type="submit" class="btn btn-primary" name="button">Sign in</button>
  24.            
  25.         </form>
  26.         </div>
  27.         <script src="js/jquery.min.js"></script>
  28.         <script src="js/bootstrap.min.js"></script>
  29.         <script src="js/site.js"></script>
  30.     </body>
  31. </html>
  32.  
  33. <?php
  34. if(isset($_POST['button']))
  35. {
  36.     $pu=$_POST['user'];
  37.     $pp=$_POST['pass'];
  38.     $sql=sprintf("Select count(login_id) as b,cat_login_id as c from login_web where username='%s' and password='%s'",$pu,md5($pp)) or die(mysql_error());
  39.     $q=mysql_query($sql);
  40.     $r=mysql_fetch_array($q);
  41.     $g=$r['c'];
  42.     if($r['b']==0)
  43.     {
  44.         echo "<center>Username/password yang anda masukan salah</center>";
  45.     }else{
  46.         $_SESSION['user']=$_POST['user'];
  47.         $pl="";
  48.         if($g=="1")
  49.         {
  50.             $pl="admin";
  51.         }elseif($g=="2"){
  52.             $pl="member";
  53.         }
  54.         $_SESSION['hash']=$pl;
  55.         echo "<script>window.location='admin/index.php'</script>";
  56.     }
  57. }
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement