Advertisement
Guest User

Untitled

a guest
Sep 29th, 2017
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.07 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. // Get data from form
  5. $username = $_POST['username'];
  6. $password = $_POST['password'];
  7.  
  8. // Include the file which contains the database setup and configuration
  9. include("base.php");
  10.  
  11.  
  12. // Look in database to see if there are any account with the chosen username and password
  13. $sql_uname_check = "SELECT * FROM people WHERE username='$username' AND password='$password';";
  14. // So this says have a look and see if there is an account in the people table with the selected username AND password
  15.  
  16. // Run the query and put the results in a variable
  17. $result_name_check = mysql_query($sql_uname_check);
  18.  
  19. // Count how many users were returned
  20. $peepsfound = mysql_num_rows($result_name_check);
  21.  
  22.  
  23. // there were 0 users found ( < 1)
  24. if ($peepsfound < 1) {
  25.  
  26.     // Error not found
  27.     $error = "User $uname not found.";
  28.  
  29. //If there was a user found
  30. } else {
  31.        
  32.         //Add their details to the session for use later
  33.         $_SESSION['unamename'] = $uname;
  34.         $_SESSION['encryptcode'] = $code;
  35.        
  36.     }
  37. }
  38.  
  39. /* End of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement