Guest User

Untitled

a guest
Jan 17th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <?php
  2.  
  3. // Inialize session
  4. session_start();
  5.  
  6. // Include database connection settings
  7. include('config.inc');
  8.  
  9. $usr = mysql_real_escape_string($_POST['****ID']);
  10.  
  11. // Retrieve email address and message from database according to user's input
  12. $query = "SELECT * FROM users WHERE username = '$usr'";
  13.  
  14. $result = mysql_query($query) or die(mysql_error());
  15.  
  16. // Put the id numbers in array $row
  17.  
  18. $row = mysql_fetch_array($result) or die(mysql_error());
  19.  
  20. // Test for ID match
  21.  
  22. if (mysql_num_rows($result) == 1)
  23. {
  24. echo 'The email address of ';
  25. echo $usr;
  26. echo ' is: ';
  27. echo $row['email'];
  28. echo '<p>Message: ';
  29. echo $row['firstname'];
  30. }
  31. else
  32. {
  33. echo 'Sorry it appears that ';
  34. echo '$usr';
  35. echo ' has not registered yet. Why dont you tell him about ****Jacker?';
  36. }
  37. // Executing outside if..else blocks for testing
  38. echo 'Sorry, it appears that ';
  39. echo '$usr';
  40. echo ' has not registered yet. Why dont you tell him about ****Jacker?';
  41.  
  42. ?>
  43.  
  44. $row = mysql_fetch_array($result) or die(mysql_error());
Add Comment
Please, Sign In to add comment