$CacheTbSys = "yes";
$TimeTbSysUpdate= 86400; // 24 hours for renew TBSYS...
$msgtech = "Please contact your nice-support.";
// Load CFG...
if ( !$TBCFG || !function_exists('AccessSessionWebBox') ) {
include('/home/pioneers/cfg/config/system.cfg');
include($TBCFG[functions]."AccessSessionBox.php");
include($TBCFG[functions]."v2/Cookies.php");
}
// Load Session
AccessSessionBox("sess_web", "private, must-revalidate", "w");
if ( !ini_get("register_globals") ) { $TBUSER_original=$TBUSER; }
// Load some functions
if ( !function_exists('GetVarURL') ) { include($TBCFG[functions]."GetVarURL.php"); }
if ( !function_exists('mysql_exist_table') ) { include($TBCFG[functions]."mysql_exist_table.php"); }
if ( !function_exists('get_perms') ) { include($TBCFG[functions]."get_perms.php"); }
if ( !function_exists('limit_office') ) { include($TBCFG[functions]."limit_office.php"); }
if ( !function_exists('Save_FileInfo') ) { include($TBCFG[functions]."Save_FileInfo.php"); }
if ( !function_exists('TableStyles') ) { include($TBCFG[functions]."TableStyles.php"); }
if ( !function_exists('testarray') ) { include($TBCFG[functions]."testarray.php"); }
if ( !function_exists('GetStrDate') ) { include($TBCFG[functions]."StringTools.php"); }
if ( !function_exists('G_etTableTextSeparator') ) { include($TBCFG[functions].'G_etTableTextSeparator.php'); }
if ( !function_exists('ParseSubFunctions') ) { include($TBCFG[functions].'ParseSubFunctions.php'); }
// Load some procedures
if ( !function_exists('G_etDataInfoMySQLBin') ) { include($cpath."procedures/G_etDataInfoMySQLBin.php"); }
if ( !function_exists('GetElementFid') ) { include($cpath."procedures/MenuTools.php"); }
if ( !function_exists('CharSet') ) { include($cpath."procedures/CharSet.php"); }
if ( !function_exists('LangSet') ) { include($cpath."procedures/LangSet.php"); }
if ( !function_exists('Babel') ) { include($cpath."procedures/Babel.php"); }
if ( !function_exists('HtmlCharsUtils') ) { include($cpath."procedures/HtmlCharsUtils.php"); }
// read Info_SessionSystem
include('motorsys/Info_SessionSystem.php');
// xmod
$a=getcwd(); $xmod=substr($a, strrpos($a,"/")+1);
// basic vars, necessary to set
$cpath = "adm/";
#testarray($TBCFG);
// link_cliente
$link_cliente=@mysql_connect($TBCFG[Chost], $TBCFG[Cuser], $TBCFG[Cpwd]) OR die(PrintTableStyleAlert("Error on open a connection to database. ($xmod.view.3)
$msgtech", "center", $cpath, 5, 5));
@mysql_select_db($TBCFG[Cdb]) OR die(PrintTableStyleAlert("Error on select database $TBCFG[Cdb]. ($xmod.view.4)
$msgtech", "center", $cpath, 5, 5));
$now=mktime(date("H"),date("i"),date("s"), date("m"),date("d"),date("Y"));
if ( $_SERVER[HTTP_X_REAL_IP] ) { $this_ip=$_SERVER[HTTP_X_REAL_IP]; } else { $this_ip=$_SERVER[REMOTE_ADDR]; } #zxzx
if ( !$TBUSER ) {
// link_server
$link_server=@mysql_connect($TBCFG[Shost], $TBCFG[Suser], $TBCFG[Spwd]) OR die(PrintTableStyleAlert("Error on open a connection to database. ($xmod.view.1)
$msgtech", "center", $cpath, 5, 5));
@mysql_select_db($TBCFG[Sdb]) OR die(PrintTableStyleAlert("Error on select database. ($xmod.view.2)
$msgtech", "center", $cpath, 5, 5));
// For first time, save TBUSER
$TBUSER[start] = $now;
$TBUSER[pid] = $now;
$TBUSER[pid_count] = 1;
$TBUSER[user] = $user;
$TBUSER[sessid] = session_id();
$TBUSER[ip] = $this_ip;
$TBUSER[hostname] = gethostbyaddr($this_ip);
$TBUSER[region] = "";
# $z=explode(".", $this_ip);
# $z=($z[0]*256*256*256) + ($z[1]*256*256) + ($z[2]*256) + ($z[3]);
# $result=mysql_query("SELECT * FROM $TBCFG[IpToCtry] WHERE ($z BETWEEN ipfrom AND ipto) LIMIT 0,1", $link_server);
# $z=mysql_fetch_array($result, MYSQL_ASSOC);
unset($z);
$ipdat = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$TBUSER['ip']));
$z[ctry] = $ipdat->geoplugin_countryCode;
$TBUSER[ctry] = $z[ctry];
/*
require $cpath.'Browscap/Browscap.php'; // Loads the class
$bc=new Browscap($cpath.'Browscap/cache'); // Creates a new Browscap object (loads or creates the cache)
$mybrowser=$bc->getBrowser(); // Gets information about the mybrowser's user agent
$TBUSER[browser] = $mybrowser->Browser;
$TBUSER[version] = $mybrowser->Version;
if ( $mybrowser->Win64=="true" ) { $TBUSER[arch]="Win64"; } elseif ( $mybrowser->Win32=="true" ) { $TBUSER[arch]="Win32"; } elseif ( $mybrowser->Win16=="true" ) { $TBUSER[arch]="Win16"; } else { $TBUSER[arch]=""; }
$TBUSER[platform] = $mybrowser->Platform;
$TBUSER[device] = "";
switch( $mybrowser->Device_Type ) {
case "Mobile Device": $TBUSER[device]="Mobile"; break;
case "Tablet Device": $TBUSER[device]="Tablet"; break;
case "TV Device": $TBUSER[device]="TV"; break;
case "Desktop": $TBUSER[device]="Desktop"; break;
default: $TBUSER[device]=$mybrowser->Device_Type;
}
if ( $mybrowser->isMobileDevice=="true" || $mybrowser->isMobileDevice==true ) { $TBUSER[device]="Mobile"; }
elseif ( $mybrowser->isTablet=="true" ) { $TBUSER[device]="Tablet"; }
*/
$TBUSER[popup] = NULL;
$TBUSER[cookieWeb] = NULL;
// save!
$_SESSION[TBUSER] = $TBUSER;
} else {
// Load TBUSER from cache
$TBUSER[pid] = mktime(date("H"),date("i"),date("s"), date("m"),date("d"),date("Y"));
$TBUSER[pid_count]++;
}
//----------------------- D E N I E D ----------------------------------
if ( $TBCFG[cserver]=="niceday.pt" && $TBUSER[ctry]=="FR" ) {
if ( !function_exists('logged') ) { include($TBCFG[functions]."logged.php"); }
logged("$TBCFG[logfile].denied.ctry", "DENIED $TBUSER[ctry] $TBUSER[ip] $TBUSER[hostname] $TBUSER[device] $TBUSER[platform] $TBUSER[browser] $TBUSER[version]" );
exit();
}
if ( $TBCFG[cserver]=="niceday.pt" && strstr($TBUSER[hostname],".arquivo.pt") ) {
if ( !function_exists('logged') ) { include($TBCFG[functions]."logged.php"); }
logged("$TBCFG[logfile].denied.hostname", "DENIED $TBUSER[ctry] $TBUSER[ip] $TBUSER[hostname] $TBUSER[device] $TBUSER[platform] $TBUSER[browser] $TBUSER[version]" );
exit();
}
//----------------------------------------------------------------------
// prepare tbsys
include('motorsys/init_tbsys.php');
$TBSYS=init_tbsys($xmod, $now, $TimeTbSysUpdate, $CacheTbSys, "");
// get external vars from into function
foreach($TBSYS[1] as $name => $value ) { ${$name}=$value; }
$TBSYS=$TBSYS[0];
$table_db=$TBSYS[$xmod][table_db];
$table_dbi=$TBSYS[$xmod][table_dbi];
$table_dbs=$TBSYS[$xmod][table_dbs];
$table_dbu=$TBSYS[$xmod][table_dbu];
// Setting user
if ( $table_update[MysqlUpdate]>$TBUSER[start] ) {
$TBUSER[start]=$TBUSER[pid];
}
$TVAR=$TBSYS[$xmod][TVAR_C];
// Load TABMFID format
$line=explode(chr(10),$TBSYS[$xmod][TVAR_C][MFID]);
unset($TABMFID,$menu); reset($line);
foreach ($line as $a => $v ) {
$varname=trim( strtoupper(substr($line[$a], 0, strpos($line[$a],"="))) );
$conteudo=trim( substr($line[$a], strpos($line[$a],"=")+1) );
switch ( $varname ) {
case "LANGUAGE": $language=$conteudo; $menu=NULL; break;
case "MENU": $menu=$conteudo; $submenu=NULL; break;
default:
if ( $language && strlen($varname)>1 ) {
if ( $menu ) {
if ( $varname=="SUBMENU" ) {
$submenu=$conteudo; $trimenu=NULL;
} else {
if ( $submenu ) {
if ( $varname=="TRIMENU" ) {
$trimenu=$conteudo; $quamenu=NULL;
} else {
if ( $trimenu ) {
if ( $varname=="QUAMENU" ) {
$quamenu=$conteudo;
} else {
if ( $quamenu ) {
$TABMFID[$language][MENU][$menu][SUBMENU][$submenu][TRIMENU][$trimenu][QUAMENU][$quamenu][$varname]=$conteudo;
} else { $TABMFID[$language][MENU][$menu][SUBMENU][$submenu][TRIMENU][$trimenu][$varname]=$conteudo; }
}
} else { $TABMFID[$language][MENU][$menu][SUBMENU][$submenu][$varname]=$conteudo; }
}
} else { $TABMFID[$language][MENU][$menu][$varname]=$conteudo; }
}
} else { $TABMFID[$language][$varname]=$conteudo; }
}
}
}
if ( !$TABMFID ) { exit(PrintTableStyleAlert("Menu not found. ($xmod.view.7)
$msgtech", "center", $cpath, 5, 5)); }
unset($line);
// get template
# $Sys[template]=$TBCFG[domains_tmp].$TBCFG[cserver]."/tbsys.template";
# if ( $TBSYS[$xmod][TVAR_S][VERSION]=="2.0" && $TBSYS[$xmod][TVAR_C][INIT] ) {
# if ( file_exists($Sys[template]) ) {
# $Sys[template]=AccessFileBox("r", "", $Sys[template]);
# $Sys[template]=htmlspecialchars_decode($Sys[template][0]);
# }
# }
if ( $TVAR[ASK_COOKIE]=="YES" ) {
// cookieWeb
$a=MyCookie("cidw", "cookieWeb", 15, $TBCFG[cookieWeb_exp], $TBCFG[cookieWeb_dir], GetVarURL('CookieOpt'), "");
if ( $a=="cookie_ask" ) {
print "
Este site utiliza Cookies de modo a proporcionar-lhe a melhor navegação. Ao continuar está a consentir a sua utilização. Saiba mais... ![]() |