Advertisement
Guest User

login.php

a guest
Oct 1st, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.58 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if(!empty($_SESSION["authid"])){
  4.     echo "<script>location.href='index.php'</script>";
  5. }
  6. include "./config/db.php";
  7. ?>
  8. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  9. <html xmlns="http://www.w3.org/1999/xhtml">
  10. <head>
  11. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  12. <title>Cpanel Login</title>
  13. <style>
  14. * {
  15.     margin:0 auto;
  16.     padding:0; 
  17. }
  18.  
  19. body {
  20.     background:url(img/skulls.png);
  21. }
  22.  
  23. #layout {
  24.     margin-top:240px;
  25.     width:500px;
  26.     padding:5px;
  27.     background:url(img/green_cup.png);
  28.     padding:20px;
  29.     border-radius:5px;
  30.     -webkit-box-shadow:0 1px 3px #000;
  31.     -moz-box-shadow:0 1px 3px #000;
  32.     box-shadow:0 1px 3px #000; 
  33. }
  34.  
  35. #login {
  36.     float:left;
  37.     border-right:1px dotted #DDD;
  38.     padding-right:3px;
  39. }
  40.  
  41. #login_footer {
  42.     clear:both;
  43. }
  44.  
  45. #right {
  46.     float:right;
  47. }
  48.  
  49. .msg {
  50.     width:250px;
  51.     background-color:#FFDFDF;
  52.     border-radius:0 0 10px 10px;
  53.     color:#666;
  54.     text-align:center;
  55.     border:1px solid #FFB9B9;
  56.     -webkit-box-shadow:0 1px 3px #919191;
  57.     -moz-box-shadow:0 1px 3px #919191;
  58.     box-shadow:0 1px 3px #919191;
  59.     font-family:Verdana, Geneva, sans-serif;
  60.     font-size:10px;
  61.     padding:10px;  
  62. }
  63.  
  64. .input_user {
  65.     border:1px solid #DDD;
  66.     -webkit-box-shadow:0 1px 3px #919191;
  67.     -moz-box-shadow:0 1px 3px #919191;
  68.     box-shadow:0 1px 3px #919191;
  69.     padding:6px;
  70.     margin:1px;
  71.     color:#666;
  72.     font-style:italic;
  73.     width:150px;   
  74. }
  75.  
  76. .input_user:hover {
  77.     background-color:#F8F8F8;
  78. }
  79.  
  80. .input_pass {
  81.     border:1px solid #DDD;
  82.     -webkit-box-shadow:0 1px 3px #919191;
  83.     -moz-box-shadow:0 1px 3px #919191;
  84.     box-shadow:0 1px 3px #919191;
  85.     padding:6px;
  86.     margin:1px;
  87.     color:#666;
  88.     font-style:italic;
  89.     width:150px;
  90.     margin-left:50px;  
  91. }
  92.  
  93. .input_pass:hover {
  94.     background-color:#F8F8F8;
  95. }
  96.  
  97.  
  98. .button {
  99.     margin-top:3px;
  100.     background-image:-moz-linear-gradient(-90deg,#FFF,#F3F3F3);
  101.     background-image:-webkit-linear-gradient(-90deg,#FFF,#F3F3F3);
  102.     border:1px solid #DDD;
  103.     font-size:11px;
  104.     color: #666;
  105.     padding:5px;
  106.     -webkit-box-shadow:0 1px 3px #919191;
  107.     -moz-box-shadow:0 1px 3px #919191;
  108.     box-shadow:0 1px 3px #919191;
  109.     border-radius:.3em;
  110.     cursor:pointer;
  111.     margin-right:2px;
  112.     margin-bottom:5px; 
  113. }
  114.  
  115. .button:hover {
  116.     background-image:-moz-linear-gradient(-90deg,#F3F3F3,#FFF);
  117.     background-image:-webkit-linear-gradient(-90deg,#F3F3F3,#FFF);
  118. }
  119.  
  120. #button {
  121.     margin-left:90px;  
  122. }
  123. </style>
  124. </head>
  125. <body>
  126. <div id="layout">
  127. <div id="login">
  128. <form method="post" action="">
  129. <table>
  130. <tr><td><input type="text" name="username" class="input_user" /></td></tr>
  131. <tr><td><input type="password" name="password" class="input_pass" /></td></tr>
  132. <tr><td><span id="button"><input type="submit" value="Login" class="button" name="btn_login" /><input type="button" value="Cancel" onclick="self.history.back()" class="button" /></span>
  133. </td></tr>
  134. </table>
  135. </form>
  136. <?php
  137. if(isset($_POST["btn_login"])){
  138.     if(empty($_POST["username"])||empty($_POST["password"])){  
  139.         NULL;
  140.     }else{
  141.         $pass = md5($_POST["password"]);
  142.         $sql = mysql_query("SELECT * FROM tbl_admin WHERE username = '$_POST[username]' AND password = '$pass'");
  143.         $check = mysql_num_rows($sql);
  144.         $r = mysql_fetch_array($sql);
  145.         if($check < 1){
  146.             NULL;  
  147.         }else{
  148.             session_register("authid");
  149.             $_SESSION["authid"] = $r['id_admin'];
  150.             echo "<script>location.href='index.php'</script>";
  151.         }
  152.     }
  153. }
  154. ?>
  155. </div>
  156. <div id="right">
  157. <div class="msg">
  158. Welcome admin :)<br />
  159. Input your username and password to login to your system!
  160. </div>
  161. </div>
  162. <div id="login_footer"></div>
  163. </div>
  164. </body>
  165. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement