webmum/include/php/default.inc.php
ohartl 4b59b1d3c8 Add dbError and redirect method to clean up
Fix some problems with missing id's by redirecting to overviews
2016-02-17 00:39:43 +01:00

35 lines
718 B
PHP

<?php
// Include config
if(file_exists('config/config_override.inc.php')){
require_once 'config/config_override.inc.php';
}
else{
require_once 'config/config.inc.php';
}
/**
* @param string $errorMessage
*/
function dbError($errorMessage){
die('There was an error running the query ['.$errorMessage.']');
}
// Establish database connection
$db = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE);
if($db->connect_errno > 0){
die('Unable to connect to database [' . $db->connect_error . ']');
}
/* Import classes */
require_once 'include/php/classes/user.class.php';
$user = new USER();
require_once 'include/php/global.inc.php';
require_once 'include/php/checkpermissions.inc.php';
?>