Advertisement
Guest User

Untitled

a guest
Oct 11th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['login']))
  3. {
  4. @$username=$_POST['username'];
  5. @$password=$_POST['password'];
  6. $query = "SELECT * from users where username='$username' and password='$password' ";
  7. //echo $query;
  8. $query_run = mysqli_query($con,$query);
  9. //echo mysql_num_rows($query_run);
  10. if($query_run)
  11. {
  12. if(mysqli_num_rows($query_run)>0)
  13. {
  14. $row = mysqli_fetch_array($query_run,MYSQLI_ASSOC);
  15.  
  16. $_SESSION['username'] = $username;
  17. $_SESSION['password'] = $password;
  18. $_SESSION['userid'] = $userid;
  19.  
  20. header( "Location: profile.php");
  21. }
  22. else
  23. {
  24. echo '<script type="text/javascript">alert("No such User exists or username and password do not match. Invalid Credentials")</script>';
  25. }
  26. }
  27. else
  28. {
  29. echo '<script type="text/javascript">alert("Database Error")</script>';
  30. }
  31. }
  32. else
  33. {
  34. }
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement