docker-vulnerable-dvwa/dvwa/vulnerabilities/sqli_blind/source/medium.php

27 lines
912 B
PHP
Raw Normal View History

2016-12-02 19:19:11 +00:00
<?php
if( isset( $_POST[ 'Submit' ] ) ) {
// Get input
$id = $_POST[ 'id' ];
2018-10-12 15:49:58 +00:00
$id = ((isset($GLOBALS["___mysqli_ston"]) && is_object($GLOBALS["___mysqli_ston"])) ? mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $id ) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : ""));
2016-12-02 19:19:11 +00:00
// Check database
$getid = "SELECT first_name, last_name FROM users WHERE user_id = $id;";
2018-10-12 15:49:58 +00:00
$result = mysqli_query($GLOBALS["___mysqli_ston"], $getid ); // Removed 'or die' to suppress mysql errors
2016-12-02 19:19:11 +00:00
// Get results
2018-10-12 15:49:58 +00:00
$num = @mysqli_num_rows( $result ); // The '@' character suppresses errors
2016-12-02 19:19:11 +00:00
if( $num > 0 ) {
// Feedback for end user
$html .= '<pre>User ID exists in the database.</pre>';
}
else {
// Feedback for end user
$html .= '<pre>User ID is MISSING from the database.</pre>';
}
//mysql_close();
}
?>