Guest User

Untitled

a guest
Dec 25th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <?php
  2. SESSION_START();
  3.  
  4. include 'pConnection.php';
  5.  
  6. $username = addslashes($_POST['txtName']);
  7. $password = addslashes(md5($_POST['txtPassword']));
  8.  
  9. $result = mysql_query("SELECT * FROM users WHERE email = '$username' AND password = '$password'") or die(mysql_error());
  10.  
  11. if (mysql_num_rows($result) == 0) {
  12. //user not found!
  13. header('Location: /index.php');
  14. exit();
  15. }
  16. else {
  17. // Valid user
  18. $_SESSION['username'] = $username;
  19. header('Location: /login.php');
  20. }
  21.  
  22. mysql_close($con);
  23.  
  24. ?>
Add Comment
Please, Sign In to add comment