setTimezone($deftz);
$utctz = new DateTimeZone("UTC");
$utccurtime = new DateTime();
$utccurtime->setTimestamp($defcurtime->getTimestamp());
$utccurtime->setTimezone($utctz);
$servtz = new DateTimeZone($Settings['DefaultTimeZone']);
$servcurtime = new DateTime();
$servcurtime->setTimestamp($defcurtime->getTimestamp());
$servcurtime->setTimezone($servtz);
$usercurtime = new DateTime();
$usercurtime->setTimestamp($defcurtime->getTimestamp()); }
if(!isset($Settings['sqlhost'])) { $Settings['sqlhost'] = "localhost"; }
if($Settings['fixpathinfo']=="on") {
$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
putenv("PATH_INFO=".$_SERVER['ORIG_PATH_INFO']); }
// Check to see if variables are set
if(!isset($SettDir['inc'])) { $SettDir['inc'] = "inc/"; }
if(!isset($SettDir['archive'])) { $SettDir['archive'] = "archive/"; }
if(!isset($SettDir['misc'])) { $SettDir['misc'] = "inc/misc/"; }
if(!isset($SettDir['sql'])) { $SettDir['sql'] = "inc/misc/sql/"; }
if(!isset($SettDir['admin'])) { $SettDir['admin'] = "inc/admin/"; }
if(!isset($SettDir['sqldumper'])) { $SettDir['sqldumper'] = "inc/admin/sqldumper/"; }
if(!isset($SettDir['mod'])) { $SettDir['mod'] = "inc/mod/"; }
if(!isset($SettDir['mplayer'])) { $SettDir['mplayer'] = "inc/mplayer/"; }
if(!isset($SettDir['themes'])) { $SettDir['themes'] = "themes/"; }
if(!isset($SettDir['maindir'])||!file_exists($SettDir['maindir'])||!is_dir($SettDir['maindir'])) {
$SettDir['maindir'] = addslashes(str_replace("\\","/",dirname(__FILE__)."/")); }
if(isset($SettDir['maindir'])) { @chdir($SettDir['maindir']); }
if(!isset($Settings['use_iniset'])) { $Settings['use_iniset'] = null; }
if(!isset($Settings['clean_ob'])) { $Settings['clean_ob'] = "off"; }
if(!isset($_SERVER['PATH_INFO'])) { $_SERVER['PATH_INFO'] = null; }
if(!isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
$_SERVER['HTTP_ACCEPT_ENCODING'] = null; }
if(!isset($_SERVER["HTTP_ACCEPT"])) { $_SERVER["HTTP_ACCEPT"] = null; }
if(!isset($_SERVER['HTTP_REFERER'])) { $_SERVER['HTTP_REFERER'] = null; }
if(!isset($_GET['page'])) { $_GET['page'] = null; }
if(!isset($_GET['act'])) { $_GET['act'] = null; }
if(!isset($_POST['act'])) { $_POST['act'] = null; }
if(!isset($_GET['modact'])) { $_GET['modact'] = null; }
if(!isset($_POST['modact'])) { $_POST['modact'] = null; }
if(!isset($_GET['id'])) { $_GET['id'] = null; }
if(!isset($_GET['debug'])) { $_GET['debug'] = "off"; }
if(!isset($_GET['post'])) { $_GET['post'] = null; }
if(!isset($_POST['License'])) { $_POST['License'] = null; }
if(!isset($_SERVER['HTTPS'])) { $_SERVER['HTTPS'] = "off"; }
if(!isset($Settings['SQLThemes'])) { $Settings['SQLThemes'] = "off"; }
if($Settings['SQLThemes']!="on"&&$Settings['SQLThemes']!="off") {
$Settings['SQLThemes'] = "off"; }
require_once($SettDir['misc'].'utf8.php');
require_once($SettDir['inc'].'filename.php');
if(!isset($Settings['use_hashtype'])) {
$Settings['use_hashtype'] = "sha1"; }
if(!function_exists('hash')||!function_exists('hash_algos')) {
if($Settings['use_hashtype']!="md5"&&
$Settings['use_hashtype']!="sha1"&&
$Settings['use_hashtype']!="bcrypt") {
$Settings['use_hashtype'] = "sha1"; } }
if((function_exists('hash')&&function_exists('hash_algos'))||function_exists('password_hash')) {
if(!in_array($Settings['use_hashtype'],hash_algos())&&$Settings['use_hashtype']!="bcrypt") {
$Settings['use_hashtype'] = "sha1"; }
if($Settings['use_hashtype']!="md2"&&
$Settings['use_hashtype']!="md4"&&
$Settings['use_hashtype']!="md5"&&
$Settings['use_hashtype']!="sha1"&&
$Settings['use_hashtype']!="sha224"&&
$Settings['use_hashtype']!="sha256"&&
$Settings['use_hashtype']!="sha384"&&
$Settings['use_hashtype']!="sha512"&&
$Settings['use_hashtype']!="sha3224"&&
$Settings['use_hashtype']!="sha3256"&&
$Settings['use_hashtype']!="sha3384"&&
$Settings['use_hashtype']!="sha3512"&&
$Settings['use_hashtype']!="ripemd128"&&
$Settings['use_hashtype']!="ripemd160"&&
$Settings['use_hashtype']!="ripemd256"&&
$Settings['use_hashtype']!="ripemd320"&&
$Settings['use_hashtype']!="bcrypt") {
$Settings['use_hashtype'] = "sha1"; } }
// Check to see if variables are set
require_once($SettDir['misc'].'setcheck.php');
$dayconv = array("year" => 29030400, "month" => 2419200, "week" => 604800, "day" => 86400, "hour" => 3600, "minute" => 60, "second" => 1);
require_once($SettDir['inc'].'function.php');
$Settings['bid'] = base64_encode(urlencode($Settings['idburl'].url_maker($exfile['index'],$Settings['file_ext'],"act=versioninfo",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)));
$Settings['ubid'] = base64_encode(urlencode($Settings['idburl'].url_maker($exfile['index'],$Settings['file_ext'],"act=versioninfo",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)));
if($Settings['enable_pathinfo']=="on") {
mrstring(); /* Change Path info to Get Vars :P */ }
// Check to see if variables are set
$qstrhtml = htmlentities($Settings['qstr'], ENT_QUOTES, $Settings['charset']);
if($Settings['enable_https']=="on"&&$_SERVER['HTTPS']=="on") {
if($Settings['idburl']!=null&&$Settings['idburl']!="localhost") {
$HTTPsTest = parse_url($Settings['idburl']); if($HTTPsTest['scheme']=="http") {
$Settings['idburl'] = preg_replace("/http\:\/\//i", "https://", $Settings['idburl']); } } }
$cookieDomain = null; $cookieSecure = false;
if($Settings['idburl']!=null&&$Settings['idburl']!="localhost") {
$URLsTest = parse_url($Settings['idburl']);
$cookieDomain = $URLsTest['host'];
if($cookieDomain=="localhost") { $cookieDomain = false; }
if($Settings['enable_https']=="on") {
if($URLsTest['scheme']=="https") { $cookieSecure = true; }
if($URLsTest['scheme']!="https") { $cookieSecure = false; } } }
if(!in_array("ini_set", $disfunc)) {
@ini_set('default_charset', $Settings['charset']); }
$File1Name = dirname($_SERVER['SCRIPT_NAME'])."/";
$File2Name = $_SERVER['SCRIPT_NAME'];
$File3Name=str_replace($File1Name, null, $File2Name);
if ($File3Name=="sql.php"||$File3Name=="/sql.php") {
header('Location: index.php');
exit(); }
//error_reporting(E_ERROR);
// Check if gzip is on and if user's browser can accept gzip pages
if($_GET['act']=="MkCaptcha"||$_GET['act']=="Captcha") {
$Settings['use_gzip'] = 'off'; }
if($Settings['use_gzip']=="on") {
if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'], "gzip")) {
$GZipEncode['Type'] = "gzip"; } else {
if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'], "deflate")) {
$GZipEncode['Type'] = "deflate"; } else {
$Settings['use_gzip'] = "off"; $GZipEncode['Type'] = "none"; } } }
if($Settings['use_gzip']=="gzip") {
if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'], "gzip")) { $Settings['use_gzip'] = "on";
$GZipEncode['Type'] = "gzip"; } else { $Settings['use_gzip'] = "off"; } }
if($Settings['use_gzip']=="deflate") {
if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'], "deflate")) { $Settings['use_gzip'] = "on";
$GZipEncode['Type'] = "deflate"; } else { $Settings['use_gzip'] = "off"; } }
$iWrappers = array(null);
function idb_output_handler($buffer) { return $buffer; }
function idb_suboutput_handler($buffer) { return $buffer; }
if($Settings['clean_ob']=="on") {
/* Check for other output handlers/buffers are open
and close and get the contents in an array */
$numob = count(ob_list_handlers()); $iob = 0;
while ($iob < $numob) {
$old_ob_var[$iob] = ob_get_clean();
++$iob; } } ob_start("idb_output_handler");
if($Settings['use_gzip']=="on") {
if($GZipEncode['Type']!="gzip") { if($GZipEncode['Type']!="deflate") { $GZipEncode['Type'] = "gzip"; } }
if($GZipEncode['Type']=="gzip") {
header("Content-Encoding: gzip"); }
if($GZipEncode['Type']=="deflate") {
header("Content-Encoding: deflate"); } }
/* if(eregi("msie",$browser) && !eregi("opera",$browser)){
header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"'); } */
// Some http stuff
$SQLStat = sql_connect_db($Settings['sqlhost'],$Settings['sqluser'],$Settings['sqlpass'],$Settings['sqldb']);
if(isset($Settings['sql_collate'])&&!isset($Settings['sql_charset'])) {
if($Settings['sql_collate']=="ascii_bin"||
$Settings['sql_collate']=="ascii_generel_ci") {
$Settings['sql_charset'] = "ascii"; }
if($Settings['sql_collate']=="latin1_bin"||
$Settings['sql_collate']=="latin1_general_ci"||
$Settings['sql_collate']=="latin1_general_cs") {
$Settings['sql_charset'] = "latin1"; }
if($Settings['sql_collate']=="utf8_bin"||
$Settings['sql_collate']=="utf8_general_ci"||
$Settings['sql_collate']=="utf8_unicode_ci"||
$Settings['sql_collate']=="utf8mb4_bin"||
$Settings['sql_collate']=="utf8mb4_general_ci"||
$Settings['sql_collate']=="utf8mb4_unicode_ci") {
$Settings['sql_charset'] = "utf8"; } }
if(isset($Settings['sql_collate'])&&isset($Settings['sql_charset'])) {
if($Settings['sql_charset']=="ascii") {
if($Settings['sql_collate']!="ascii_bin"&&
$Settings['sql_collate']!="ascii_generel_ci") {
$Settings['sql_collate'] = "ascii_generel_ci"; } }
if($Settings['sql_charset']=="latin1") {
if($Settings['sql_collate']!="latin1_bin"&&
$Settings['sql_collate']!="latin1_general_ci"&&
$Settings['sql_collate']!="latin1_general_cs") {
$Settings['sql_collate'] = "latin1_general_ci"; } }
if($Settings['sql_charset']=="utf8" || $Settings['sql_charset']=="utf8mb4") {
if($Settings['sql_collate']!="utf8_bin"&&
$Settings['sql_collate']!="utf8_general_ci"&&
$Settings['sql_collate']!="utf8_unicode_ci"&&
$Settings['sql_collate']!="utf8mb4_bin"&&
$Settings['sql_collate']!="utf8mb4_general_ci"&&
$Settings['sql_collate']!="utf8mb4_unicode_ci") {
$Settings['sql_collate'] = "utf8mb4_unicode_ci"; } }
if($Settings['sql_collate']=="utf8_bin"||
$Settings['sql_collate']=="utf8_general_ci"||
$Settings['sql_collate']=="utf8_unicode_ci") {
$Settings['sql_charset'] = "utf8"; }
if($Settings['sql_collate']=="utf8mb4_bin"||
$Settings['sql_collate']=="utf8mb4_general_ci"||
$Settings['sql_collate']=="utf8mb4_unicode_ci") {
$Settings['sql_charset'] = "utf8mb4"; }
$SQLCollate = $Settings['sql_collate'];
$SQLCharset = $Settings['sql_charset']; }
if(!isset($Settings['sql_collate'])||!isset($Settings['sql_charset'])) {
$SQLCollate = "latin1_general_ci";
$SQLCharset = "latin1";
if($Settings['charset']=="ISO-8859-1") {
$SQLCollate = "latin1_general_ci";
$SQLCharset = "latin1"; }
if($Settings['charset']=="ISO-8859-15") {
$SQLCollate = "latin1_general_ci";
$SQLCharset = "latin1"; }
if($Settings['charset']=="UTF-8") {
$SQLCollate = "utf8mb4_unicode_ci";
$SQLCharset = "utf8mb4"; }
$Settings['sql_collate'] = $SQLCollate;
$Settings['sql_charset'] = $SQLCharset; }
sql_set_charset($SQLCharset,$SQLStat);
if($SQLStat===false) {
header("Content-Type: text/plain; charset=".$Settings['charset']); sql_free_result($peresult);
ob_clean(); echo "Sorry could not connect to sql database.\nContact the board admin about error. Error log below.";
echo "\n".sql_errorno($SQLStat); $urlstatus = 503;
gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
$sqltable = $Settings['sqltable'];
$temp_user_ip = $_SERVER['REMOTE_ADDR'];
if(!isset($_SERVER['HTTP_USER_AGENT'])) {
$_SERVER['HTTP_USER_AGENT'] = ""; }
if(strpos($_SERVER['HTTP_USER_AGENT'], "msie") &&
!strpos($_SERVER['HTTP_USER_AGENT'], "opera")){
header("X-UA-Compatible: IE=Edge"); }
if(strpos($_SERVER['HTTP_USER_AGENT'], "chromeframe")) {
header("X-UA-Compatible: IE=Edge,chrome=1"); }
$temp_user_agent = $_SERVER['HTTP_USER_AGENT'];
if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
$MkIndexFile = $exfile['index'].$Settings['file_ext']; }
if($Settings['file_ext']=="no+ext"||$Settings['file_ext']=="no ext") {
$MkIndexFile = $exfile['index']; }
$temp_session_data = "ViewingPage|s:9:\"?act=view\";ViewingFile|s:".strlen($MkIndexFile).":\"".$MkIndexFile."\";PreViewingTitle|s:7:\"Viewing\";ViewingTitle|s:11:\"Board index\";UserID|s:1:\"0\";UserIP|s:".strlen($_SERVER['REMOTE_ADDR']).":\"".$_SERVER['REMOTE_ADDR']."\";UserGroup|s:".strlen($Settings['GuestGroup']).":\"".$Settings['GuestGroup']."\";UserGroupID|s:1:\"4\";UserTimeZone|s:".strlen($Settings['DefaultTimeZone']).":\"".$Settings['DefaultTimeZone']."\";";
$alt_temp_session_data['ViewingPage'] = "?act=view";
$alt_temp_session_data['ViewingFile'] = $MkIndexFile;
$alt_temp_session_data['PreViewingTitle'] = "Viewing";
$alt_temp_session_data['ViewingTitle'] = "Board index";
$alt_temp_session_data['UserID'] = "0";
$alt_temp_session_data['UserIP'] = $_SERVER['REMOTE_ADDR'];
$alt_temp_session_data['UserGroupID'] = "4";
$alt_temp_session_data['UserTimeZone'] = $Settings['DefaultTimeZone'];
$alttemp_session_data = serialize($alt_temp_session_data);
$alt_temp_session_data = $alttemp_session_data;
$alttemp_session_data = null;
$SQLSType = $Settings['sqltype'];
//Session Open Function
function sql_session_open($save_path, $session_name ) {
global $sess_save_path;
$sess_save_path = $save_path;
return true; }
//Session Close Function
$iDBSessCloseDB = true;
function sql_session_close() {
global $SQLStat,$iDBSessCloseDB;
if($iDBSessCloseDB===true) {
sql_disconnect_db($SQLStat); }
return true; }
//Session Read Function
function sql_session_read($id) {
global $sqltable,$SQLStat,$SQLSType,$temp_user_ip,$temp_user_agent,$temp_session_data,$alt_temp_session_data;
$result = sql_query(sql_pre_query("SELECT * FROM \"".$sqltable."sessions\" WHERE \"session_id\" = '%s'", array($id)),$SQLStat);
if (!sql_num_rows($result)) {
sql_query(sql_pre_query("DELETE FROM \"".$sqltable."sessions\" WHERE \"session_id\"<>'%s' AND \"ip_address\"='%s' AND \"user_agent\"='%s'", array($id,$temp_user_ip,$temp_user_agent)),$SQLStat);
$utctz = new DateTimeZone("UTC");
$utccurtime = new DateTime();
$utccurtime->setTimezone($utctz);
$time = $utccurtime->getTimestamp();
sql_query(sql_pre_query("INSERT INTO \"".$sqltable."sessions\" (\"session_id\", \"session_data\", \"serialized_data\", \"user_agent\", \"ip_address\", \"expires\") VALUES\n".
"('%s', '%s', '%s', '%s', '%s', %i)", array($id,$temp_session_data,$alt_temp_session_data,$temp_user_agent,$temp_user_ip,$time)),$SQLStat);
return '';
} else {
$utctz = new DateTimeZone("UTC");
$utccurtime = new DateTime();
$utccurtime->setTimezone($utctz);
$time = $utccurtime->getTimestamp();
$predata = sql_num_rows($result);
$data = "";
if($predata > 0) {
$row = sql_fetch_assoc($result);
$data = $row['session_data']; }
/*sql_query(sql_pre_query("UPDATE \"".$sqltable."sessions\" SET \"session_data\"='%s',\"expires\"=%i WHERE \"session_id\"='%s'", array($data,$time,$id)),$SQLStat);*/
return $data; } }
//Session Write Function
function sql_session_write($id,$data) {
global $sqltable,$SQLStat,$SQLSType,$temp_user_ip,$temp_user_agent;
$utctz = new DateTimeZone("UTC");
$utccurtime = new DateTime();
$utccurtime->setTimezone($utctz);
$time = $utccurtime->getTimestamp();
$rs = sql_query(sql_pre_query("UPDATE \"".$sqltable."sessions\" SET \"session_data\"='%s',\"serialized_data\"='%s',\"user_agent\"='%s',\"ip_address\"='%s',\"expires\"=%i WHERE \"session_id\"='%s'", array($data,serialize($_SESSION),$temp_user_agent,$temp_user_ip,$time,$id)),$SQLStat);
return true; }
//Session Destroy Function
function sql_session_destroy($id) {
global $sqltable,$SQLStat;
sql_query(sql_pre_query("DELETE FROM \"".$sqltable."sessions\" WHERE \"session_id\" = '$id'", array($id)),$SQLStat);
return true; }
//Session Garbage Collection Function
function sql_session_gc($maxlifetime) {
global $sqltable,$SQLStat;
$utctz = new DateTimeZone("UTC");
$utccurtime = new DateTime();
$utccurtime->setTimezone($utctz);
$time = $utccurtime->getTimestamp() - $maxlifetime;
//sql_query(sql_pre_query('DELETE FROM \"'.$sqltable.'sessions\" WHERE \"expires\" < UNIX_TIMESTAMP();', array(null)),$SQLStat);
sql_query(sql_pre_query("DELETE FROM \"".$sqltable."sessions\" WHERE \"expires\" < %i", array($time)),$SQLStat);
return true; }
if (session_id()) { session_destroy(); }
session_set_save_handler("sql_session_open", "sql_session_close", "sql_session_read", "sql_session_write", "sql_session_destroy", "sql_session_gc");
if($cookieDomain==null) {
session_set_cookie_params(0, $cbasedir); }
if($cookieDomain!=null) {
if($cookieSecure===true) {
session_set_cookie_params(0, $cbasedir, $cookieDomain, 1); }
if($cookieSecure===false) {
session_set_cookie_params(0, $cbasedir, $cookieDomain); } }
session_cache_limiter("private, no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0");
header("Cache-Control: private, no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0");
header("Pragma: private, no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0");
header("P3P: CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");
header("Date: ".gmdate("D, d M Y H:i:s")." GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");
if(!isset($_COOKIE[$Settings['sqltable']."sess"])) {
$exptime = $utccurtime->getTimestamp() - ini_get("session.gc_maxlifetime");
sql_query(sql_pre_query("DELETE FROM \"".$Settings['sqltable']."sessions\" WHERE \"expires\" < %i OR \"ip_address\"='%s' AND \"user_agent\"='%s'", array($exptime,$temp_user_ip,$temp_user_agent)),$SQLStat); }
if(!isset($_SESSION['CheckCookie'])) {
if(isset($_COOKIE['SessPass'])&&isset($_COOKIE['MemberName'])) {
session_set_save_handler("sql_session_open", "sql_session_close", "sql_session_read", "sql_session_write", "sql_session_destroy", "sql_session_gc");
session_name($Settings['sqltable']."sess");
if (version_compare(phpversion(), '7.0', '<')) { session_start(); } else {
session_start([
'use_trans_sid' => false,
'use_cookies' => true,
'use_only_cookies' => true,
'gc_probability' => 1,
'gc_divisor' => 100,
'gc_maxlifetime' => 1440,
'hash_function' => 1,
'hash_bits_per_character' => 6,
'name' => $Settings['sqltable']."sess",
]); }
if(!isset($_SESSION['UserFormID'])) { $_SESSION['UserFormID'] = null; }
$iDBSessCloseDB = false;
$_SESSION['ShowActHidden'] = "no";
output_reset_rewrite_vars();
require($SettDir['inc'].'prelogin.php');
session_write_close(); } }
session_set_save_handler("sql_session_open", "sql_session_close", "sql_session_read", "sql_session_write", "sql_session_destroy", "sql_session_gc");
session_name($Settings['sqltable']."sess");
if (version_compare(phpversion(), '7.0', '<')) { session_start(); } else {
session_start([
'use_trans_sid' => false,
'use_cookies' => true,
'use_only_cookies' => true,
'gc_probability' => 1,
'gc_divisor' => 100,
'gc_maxlifetime' => 1440,
'hash_function' => 1,
'hash_bits_per_character' => 6,
'name' => $Settings['sqltable']."sess",
]); }
if(!isset($_SESSION['UserFormID'])) { $_SESSION['UserFormID'] = null; }
$iDBSessCloseDB = true;
output_reset_rewrite_vars();
//@register_shutdown_function("session_write_close");
//header("Set-Cookie: PHPSESSID=" . session_id() . "; path=".$cbasedir);
if(!in_array("ini_set", $disfunc)) {
// Set user agent if we can use ini_set and have to do any http requests. :P
$iverstring = "FR 0.0.0 ".$VER2[2]." 0";
if($Settings['hideverinfohttp']=="off") {
$iverstring = $VER2[1]." ".$VER1[0].".".$VER1[1].".".$VER1[2]." ".$VER2[2]." ".$SubVerN; }
if($Settings['hideverinfohttp']=="on") {
$iverstring = "FR 0.0.0 ".$VER2[2]." 0"; }
$qstrtest = htmlentities($Settings['qstr'], ENT_QUOTES, $Settings['charset']);
$qseptest = htmlentities($Settings['qsep'], ENT_QUOTES, $Settings['charset']);
$isiteurl = $Settings['idburl'].url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']);
@ini_set("user_agent", "Mozilla/5.0 (compatible; ".$UserAgentName."/".$iverstring."; +".$isiteurl.")");
if (function_exists("stream_context_create")) {
$iopts = array(
'http' => array(
'method' => "GET",
'header' => "Accept-Language: *\r\n".
"User-Agent: Mozilla/5.0 (compatible; ".$UserAgentName."/".$iverstring."; +".$isiteurl.")\r\n".
"Accept: */*\r\n".
"Connection: keep-alive\r\n".
"Referer: ".$isiteurl."\r\n".
"From: ".$isiteurl."\r\n".
"Via: ".$_SERVER['REMOTE_ADDR']."\r\n".
"Forwarded: ".$_SERVER['REMOTE_ADDR']."\r\n".
"X-Forwarded-For: ".$_SERVER['REMOTE_ADDR']."\r\n".
"Client-IP: ".$_SERVER['REMOTE_ADDR']."\r\n"
)
);
$icontext = stream_context_create($iopts);
function file_get_contents_alt($filename,$use_include_path=null,$offset=-1,$maxlen=null) {
global $icontext;
if($maxlen!==null) {
return file_get_contents($filename,$use_include_path,$icontext,$offset,$maxlen); }
if($maxlen===null) {
return file_get_contents($filename,$use_include_path,$icontext,$offset); } } } }
$iDBVerName = $VerCheckName."|".$VER2[1]."|".$VER1[0].".".$VER1[1].".".$VER1[2]."|".$VER2[2]."|".$SubVerN;
/*
This way checks iDB version by sending the iDBVerName to the iDB Version Checker.
$Settings['vercheck'] = 1;
This way checks iDB version by sending the board url to the iDB Version Checker.
$Settings['vercheck'] = 2;
*/
if(!isset($Settings['vercheck'])) {
$Settings['vercheck'] = 2; }
if($Settings['vercheck']!=1&&
$Settings['vercheck']!=2) {
$Settings['vercheck'] = 2; }
if($Settings['vercheck']===2) {
if($_GET['act']=="vercheckxsl") {
if(stristr($_SERVER["HTTP_ACCEPT"],"application/xml") ) {
header("Content-Type: application/xml; charset=".$Settings['charset']); }
else { header("Content-Type: text/xml; charset=".$Settings['charset']); }
xml_doc_start("1.0",$Settings['charset']);
echo "\n"; ?>
'."\n"; ?>
]>
".$iDBVerName."\n"; ?>
Version Checker
SetOwnerText("Fake Code: ".$RandNum);
$oPhpCaptcha->UseColour(true);
$oPhpCaptcha->Create(); session_write_close(); die(); } }
require($SettDir['inc'].'groupsetup.php');
if($Settings['board_offline']=="on"&&$GroupInfo['CanViewOffLine']!="yes") {
header("Content-Type: text/plain; charset=".$Settings['charset']); sql_free_result($peresult);
ob_clean(); if(!isset($Settings['offline_text'])) {
echo "Sorry the board is off line.\nIf you are a admin you can login by the admin cp."; }
if(isset($Settings['offline_text'])) { echo $Settings['offline_text']; } $urlstatus = 503;
//echo "\n".sql_errorno($SQLStat);
gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
//Time Format Set
if(!isset($_SESSION['iDBDateFormat'])) {
if(isset($Settings['idb_date_format'])) {
$_SESSION['iDBDateFormat'] = $Settings['idb_date_format'];
if(!isset($Settings['idb_date_format'])) {
$_SESSION['iDBDateFormat'] = "g:i A"; } } }
if(!isset($_SESSION['iDBTimeFormat'])) {
if(isset($Settings['idb_time_format'])) {
$_SESSION['iDBTimeFormat'] = $Settings['idb_time_format'];
if(!isset($Settings['idb_time_format'])) {
$_SESSION['iDBTimeFormat'] = "F j Y"; } } }
//Time Zone Set
if(!isset($_SESSION['UserTimeZone'])) {
if(isset($Settings['DefaultTimeZone'])) {
$_SESSION['UserTimeZone'] = $Settings['DefaultTimeZone'];
if(!isset($Settings['DefaultTimeZone'])) {
$_SESSION['UserTimeZone'] = date_default_timezone_get(); } } }
$usertz = new DateTimeZone($_SESSION['UserTimeZone']);
$usercurtime->setTimestamp($defcurtime->getTimestamp());
$usercurtime->setTimezone($usertz);
// Guest Stuff
if(isset($_SESSION['MemberName'])||
isset($_COOKIE['MemberName'])) {
$_SESSION['GuestName'] = null;
$_COOKIE['GuestName'] = null; }
if(!isset($_SESSION['MemberName'])&&!isset($_COOKIE['MemberName'])) {
if(!isset($_SESSION['GuestName'])&&isset($_COOKIE['GuestName'])) {
$_SESSION['GuestName'] = $_COOKIE['GuestName']; } }
if(!isset($_SESSION['LastPostTime'])) { $_SESSION['LastPostTime'] = "0"; }
// Skin Stuff
if(!isset($_SESSION['Theme'])) { $_SESSION['Theme'] = null; }
if(!isset($_GET['theme'])) { $_GET['theme'] = null; }
if(!isset($_POST['theme'])) { $_POST['theme'] = null; }
if(!isset($_GET['skin'])) { $_GET['skin'] = null; }
if(!isset($_POST['skin'])) { $_POST['skin'] = null; }
if(!isset($_GET['style'])) { $_GET['style'] = null; }
if(!isset($_POST['style'])) { $_POST['style'] = null; }
if(!isset($_GET['css'])) { $_GET['css'] = null; }
if(!isset($_POST['css'])) { $_POST['css'] = null; }
if($_GET['theme']==null) {
if($_POST['theme']!=null) {
$_GET['theme'] = $_POST['theme']; }
if($_POST['skin']!=null) {
$_GET['theme'] = $_POST['skin']; }
if($_POST['style']!=null) {
$_GET['theme'] = $_POST['style']; }
if($_POST['css']!=null) {
$_GET['theme'] = $_POST['css']; }
if($_GET['skin']!=null) {
$_GET['theme'] = $_GET['skin']; }
if($_GET['style']!=null) {
$_GET['theme'] = $_GET['style']; }
if($_GET['css']!=null) {
$_GET['theme'] = $_GET['css']; } }
if($Settings['SQLThemes']=="off") {
if($_GET['theme']!=null) {
$_GET['theme'] = chack_themes($_GET['theme']);
if($_GET['theme']=="../"||$_GET['theme']=="./") {
$_GET['theme']=$Settings['DefaultTheme']; $_SESSION['Theme']=$Settings['DefaultTheme']; }
if (file_exists($SettDir['themes'].$_GET['theme']."/settings.php")) {
if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
$NewDay=$utccurtime->getTimestamp();
$qnewskin = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"UseTheme\"='%s',\"LastActive\"='%s' WHERE \"id\"=%i", array($_GET['theme'],$NewDay,$_SESSION['UserID']));
sql_query($qnewskin,$SQLStat); }
/* The file Theme Exists */ }
else { $_GET['theme'] = $Settings['DefaultTheme'];
$_SESSION['Theme'] = $Settings['DefaultTheme'];
/* The file Theme Dose Not Exists */ } }
if($_GET['theme']==null) {
if($_SESSION['Theme']!=null) {
$OldTheme = $_SESSION['Theme'];
$_SESSION['Theme'] = chack_themes($_SESSION['Theme']);
if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
if($OldTheme!=$_SESSION['Theme']) {
$NewDay=$utccurtime->getTimestamp();
$qnewskin = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"UseTheme\"='%s',\"LastActive\"='%s' WHERE \"id\"=%i", array($_SESSION['Theme'],$NewDay,$_SESSION['UserID']));
sql_query($qnewskin,$SQLStat); } }
$_GET['theme']=$_SESSION['Theme']; }
if($_SESSION['Theme']==null) {
$_SESSION['Theme']=$Settings['DefaultTheme'];
$_GET['theme']=$Settings['DefaultTheme']; } }
$PreSkin['skindir1'] = $_SESSION['Theme'];
$PreSkin['skindir2'] = $SettDir['themes'].$_SESSION['Theme'];
require($SettDir['themes'].$_GET['theme']."/settings.php"); }
if($Settings['SQLThemes']=="on") {
if($_GET['theme']==null&&$_SESSION['Theme']==null) {
$_GET['theme'] = $Settings['DefaultTheme'];
$_SESSION['Theme'] = $Settings['DefaultTheme']; }
if($_GET['theme']!=null) {
$themequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."themes\" WHERE \"Name\"='%s'", array($_GET['theme'])); }
if($_GET['theme']==null) {
if($_SESSION['Theme']!=null) {
$themequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."themes\" WHERE \"Name\"='%s'", array($_SESSION['Theme'])); } }
$themeresult=sql_query($themequery,$SQLStat);
$themenum=sql_num_rows($themeresult);
if($themenum<=0) {
$_GET['theme'] = $Settings['DefaultTheme'];
$_SESSION['Theme'] = $Settings['DefaultTheme'];
if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
$NewDay=$utccurtime->getTimestamp();
$qnewskin = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"UseTheme\"='%s',\"LastActive\"='%s' WHERE \"id\"=%i", array($_SESSION['Theme'],$NewDay,$_SESSION['UserID']));
sql_query($qnewskin,$SQLStat); }
$themequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."themes\" WHERE \"Name\"='%s'", array($_GET['theme']));
$themeresult=sql_query($themequery,$SQLStat);
$themenum=sql_num_rows($themeresult); }
else {
if($_GET['theme']==null) {
if($_SESSION['Theme']!=null) {
$_GET['theme'] = $_SESSION['Theme']; } }
if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
$NewDay=$utccurtime->getTimestamp();
$qnewskin = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"UseTheme\"='%s',\"LastActive\"='%s' WHERE \"id\"=%i", array($_GET['theme'],$NewDay,$_SESSION['UserID']));
sql_query($qnewskin,$SQLStat); } }
require($SettDir['inc'].'sqlthemes.php');
sql_free_result($themeresult); }
$_SESSION['Theme'] = $_GET['theme'];
function get_theme_values($matches) {
global $ThemeSet;
$return_text = null;
if(isset($ThemeSet[$matches[1]])) { $return_text = $ThemeSet[$matches[1]]; }
if(!isset($ThemeSet[$matches[1]])) { $return_text = null; }
return $return_text; }
foreach($ThemeSet AS $key => $value) {
$ThemeSet[$key] = preg_replace("/%%/s", "{percent}p", $ThemeSet[$key]);
$ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}T/s", "get_theme_values", $ThemeSet[$key]);
$ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}e/s", "get_env_values", $ThemeSet[$key]);
$ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}i/s", "get_server_values", $ThemeSet[$key]);
$ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}s/s", "get_setting_values", $ThemeSet[$key]);
$ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}t/s", "get_time", $ThemeSet[$key]);
$ThemeSet[$key] = preg_replace("/\{percent\}p/s", "%", $ThemeSet[$key]); }
if(!isset($ThemeSet['TableStyle'])) {
$ThemeSet['TableStyle'] = "table"; }
if(isset($ThemeSet['TableStyle'])) {
if($ThemeSet['TableStyle']!="div"&&
$ThemeSet['TableStyle']!="table") {
$ThemeSet['TableStyle'] = "table"; } }
if(!isset($_SESSION['DBName'])) { $_SESSION['DBName'] = null; }
if($_SESSION['DBName']==null) {
$_SESSION['DBName'] = $Settings['sqldb']; }
if($_SESSION['DBName']!=null) {
if($_SESSION['DBName']!=$Settings['sqldb']) {
redirect("location",$rbasedir.url_maker($exfile['member'],$Settings['file_ext'],"act=logout",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'],false)); } }
?>