Guest User

Untitled

a guest
Apr 2nd, 2017
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. <?php
  2. include("config.php");
  3. session_start();
  4.  
  5. if($_SERVER["REQUEST_METHOD"] == "POST") {
  6. // username and password sent from form
  7.  
  8. $myusername = mysqli_real_escape_string($db,$_POST['username']);
  9. $mypassword = mysqli_real_escape_string($db,$_POST['password']);
  10.  
  11. $sql = "SELECT id FROM secbulwark WHERE username = '$myusername' and password = '$mypassword'";
  12. $result = mysqli_query($db,$sql);
  13. $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
  14. $active = $row['active'];
  15.  
  16. $count = mysqli_num_rows($result);
  17.  
  18. // If result matched $myusername and $mypassword, table row must be 1 row
  19.  
  20. if($count == 1) {
  21. session_register("myusername");
  22. $_SESSION['login_user'] = $myusername;
  23.  
  24. header("location: welcome.php");
  25. }else {
  26. $error = "Your Login Name or Password is invalid";
  27. }
  28. }
  29. ?>
  30.  
  31.  
  32. <html lang="en">
  33. <head>
  34. <title>Bootstrap Case</title>
  35. <meta charset="utf-8">
  36. <meta name="viewport" content="width=device-width, initial-scale=1">
  37. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  38. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
  39. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  40. </head>
  41.  
  42. <body>
  43. <center>
  44. <div id="header" style="overflow: hidden; height: 400px">
  45. <img src="SecBul.jpg" style="max-width: 100%" />
  46. </div>
  47.  
  48. <nav class="navbar navbar-inverse">
  49. <div class="container-fluid">
  50. <div class="navbar-header">
  51. <a class="navbar-brand" href="#">Security Bulwark</a>
  52. </div>
  53. <ul class="nav navbar-nav">
  54. <li><a href="Portfolio.html">Portfolio</a></li>
  55. <li><a href="AboutUs.html">About Us</a></li>
  56. </ul>
  57. <ul class="nav navbar-nav navbar-right">
  58. <li><a href="signup.html"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
  59. <li><a href="login.php"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
  60. </ul>
  61. </div>
  62. </nav>
  63.  
  64. <p>
  65. <h2>Please Log In </h2>
  66. <form action = "" method = "POST">
  67. <label>Username: </label><input type = "username" name = "username" class = "box"/><br/><br/>
  68. <label>Password: </label><input type = "password" name = "password" class = "box" /><br/><br/>
  69. <input type = "submit" value = " Submit "/><br />
  70. </form>
  71. <div><?php echo $error; ?></div>
  72. </p>
  73.  
  74. <br></br>
  75. This is a secured website and requires prior authorization to access.
  76. </center>
  77. </body>
  78. </html>
Add Comment
Please, Sign In to add comment