<?php

#the .htfolder.inc.php file for the valID/officer folder.
set_include_path(get_include_path() . PATH_SEPARATOR . "/usr/share/pear");

$script=$_SERVER["SCRIPT_FILENAME"];
$self=$_SERVER["PHP_SELF"];
$file=substr(strrchr($script,"/"),1);
$directory=substr($script,0,strlen($script)-strlen($file)-1);
$logdirectory=$directory;
$logfilename="valID.log";
$common_folder="../";
include_once($common_folder.".htloggywoggy.php");
loggywoggy($_SERVER["REQUEST_URI"]." from ".$_SERVER["REMOTE_ADDR"]);
if ($_SERVER["REQUEST_METHOD"] == "POST") buggywuggy(print_r($_POST,TRUE));
#Eliminated setup.inc and moved the following statements here to replace the include statement.

require_once("DB.php");

		$dsn["phptype"]="pgsql"; 
		$dsn["username"]="validofficer"; 
		$dsn["password"]="Foundations are the Identity of Obscurity"; 
		#$dsn["hostspec"]="localhost"; 
		$dsn["database"]="valid"; 
		#$dsn["port"]="5432"; 
include_once ($common_folder.".htsite.inc.php");

include_once ("$allsites/.htfunctions.inc.php");
include_once($common_folder.".htauthentify.inc.php");
define('OSNAMES',"fr-FreeBSD,li-Linux,ma-Macintosh,wi-Windows");

define('BROWSERS',"ff-FireFox,ie-Internet Explorer,ko-Konqueror,mo-Mozilla,op-Opera,sf=Safari");

define('OURNAME',"ValID");

define('OURDOMAIN',"authentrus.com");
define ('MAXCOLUMNS',33);		#Ridiculously high number of columns for a table, to be more than the number of menues.

function page_bottom($menues="")
{
	echo "\n\n<HR>\n</TD></TR>";			#Closes the line opened in page_top.
	if(strlen($menues) == 0) {global $menubar;$menu=$menubar;}
	else $menu=$menues;
	if (strlen($menues) >0) echo "\n<TR>$menues</TR>";
	echo "\n<TR><TD colspan=".MAXCOLUMNS." align=center>&copy;".thisyear(2007)." The Village Group</TD></TR>";
	echo "\n</TABLE>";
	echo "\n</BODY></HTML>";
}
function page_top($title="",$metas="",$menues="")
{
	echo "<HTML><HEAD><TITLE>$title</TITLE>\n$metas\n</HEAD>";
	echo "<BODY>";
	echo "\n<TABLE>";
	if(strlen($menues) == 0) {global $menubar;$menu=$menubar;}
	else $menu=$menues;
	if (strlen($menu) >0) echo "\n<TR>$menu</TR>";
	echo "\n<TR><TD colspan=".MAXCOLUMNS.">\n<HR>\n";	#Opens a line closed in page_bottom.
	register_shutdown_function("page_bottom",$menues);
}
#user_agent parses the user agent string to determine what operating system and browser are in use.
if (!function_exists('user_agent'))
{
function user_agent()
{
	$agent=" ".$_SERVER["HTTP_USER_AGENT"];
	if (strpos($agent,"Konqueror") > 0) {$browser="Konqueror";$br="ko";}
	else if (strpos($agent,"MSIE") > 0) {$browser="InternetExplorer";$br="ie";}
	else if (strpos($agent,"Firefox") > 0) {$browser="Firefox";$br="ff";}
	else if (strpos($agent,"Mozilla") > 0) {$browser="Mozilla";$br="mo";}
	else if (strpos($agent,"Safari") > 0) {$browser="Safari";$br="sf";}
	else
	{
		PKH_log("Could not figure out browser from $agent.");
		$browser="dn";
	}

	if (strpos($agent,"Linux") > 0) $os="li";
	else if (strpos($agent,"FreeBSD") > 0) {$opsys="Free BSD";$os="fr";}
	else if (strpos($agent,"Windows") > 0) {$opsys="Windows";$os="wi";}
	else if (strpos($agent,"Macintosh") > 0) {$opsys="Macintosh";$os="ma";}
	else
	{
		PKH_log("Could not find operating system from $agent.");
		$os="ig";
	}

	return array($os,$br,$opsys,$browser);
}
}
function addMessage($msg)
{
	return "\n<BR>$msg";
}
function addError($error)
{
	return "\n<BR>$error";
}
function addMenu($link,$text="Click Here")
{
	global $menubar;
	$a="\n<TD><A href=\"$link\">$text</A></TD>";
	$menubar.=$a;
	return $a;
}
$menubar="";
$msgs="";
$errors="";
if ($live > 0) $errors.=addError("This is still in test mode. skipcall=$skipcall, testcall=$testcall.");
?>