Advertisement
Guest User

Untitled

a guest
Jul 16th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. if(isset($_SESSION['sig']))
  5. {
  6. #User is already logged in
  7. echo("<script>window.location='home.php'</script>");
  8. }
  9.  
  10. if(isset($_REQUEST['submit'])
  11. {
  12. #Perform login action
  13. $username=$_REQUEST['UserUsername'];
  14. $password=$_REQUEST['UserPassword'];
  15.  
  16. include ('db_login.php');
  17. $query=mysql_query("SELECT * FROM Users WHERE UserUsername='".$username."' AND UserPassword='".$password."'");
  18. $row=mysql_fetch_arr($query);
  19. if(empty($row))
  20. {
  21. #False Info / User doesn't exist
  22. echo('<script>alert("False login credentials!");</script'));
  23. }
  24. else
  25. {
  26. #User exists and login is successful
  27. $_SESSION['sig']="OK";
  28. }
  29.  
  30. }
  31.  
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement