Guest User

Untitled

a guest
Feb 26th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. $select = $con->prepare("SELECT * FROM users WHERE username='$username' and password='$password'");
  2. $select_>setFetchMode(PDO::FETCH_ASSOC);
  3. $select->execute();
  4.  
  5. $data=$select->fetch();
  6. if($data['username']!=$username and $data['password']!=$password)
  7. {
  8. echo "invalid username or password";
  9. }
  10. elseif($data['username']=$username and $data['password']=$password)
  11. {
  12. $_SESSION['email']=$data['email'];
  13. $_SESSION['name']=$data['name'];
  14. header ("location:profile.php");
  15. }
  16. }
  17. }
  18. catch(PDOException $e)
  19. {
  20. echo "error".$e->getMessage();
  21. }
  22.  
  23. <form name="myForm" method="post">
  24. <input type="text" placeholder="Type name & hit enter" name="email"><br><br>
  25. <input type="password" placeholder="Enter Password"name="password"><br><br>
  26. <input type="submit" value="SIGN IN" name="signin">
Add Comment
Please, Sign In to add comment