Skip to content

Instantly share code, notes, and snippets.

@CloudyWater
Created January 29, 2017 20:28
Show Gist options
  • Save CloudyWater/80975b184df58246e8b4b7e5b0e5c349 to your computer and use it in GitHub Desktop.
Save CloudyWater/80975b184df58246e8b4b7e5b0e5c349 to your computer and use it in GitHub Desktop.
Our script to get user data
<?php
$db = mysql_connect('localhost', 'username', 'password') or die ('Could not connect: ' . mysql_error());
mysql_select_db('databasename') or die ('Could not select database');
$username = mysql_real_escape_string($_GET['username'], $db);
$query = "SELECT * FROM users WHERE username='$username';";
$result = mysql_query($query) or die ('Query failed: ' . mysql_error());
$row = mysql_fetch_assoc($result);
echo $row['password'];
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment