Hi,
Could someone please tell me what is wrong with this code because i have tried loading it but it's not giving me any error to know where the problem lies.
<?php
/**
*
* Global configuration file for CAPAT
*/
// Site Setup
error_reporting(0);
session_start();
// Turn off warning about possible session & globals compatibility problem
ini_set('session.bug_compat_warn', 0);
/*
* Configuration
*/
//Application information
define('APP__NAME', 'CAPAT OS');
define('APP__TITLE', 'CAPAT OS : Online Peer Assessment System');
define('APP__WWW', 'http://localhost/capat');
define('APP__ID', 'capat');
define('APP__VERSION', '1.0.0.0');
define('APP__DESCRIPTION','CAPAT, an online peer assessment system.');
define('APP__KEYWORDS','peer assessment, online, peer, assessment, tools');
define('APP__MD5_SALT', 'PF46ALC9Z1');
//Database information
define('APP__DB_TYPE', 'MySQLDAO');
define('APP__DB_HOST', 'localhost:3306');
// If on a non-standard port, use this format: <server>:<port>
define('APP__DB_USERNAME', 'root');
define('APP__DB_PASSWORD', 'justified');
define('APP__DB_DATABASE', 'pa');
define('APP__DB_PERSISTENT', false);
define('APP__DB_CLIENT_FLAGS', 2);
// Contact info
define('APP__EMAIL_INFO', 'dami2cuteforever@yahoo.com');
define('APP__EMAIL_HELP', 'dami2cuteforever@yahoo.com');
define('APP__EMAIL_TECH', 'dami2cuteforever@yahoo.com');
// Includes
define ('DOC__ROOT', 'c:/xampp/htdocs/capat');
require_once(DOC__ROOT.'/library/functions/lib_common.php');
require_once(DOC__ROOT.'/library/classes/class_dao.php');
require_once(DOC__ROOT.'/library/classes/class_user.php');
require_once(DOC__ROOT.'/library/classes/class_cookie.php');
require_once(DOC__ROOT.'/library/classes/class_engcis.php');
require_once(DOC__ROOT.'/include/classes/class_ui2.php');
//define the authentication to be used
define('AUTH__CLASS', 'DBAuthentication');
//LDAP Authentication is 'LDAPAuthenticator' and database authentication is 'DBAuthentication'
// Old config compatibility
$_config['app_id'] = APP__ID;
$_config['app_www'] = APP__WWW;
// Initialisation
// Magic quotes workaround
set_magic_quotes_runtime(0);
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value) {
return is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
}
//NW added in request as well
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
$_GET = array_map('stripslashes_deep', $_GET);
$_POST = array_map('stripslashes_deep', $_POST);
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
// Initialise DB object
$DB = new DAO( APP__DB_HOST, APP__DB_USERNAME, APP__DB_PASSWORD, APP__DB_DATABASE);
$DB->set_debug(true);
// Initialise The EngCIS Handler object
$CIS = new EngCIS();
// Initialise User Object
$_user = null;
// Initialise the cookie
$_cookie = new Cookie();
// Get info from the session
$_user_id = fetch_SESSION('_user_id', null);
// If there's no user in the session, but there is in the cookie, use that
if ( (!$_user_id) && ($_cookie->validate()) && (array_key_exists('user_id',$_cookie->vars)) ) {
$_user_id = $_cookie->vars['user_id'];
}
// If we found a user to load, load 'em!
if ($_user_id){
$_user_info = $CIS->get_user($_user_id);
// Actually create the user object
$_user = new User();
$_user->load_from_row($_user_info);
$_user_info = null;
// We're done with the data, so clear it
// save session data
$_SESSION['_user_id'] = $_user->id;
// Save cookie data
$_cookie->vars['user_id'] = $_user->id;
$_cookie->save();
}
// Initialise UI Object
$UI = new UI($_user);
// Global Functions
/**
* Check if the user is logged in and is a user of the given type
* If not, it logs the user out
* @param string $_user
* @param string $user_type
*/
function check_user($_user, $user_type = null) {
// Is the user valid?
if ($_user) {
// if we're not checking the user type, or we are checking and it matches, return OK
if ( (!$user_type) || ($_user->type == $user_type) ) {
return true;
}
}else{
return false;
}
// If we didn't call 'return' then the user is denied access
// If they tried to access the main index page, assume they haven't logged in and go to the login page directly
if ($_SERVER['PHP_SELF']=='/index.php') {
header('Location: '. APP__WWW .'/login.php');
} else { // log them out and give the DENIED message
header('Location:'. APP__WWW .'/logout.php?msg=denied');
}
exit;
}
/**
* Function for the debug print out
* @param string $var
*/
function debug_print($var) {
echo('<pre>');
print_r($var);
echo('</pre>');
}
?>