Advertisement
Guest User

Untitled

a guest
Mar 10th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. $request = trim(strtolower($_REQUEST['email']));
  2. $valid = 'true';
  3.  
  4. //The classic, long way to do it:
  5. $dbServer = "localhost";
  6. $dbUser = "rocke691_bettLan";
  7. $dbPass = "ViVCTT59c371";
  8. $dbName = "rocke691_betterLandlord";
  9.  
  10. //Connect to the database
  11. $link = mysql_connect($dbServer, $dbUser, $dbPass);
  12. if (!$link) {
  13.     die('Could not connect: ' . mysql_error());
  14. }
  15. //Select the correct database and table
  16. mysql_select_db($dbName, $link);
  17.  
  18.  
  19. //Construct the query to search for the email
  20.       $sql  = "SELECT `email` FROM `users`";
  21.       $sql .= " WHERE `email` LIKE '{$request}'";
  22.      
  23.       $result = mysql_query($sql);
  24.       $count= count($result);
  25.        
  26. if(!empty($result)) {
  27.         $valid = '"That\'s already taken"';
  28.         echo $valid;       
  29. } else {
  30. echo $result;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement