Advertisement
Guest User

c

a guest
Apr 15th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <?php
  2. include("../includes/config.php");
  3. session_start();
  4.  
  5. if(isset($_POST['go'])){
  6.  
  7. $username = $_POST['username'];
  8. $password = $_POST['password'];
  9.  
  10. if(empty($username) || empty($password)){
  11. echo "<center><b>Please Enter Both Fields!</b></center>";
  12. die();
  13. }
  14.  
  15.  
  16. $login_info = "SELECT * from users WHERE username = '$username'";
  17. $run_login_info = mysql_query($login_info);
  18. $numrow = mysql_num_rows($run_login_info);
  19.  
  20. if ($numrow !== 0) {
  21.  
  22.  
  23.  
  24. while ($row = mysql_fetch_assoc($run_login_info)) {
  25. $dbusername = $row['username'];
  26. $dbpassword = $row['password'];
  27. }
  28.  
  29. // check username and password
  30. if ($username==$dbusername && $password == $dbpassword) {
  31. $_SESSION['username'] == $username;
  32. $_SESSION['password'] == $password;
  33.  
  34. }
  35. else{
  36. die("<b><center>Incorrect Username Or Password!</center></b>");
  37. }
  38.  
  39.  
  40. }
  41. else{
  42. die("<center><b>Invalid Username Or Password!</b></center>");
  43. }
  44.  
  45.  
  46. }
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement