Skip to content

Commit

Permalink
hardcoded the mysql error function
Browse files Browse the repository at this point in the history
  • Loading branch information
digininja committed Aug 20, 2023
1 parent 4d1cbf2 commit 16a21a8
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions dvwa/includes/dvwaPage.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,24 +484,14 @@ function dvwaButtonSourceHtmlGet( $pId ) {

if( $DBMS == 'MySQL' ) {
$DBMS = htmlspecialchars(strip_tags( $DBMS ));
$DBMS_errorFunc = 'mysqli_error()';
}
elseif( $DBMS == 'PGSQL' ) {
$DBMS = htmlspecialchars(strip_tags( $DBMS ));
$DBMS_errorFunc = 'pg_last_error()';
}
else {
$DBMS = "No DBMS selected.";
$DBMS_errorFunc = '';
}

//$DBMS_connError = '
// <div align="center">
// <img src="' . DVWA_WEB_PAGE_TO_ROOT . 'dvwa/images/logo.png" />
// <pre>Unable to connect to the database.<br />' . $DBMS_errorFunc . '<br /><br /></pre>
// Click <a href="' . DVWA_WEB_PAGE_TO_ROOT . 'setup.php">here</a> to setup the database.
// </div>';

function dvwaDatabaseConnect() {
global $_DVWA;
global $DBMS;
Expand All @@ -514,7 +504,7 @@ function dvwaDatabaseConnect() {
|| !@((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $_DVWA[ 'db_database' ])) ) {
//die( $DBMS_connError );
dvwaLogout();
dvwaMessagePush( 'Unable to connect to the database.<br />' . $DBMS_errorFunc );
dvwaMessagePush( 'Unable to connect to the database.<br />' . mysqli_error($GLOBALS["___mysqli_ston"]));
dvwaRedirect( DVWA_WEB_PAGE_TO_ROOT . 'setup.php' );
}
// MySQL PDO Prepared Statements (for impossible levels)
Expand Down

0 comments on commit 16a21a8

Please sign in to comment.