Advertisement
kalakuang

login

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