Read database connection from config file
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
<?php
|
||||
require_once 'vendor/autoload.php';
|
||||
$cfg = include('accred_config.php');
|
||||
session_start();
|
||||
$mode = $_POST['mode'];
|
||||
|
||||
openlog('ACCRED', LOG_PID, LOG_LOCAL0);
|
||||
if($mode=='logout') {
|
||||
$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;
|
||||
}
|
||||
@@ -42,7 +45,7 @@ if ($payload) {
|
||||
// Is this user admin
|
||||
$_SESSION['admin'] = '';
|
||||
// Set to 1 to allow normal users to add new entries en edit existing
|
||||
// $_SESSION['allowedit'] = 1;
|
||||
$_SESSION['allowedit'] = 1;
|
||||
if( array_key_exists($userid, $admins)) {
|
||||
$_SESSION['admin'] = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user