Advertisement
Guest User

Untitled

a guest
Apr 20th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.34 KB | None | 0 0
  1. <?php
  2. $db_hostname = 'localhost';
  3. $db_username = 'root';
  4. $db_password = 'raspberry';
  5. $db_database = 'e_sports';
  6.  
  7.  
  8. $con = mysql_connect($db_hostname,$db_username,$db_password);
  9.  
  10. if (!$con)
  11.  {
  12.  die('Could not connect: ' . mysql_error());
  13.  }
  14.  
  15. mysql_select_db($db_database, $con);
  16. ?>
  17.  
  18. <!DOCTYPE html>
  19. <html lang="en">
  20.     <head>
  21.         <meta charset="utf-8" />
  22.         <title>"jocks gents"</title>
  23.     </head>
  24.     <body>
  25. <p>to find a user's information please enter their username</p>
  26. <form action="" method="post">
  27. Search: <input type="text" name="term" /><br />
  28. <input type="submit" value="Submit" />
  29. </form>
  30. <?php
  31. if (!empty($_REQUEST['term'])) {
  32.  
  33. $term = mysql_real_escape_string($_REQUEST['term']);
  34.  
  35.  
  36. $sql = sprintf("SELECT * FROM player WHERE player.username =  '%s'",$term);
  37. $r_query = mysql_query($sql);
  38.  
  39. if (!$r_query) {
  40.    $message  = 'Invalid query: ' . mysql_error() . "\n";
  41.    $message .= 'Whole query: ' . $sql;
  42.    die($message);
  43. }
  44.  
  45. if (mysql_num_rows($r_query)==0) {
  46. echo 'please enter a correct username';
  47. }
  48.  
  49. while ($row = mysql_fetch_array($r_query)){
  50.  
  51. echo '<br /> real name: ' .$row['realname'];
  52. echo '<br /> password: '.$row['pword'];
  53. echo '<br /> email: '.$row['email'];
  54. echo '<br /> message: '.$row['message'];
  55. echo '<br /> terms and conditions: '.$row['t_and_c'];
  56. }
  57.  
  58. }
  59. ?>
  60.     </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement