Location: PHPKode > projects > MercuryBoard > MercuryBoard/index.php
<?php

//////////////////////////////////////////////
// MercuryBoard v1 Beta
//
// Copyright 2001 Jason Warner and Mark Elliot
// http://www.mercuryboard.com
//
// No part of MercuryBoard may be used without
// permission from the authors.
//////////////////////////////////////////////

$version  = "v1 Beta 2.0";

$mtime     = split(" ", microtime());
$starttime = $mtime[1] + $mtime[0];

if(!isset($debug)){
  set_error_handler("error");
}else{
  error_reporting(0);
}

ob_start("ob_gzhandler");

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

if(!isset($a) || !file_exists("./func/$a.php")){
  $a = "board";
}

require "./settings.php";        //DB Settings
require "./databases/mysql.php"; //MySQL Functions
require "./global.php";          //Class MercuryBoard
require "./func/$a.php";         //Module

$connection = connect_db($db_host, $db_user, $db_pass, $db_name)
              or error("A connection to the database could not be established.");

$mercury = new Module;
if(!$mercury->temps){
  error("The html templates could not be retrieved from the database.");
}
extract($mercury->getSettings());

$mercury->table  = eval(template('Table'));
$mercury->etable = eval(template('ETable'));

$load = $mercury->getServerLoad();
if($max_load && ($load != 'Unknown') && ($load > $max_load)){
  error("We're sorry, but $forum_name is currently unavailable, due to a massive amount of connected users.");
}

$mercury->user = $mercury->getUser();
$tree          = $mercury->makeTree($a);

if(!$mercury->user['AdminCP']){
  $admin_replace = "";
}else{
  $admin_replace = "\\1";
}

if($mercury->user){
  query("UPDATE active SET Action='$a', Time='$mercury->time', UserAgent='$mercury->agent', IP='$mercury->ip' WHERE ID='{$mercury->user['UID']}'");
  if(aff_rows() == 0){
    query("INSERT INTO active (ID, Name, Action, Time, Member, IP, UserAgent) VALUES ('{$mercury->user['UID']}', '{$mercury->user['Name']}', '$a', '$mercury->time', '1', '$mercury->ip', '$mercury->agent')");
  }
  $NewMessages = $mercury->numOfPMS();
  $NewMessages ? $MessageLink = "<b>messenger ($NewMessages new)</b>" : $MessageLink = "messenger";
  $userheader  = eval(template('welcome_in'));

}else{
  query("UPDATE active SET Action='$a', Time='$mercury->time' WHERE IP='$mercury->ip' AND Member='0' AND UserAgent='$mercury->agent'");
  if(aff_rows() == 0){
    $newip = str_replace(".", "", $mercury->ip);
    query("INSERT INTO active (ID, Name, Action, Time, Member, IP, UserAgent) VALUES ('$newip', 'Guest', '$a', '$mercury->time', '0', '$mercury->ip', '$mercury->agent')");
  }
  $userheader  = eval(template('welcome_out'));
}

//Part of an evil scheme to kill $mercury->output
//$mercuryboard = $mercury->execute();

$mercury->execute();

if($a != 'board'){
  $title = $mercury->title;
}else{
  $title = $forum_name;
}

if($a != 'ssi'){
  $mercuryboard = $mercury->output . eval(template('Copyright'));
  $mtime        = split(" ", microtime());
  $totaltime    = round(($mtime[1] + $mtime[0]) - $starttime, 4);
  echo eval(template('Main'));
}else{
  echo $mercury->output;
}

if(isset($debug)){
  $mercury->doDebug();
}
?>
Return current item: MercuryBoard