Rev 42 | Rev 45 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
<?php
$VERSION='2.0a';
$BUILD_DATE='20181118';
$DB_REQUIRED_VERSION = '0.1';
$configuration = array();
$error = '';
// locate the config file
$error = "Site is broken. No configuration file found. Tell the developers.";
foreach ( array( '/../camp2_config.php', '/../private/camp2_config.php', 'config.php' ) as $search ) {
if ( file_exists( realpath( $_SERVER['DOCUMENT_ROOT'] . $search ) ) ) {
$config = realpath( $_SERVER['DOCUMENT_ROOT'] . $search );
include_once( $config );
//print "<pre>loading from $config\n</pre>";
$error = '';
break;
} // if
} // for
//print_r( ini_get('include_path') ); die;
include_once( 'DBQuery.class.php' );
// make the database connection
$dbVersion = '';
$dbConnection = new DBQuery( DBSERVER, DBUSER, DBPASS, DBNAME );
if ( $dbConnection->connect_errno ) {
$error = "Failed to connect to MySQL: (" . $dbConnection->connect_errno . ") " . $dbConnection->connect_error;
} else {
$dbVersion = $dbConnection->getOneDBValue( "select key_value from _system where group_name = 'database' and key_name = 'version'" );
}
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . realpath( dirname ( __FILE__ ) ) . '/include' );
include_once( 'functions.php' );
/* get the information about who is logged in, and what they are allowed to access */
// get current user
$currentUser = 'rodolico';
// get permissions for the current user
$auth['client'] = array();
$auth['site'] = array();
$auth['device'] = array();
$auth['menu'] = array();
//Setup our HTML header here.
if(!isset($page_title)) { $page_title = "Untitled"; }
?>
<html>
<head>
<title><?php echo $page_title;?></title>
<script language="javascript">
function eToggle(anctag,darg) {
var ele = document.getElementById(darg);
var text = document.getElementById(anctag);
if(ele.style.display == "block") {
ele.style.display = "none";
text.innerHTML = "Show " + darg;
} else {
ele.style.display = "block";
text.innerHTML = "Hide " + darg;
}
}
</script>
<link type="text/css" rel="stylesheet" href="style.css">
<link rel="stylesheet" type="text/css" href="camp.css">
</head>
<body>
<div id="titleimage">
<h1>
Computer Asset Management Program
</h1>
<h2>
Version <?php print "$VERSION, $BUILD_DATE"; ?>
</h2>
</div>
<?php
if ( $error ) {
print "<h1>Serious Error encountered</h1><p>$error</p>";
die($error);
}
if ( $dbVersion != $DB_REQUIRED_VERSION ) {
print "<h1><b>Warning</b>: Database is version $dbVersion, but requires version $DB_REQUIRED_VERSION. Repair immediately</h1>";
die;
}
?>
<div class='login'>
<?php
/*
if(!$user) {
show_login_form();
} else {
echo "Hello {$user->name}.<br />";
show_logout_button();
show_help_button();
}
*/
?>
</div>
<?php include_once('menu.php'); ?>
<div id="content">