Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $db_hostname = 'localhost';
- $db_username = 'root';
- $db_password = 'raspberry';
- $db_database = 'e_sports';
- $con = mysql_connect($db_hostname,$db_username,$db_password);
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db($db_database, $con);
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <title>"jocks gents"</title>
- </head>
- <body>
- <p>to find a user's information please enter their username</p>
- <form action="" method="post">
- Search: <input type="text" name="term" /><br />
- <input type="submit" value="Submit" />
- </form>
- <?php
- if (!empty($_REQUEST['term'])) {
- $term = mysql_real_escape_string($_REQUEST['term']);
- $sql = sprintf("SELECT * FROM player WHERE player.username = '%s'",$term);
- $r_query = mysql_query($sql);
- if (!$r_query) {
- $message = 'Invalid query: ' . mysql_error() . "\n";
- $message .= 'Whole query: ' . $sql;
- die($message);
- }
- if (mysql_num_rows($r_query)==0) {
- echo 'please enter a correct username';
- }
- while ($row = mysql_fetch_array($r_query)){
- echo '<br /> real name: ' .$row['realname'];
- echo '<br /> password: '.$row['pword'];
- echo '<br /> email: '.$row['email'];
- echo '<br /> message: '.$row['message'];
- echo '<br /> terms and conditions: '.$row['t_and_c'];
- }
- }
- ?>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement