<?php
#=======================================
# Site config variables initializations
#
# updated: 25 October 2006
#
#=======================================
$dbh=db_connect(array($host,$user,$password));
$dbs=db_select_db(array($db_main));
#
$sth=db_query("SELECT * FROM site_settings WHERE site='$skin'");
if($skin=='') { $skin=$_SESSION[misc][skin]; $sth=db_query("SELECT * FROM site_settings WHERE site='$skin'"); }
if($sth[1]==0 && $_GET[skid]=='')
{
# NO entries in the db for the required skin when called from an external link
#
echo 'Do not know what skin to load!'; die;
header('Location: http://phpcamaleo.org/'); die;
}
$rows=db_fetch($sth[0],false);
#
for($i=0;$i<$sth[1];$i++) { $_SESSION[misc][$rows[$i][code]]=$rows[$i][value]; }
$_SESSION[misc][SITECODE]=$rows[0][site];
$_SESSION[misc][skin]=$skin;
#=================================
# Set the site root path variable
#=================================
unset($_SESSION[common]);
#
if(!isset($_SERVER[DOCUMENT_ROOT]) || $_SERVER[DOCUMENT_ROOT]=='')
{
# Apache
#
echo 'Missing DOCUMENT_ROOT!'; die;
}
/*
out of service
==============
if($_SERVER[DOCUMENT_ROOT]=='' && $_SERVER[PATH_TRANSLATED]!='')
{
# IIS
#
# this code need to be verified on a IIS server!
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
$tmp_path=pathinfo($_SERVER[PATH_TRANSLATED]); #--> C:\\Inetpub\\www\\SITE_FOLDER\\page.php
$tmp=eregi_replace('\\\\', '/',$tmp_path[dirname]);
$tmp=eregi_replace('//', '/',$tmp);
$tmp_path=explode('/',$tmp);
$t=count($tmp_path);
$temp_root='';
for($i=0;$i<$t;$i++)
{
$temp_root.=$tmp_path[$i].'/';
if($i==0) { $temp_root.='/'; } #--> C:/
}
$_SERVER[DOCUMENT_ROOT].'/'=$temp_root;
}
*/
#=================================
# Browser
#=================================
if(stristr($_SERVER[HTTP_USER_AGENT],'Firefox')){ $_SESSION[browser]='FF'; }
if(stristr($_SERVER[HTTP_USER_AGENT],'MSIE')) { $_SESSION[browser]='IE'; }
?>