Advertisement
Guest User

Untitled

a guest
Mar 7th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. include("config.php");
  3.  
  4. // Processing form data when form is submitted
  5. if($_SERVER["REQUEST_METHOD"] == "POST") {
  6.  
  7. $username = $_POST['username'];
  8. $password = $_POST['password']);
  9. $query = "SELECT id FROM users WHERE username = $username and password = $password";
  10. $result = mysqli_query($db,$query);
  11. $count = mysqli_num_rows($result);
  12.  
  13. if($count == 1) { //If the posted values are equal to the database values, then session will be created for the user
  14. session_start();
  15. $_SESSION['login_user'] = $username;
  16. header("location: member.php");
  17. }
  18. else {
  19. echo "Invalid username or password";
  20. }
  21. }else{
  22. echo "Form not being posted";
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement