Skip to content

Instantly share code, notes, and snippets.

@arbaouimehdi
Created October 9, 2018 15:04
Show Gist options
  • Save arbaouimehdi/00e39d68653dc7975893aa71342167ff to your computer and use it in GitHub Desktop.
Save arbaouimehdi/00e39d68653dc7975893aa71342167ff to your computer and use it in GitHub Desktop.
Blind SQL Injection - Inference Technique
<?php
$user = 'root';
$password = 'root';
$db = 'SQL-Injection';
$host = 'localhost';
$port = 3306;
$link = mysql_connect(
"$host:$port",
$user,
$password
);
$db_selected = mysql_select_db(
$db,
$link
);
// dynamically build the sql statement with the input
$query = "SELECT COUNT(user_id) FROM cars WHERE car_name = '$_GET[car_name]'";
// execute the query against the database
$result = mysql_fetch_row(mysql_query($query));
if ($result[0]) {
print_r($result[0] . ' cars');
} else {
print_r('Nothing to show');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment