Guest User

Untitled

a guest
Mar 6th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. if(isset($_POST['username'], $_POST['password'])){
  2. $username = $_POST['username'];
  3. $password = md5($_POST['password']);
  4. if(empty($username) or empty($password)){
  5. $error = "All Fields required";
  6. }else{
  7. $query = $pdo->prepare("SELECT * FROM users WHERE username = ? AND password = ?");
  8. $query->bindValue(1,$username);
  9. $query->bindValue(2,$password);
  10. $query->execute();
  11.  
  12. $num= $query->rowCount();
  13. echo $num;
  14. if($num == 1){
  15. $_SESSION['logged_in'] = true;
  16. echo "grats";
  17. header('Location: index.php');
  18. exit();
  19. }else{
  20. $error="Invalid Creds";
  21.  
  22. }
  23. }
  24.  
  25. }
Add Comment
Please, Sign In to add comment