Created
October 9, 2018 15:04
-
-
Save arbaouimehdi/00e39d68653dc7975893aa71342167ff to your computer and use it in GitHub Desktop.
Blind SQL Injection - Inference Technique
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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