Guest User

Untitled

a guest
Jan 1st, 2019
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. $myusername = mysqli_real_escape_string($db,$_POST['username']);
  2. $mypassword = mysqli_real_escape_string($db,$_POST['password']);
  3.  
  4. $sql = "SELECT id FROM admin WHERE username = '$myusername' and passcode = '$mypassword'";
  5. $result = mysqli_query($db,$sql);
  6. $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
  7. $active = $row['active'];
  8.  
  9. $count = mysqli_num_rows($result);
  10.  
  11. // If result matched $myusername and $mypassword, table row must be 1 row
  12.  
  13. if($count == 1) {
  14. session_register("myusername");
  15. $_SESSION['login_user'] = $myusername;
  16.  
  17. header("location: welcome.php");
  18. }else {
  19. $error = "Your Login Name or Password is invalid";
  20. }
  21.  
  22. <style type = "text/css">
  23. body {
  24. font-family:Arial, Helvetica, sans-serif;
  25. font-size:14px;
  26. }
  27. label {
  28. font-weight:bold;
  29. width:100px;
  30. font-size:14px;
  31. }
  32. .box {
  33. border:#666666 solid 1px;
  34. }
  35. </style>
  36.  
  37. <div align = "center">
  38. <div style = "width:300px; border: solid 1px #333333; " align = "left">
  39. <div style = "background-color:#333333; color:#FFFFFF; padding:3px;"><b>Login</b></div>
  40.  
  41. <div style = "margin:30px">
  42.  
  43. <form action = "" method = "post">
  44. <label>UserName :</label><input type = "text" name = "username" class = "box"/><br /><br />
  45. <label>Password :</label><input type = "password" name = "password" class = "box" /><br/><br />
  46. <input type = "submit" value = " Submit "/><br />
  47. </form>
  48.  
  49. <div style = "font-size:11px; color:#cc0000; margin-top:10px"><?php echo $error; ?></div>
  50.  
  51. </div>
  52.  
  53. </div>
  54.  
  55. </div>
Add Comment
Please, Sign In to add comment