Skip to content

Commit

Permalink
search for dbcredentials at least three levels up
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRDOrazio authored Nov 22, 2020
1 parent 59238c8 commit 160694d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,15 @@ function dbConnect()
global $bbquery;
global $returntype;

include 'dbcredentials.php';
$dbCredentials = "dbcredentials.php";
//search for the database credentials file at least three levels up...
if(file_exists($dbCredentials)){
include $dbCredentials;
} else if (file_exists("../" . $dbCredentials)){
include "../{$dbCredentials}";
} else if (file_exists("../../" . $dbCredentials)){
include "../../{$dbCredentials}";
}

$mysqli = new mysqli(SERVER, DBUSER, DBPASS, DATABASE);

Expand Down

0 comments on commit 160694d

Please sign in to comment.