Last active
April 6, 2018 07:35
-
-
Save sapran/c45ca51df93a8b4eae87f8a378036346 to your computer and use it in GitHub Desktop.
Code fragment from @ethicalhack3r's DVWA: github.com/ethicalhack3r/DVWA
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 | |
if( isset( $_GET[ 'Change' ] ) ) { | |
// Get input | |
$pass_new = $_GET[ 'password_new' ]; | |
$pass_conf = $_GET[ 'password_conf' ]; | |
// Do the passwords match? | |
if( $pass_new == $pass_conf ) { | |
// They do! | |
$pass_new = ((isset($GLOBALS["___mysqli_ston"]) && is_object($GLOBALS["___mysqli_ston"])) ? mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $pass_new ) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : "")); | |
$pass_new = md5( $pass_new ); | |
// Update the database | |
$insert = "UPDATE `users` SET password = '$pass_new' WHERE user = '" . dvwaCurrentUser() . "';"; | |
$result = mysqli_query($GLOBALS["___mysqli_ston"], $insert ) or die( '<pre>' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)) . '</pre>' ); | |
// Feedback for the user | |
$html .= "<pre>Password Changed.</pre>"; | |
} | |
else { | |
// Issue with passwords matching | |
$html .= "<pre>Passwords did not match.</pre>"; | |
} | |
((is_null($___mysqli_res = mysqli_close($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment