Read database connection from config file
This commit is contained in:
@@ -5,12 +5,19 @@
|
||||
error_reporting(E_ALL & ~E_NOTICE );
|
||||
// Returns data to display list of entries to authenticated user
|
||||
$uid = $_SESSION['uid'];
|
||||
if(!$uid) {
|
||||
// if(!$uid) {
|
||||
// die("User not authenticated!");
|
||||
// }
|
||||
try {
|
||||
$cfg = include($_SERVER['DOCUMENT_ROOT'].'/accred_config.php');
|
||||
}
|
||||
catch(Exception $e) {
|
||||
die("Unable to load configuration file!");
|
||||
}
|
||||
$aid = $_GET['aid'];
|
||||
$isAdmin = $_SESSION['admin']==1;
|
||||
$mysqli = new mysqli("localhost", "caribanaaccred", "welcome99", "caribanaaccred");
|
||||
|
||||
$mysqli = new mysqli($cfg['host'], $cfg['user'],$cfg['pass'], $cfg['name']);
|
||||
if ($mysqli->connect_errno) {
|
||||
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user