Advertisement
Guest User

Untitled

a guest
Jul 17th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <?php
  2. include("db.php");
  3. session_start();
  4. if($_SERVER["REQUEST_METHOD"] == "POST")
  5. {
  6. // username and password sent from Form
  7. $username=mysqli_real_escape_string($db,$_POST['username']);
  8. $password=mysqli_real_escape_string($db,$_POST['password']);
  9. $password=md5($password); // Encrypted Password
  10. $sql="SELECT id FROM admin WHERE username='$username' and passcode='$password'";
  11. $result=mysqli_query($db,$sql);
  12. $count=mysqli_num_rows($db,$result);
  13.  
  14. // If result matched $username and $password, table row must be 1 row
  15. if($count==1)
  16. {
  17. header("location: welcome.php");
  18. }
  19. else
  20. {
  21. $error="Your Login Name or Password is invalid";
  22. }
  23. }
  24. ?>
  25. <div class="wrapper">
  26. <form class="form-signin" action="login.php" method="post">
  27. <h2 class="form-signin-heading">Please login</h2>
  28. <input type="text" class="form-control" name="username" placeholder="User Name" required="" autofocus="" />
  29. </br>
  30. <input type="password" class="form-control" name="password" placeholder="Password" required=""/>
  31. <label class="checkbox">
  32. <input type="checkbox" value="remember-me" id="rememberMe" name="rememberMe"> Remember me
  33. </label>
  34. <button class="btn btn-lg btn-primary btn-block" type="submit">Login</button>
  35. </form>
  36. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement