I call my script this way:
http://localhost/thedeathzones/dix.php?INTCFG=0&INTMODE=0&STRPAGE=home
the idea of it is too call a file which build a page of the includes [STR_PAGE].
You can specfiy if it is a text page, image gallery, or plain displaying the [STR_PAGE] file/noral page. WIth INTCFG is a bitfield which tells php which components wants I to be included like soundsystem/loadingbar/dynamic scripts/etc...
But it only shows me the bebug info:
0
1
0__
but has to show the page STRPAGE
include ("includes/".$STRPAGE."inc.php");
I´m explaining the debug info:
I´ve got 2 arrays which are globals
//
$ARRExtHComponent=array();
$ARRExtBComponent=array();
global $ARRExtHComponent;
global $ARRExtBComponent;
//
BUT the array ARR__ExtHComponent is not empty; the index is not 0, but 1.
Problem: If I do array.push function he begins adding the info @[1] or even[2], not 0! Why?
function F_AddComponent($id)
{
$ExtH_Count=sizeof($GLOBALS["ARRExtHComponent"]);
$ExtB_Count=sizeof($GLOBALS["ARRExtBComponent"]);
switch ($id)
{
//THIS ARE 2WAYS OF ADDING INFO 2 ARRAY which even don´t work. Method one:
case 0;//BIT:1
$GLOBALS["ARRExtHComponent"][$ExtH_Count]=CONSTDIR_SYS."engine.inc.php";
break;
//Method 2:
case 1://BIT:2
array_push($GLOBALS["ARR__ExtBComponent"],'INformation');
break;
default:
F_ShowError("E_Index_out_of_bounds");
}
}
here´s my script:
<?php
////////////////////////////////////////////////////////////////////////////////////
//STARTUP URL DEF
////////////////////////////////////////////////////////////////////////////////////
if (!isset($STRPAGE))
{
$STRPAGE="default";
}
if (!isset($INTMODE))
{
$INTMODE=0;
}
if (!isset($INTCFG))
{
$INTCFG=0;
}
if (!isset($STRSYSDIR))
{
$STRSYSDIR="";
}
else
{
$STRSYSDIR=$STRSYSDIR."/";
}
////////////////////////////////////////////////////////////////////////////////////
//RUNTIME DEF
////////////////////////////////////////////////////////////////////////////////////
$ARRExtHComponent=array();
$ARRExtBComponent=array();
global $ARRExtHComponent;
global $ARRExtBComponent;
$INTSECTION_CFG=0;
////////////////////////////////////////////////////////////////////////////////////
//Folder Constants
////////////////////////////////////////////////////////////////////////////////////
define ("CONSTDIR_JS",$STRSYSDIR."javascript/");
define ("CONSTDIR_DB",$STRSYSDIR."db/");
define ("CONSTDIR_LOG",$STRSYSDIR."log/");
define ("CONSTDIR_IMG",$STRSYSDIR."images/");
define ("CONSTDIR_CSS",$STRSYSDIR."css/");
define ("CONSTDIR_INC",$STRSYSDIR."include/");
define ("CONSTDIR_SYS",$STRSYSDIR."system/");
define ("CONSTDIR_CFG",$STRSYSDIR."cfg/");
define ("CONSTDIR_MUS",$STRSYSDIR."music/");
define ("CONSTDIR_SFX",$STRSYSDIR."sounds/");
////////////////////////////////////////////////////////////////////////////////////
//File Constants
////////////////////////////////////////////////////////////////////////////////////
define ("CONSTFILE_LANG",CONSTDIR_DB."language.ini");
define ("CONSTFILE_LOG",CONSTDIR_LOG."sys_request.log");
////////////////////////////////////////////////////////////////////////////////////
//Other Constants/System Constants
////////////////////////////////////////////////////////////////////////////////////
define ("CONSTSYS_OPENTIME",date("d.m.Y H:i:s",time()));
define ("CONST__SYS_FRAMESET",false);
////////////////////////////////////////////////////////////////////////////////////
//ADDING HEADER
////////////////////////////////////////////////////////////////////////////////////
?>
<head>
<link rel=alternate media=print href="javascript:return false">
<meta http-equiv="content-type" content="text/html;charset=Windows">
<?php
////////////////////////////////////////////////////////////////////////////////////
//Parsing Config
////////////////////////////////////////////////////////////////////////////////////
if ($INTMODE==0)
{
if (isset($STRPAGE))
{
if (file_exists(CONSTDIR_CFG.$STRPAGE.".cfg.php")==true)
{
F_AddLogEvent(F_ReadFileSection("M_CFG_PARSE",CONSTFILE_LANG),CONSTDIR_CFG.$STRPAGE.".cfg.php",0);
include (CONSTDIR_CFG.$STRPAGE.".cfg.php");
}
}
else
{
F_AddLogEvent(F_ReadFileSection("E_CFG_NOPARSE",CONSTFILE_LANG),CONSTDIR_CFG.$STRPAGE.".cfg.php",0);
}
}
else if ($mode==1)
{
if (isset($STRPAGE))
{
if (file_exists(CONSTDIR_CFG."IMG".$STRPAGE.".cfg.php")==true)
{
F_AddLogEvent(F_ReadFileSection("M_CFG_PARSE",CONSTFILE_LANG),CONSTDIR_CFG."IMG".$STRPAGE.".cfg.php",0);
include (CONSTDIR_CFG."IMG".$STRPAGE.".cfg.php");
}
}
else
{
F_AddLogEvent(F_ReadFileSection("E_CFG_NOPARSE",CONSTFILE_LANG),CONSTDIR_CFG."IMG".$STR__PAGE.".cfg.php",0);
}
}
////////////////////////////////////////////////////////////////////////////////////
//Adds Components[DEC127==BIN64]
////////////////////////////////////////////////////////////////////////////////////
$INTCFG=decbin($INTCFG);
$INTCFG=strrev($INTCFG);
$INTSECTION_CFG=decbin($INTSECTION_CFG);
$INTSECTION_CFG=strrev($INTSECTION_CFG);
for ($i=0;$i<strlen($INTCFG)||$i<strlen($INTSECTION_CFG);$i++)
{
static $count=0;
#echo $i.$count.substr($INTCFG,$i,1).substr($INTSECTION_CFG,$i,1)."<br>"; //DEBUG INFO
if (substr($INTCFG,$i,1)==1&&substr($INTSECTION_CFG,$i,1)==1)
{
F_AddComponent($count);
}
else if (substr($INTCFG,$i,1)==0&&substr($INTSECTION_CFG,$i,1)==1)
{
F_AddComponent($count);
}
else if (substr($INTCFG,$i,1)==1&&substr($INTSECTION_CFG,$i,1)==0)
{
F_AddComponent($count);
}
else //if binchar==0
{
$count--;
}
$count++;
}
////////////////////////////////////////////////////////////////////////////////////
//Page Building
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
//Building Page Header
////////////////////////////////////////////////////////////////////////////////////
if (isset($STRTitle))
{
echo "<title>".$STRTitle."</title>";
}
////////////////////////////////////////////////////////////////////////////////////
//Adding Extern Header Components
////////////////////////////////////////////////////////////////////////////////////
for ($i=0;$i<count($ARRExtHComponent);$i++)
{
echo $i."".$ARRExtHComponent[$i]."<br>";
#include($ARRExtHComponent);
F_AddLogEvent(F_ReadFileSection("M_SYS_RES_OK",CONSTFILE_LANG),$ARRExtHComponent[$i],0);
}
echo "</HEAD>";
////////////////////////////////////////////////////////////////////////////////////
//Building Page Body
////////////////////////////////////////////////////////////////////////////////////
if (isset($STRBody_CSS))
{
echo "<BODY leftmargin=0 topmargin=0 scroll=no bgproperties=fixed class=".CONSTDIR_CSS.$STRBody_CSS.".css>";
}
else
{
echo "<BODY leftmargin=0 topmargin=0 scroll=no bgproperties=fixed>";
}
////////////////////////////////////////////////////////////////////////////////////
//Adding Extern Body Components
////////////////////////////////////////////////////////////////////////////////////
for ($i=0;$i<count($ARRExtBComponent);$i++)
{
echo $i."".$ARRExtBComponent[$i]."<br>";
include($ARRExtBComponen[$i]);
F_AddLogEvent(F_ReadFileSection("M_SYS_RES_OK",CONSTFILE_LANG),$ARR__ExtBComponent[$i],0);
}
if (isset($BOOLDesignLayer))
{
if ($BOOLDesignLayer==true)
{
echo "<DIV id=DesignLayer style=visibility:hidden>";
}
}
////////////////////////////////////////////////////////////////////////////////////
//Adds Sectionfile
////////////////////////////////////////////////////////////////////////////////////
if ($INTMODE==0)
{
include (CONSTDIR_INC."body".$STRPAGE.".inc.php");
}
else if ($INTMODE==1)
{
include (CONSTDIR_INC."IMG_default.inc.php");
include (CONSTDIR_INC."IMG".$STRPAGE.".inc.php");
}
else if ($INTMODE==2)
{
include (CONSTDIR_INC."DL_default.inc.php");
include (CONSTDIR_INC."DL_".$STRPAGE.".inc.php");
}
else if ($INTMODE==3)//HEADER IS DEF ABOVE SO DON`T WORK
{
#application=application/octet-stream&fileName=XML-Projekt phpHoo/data/test.pdf"
#$file = fopen("$fileName","r");
#header("Content-Type: $application");
#header("Content-Disposition: attachment; filename=$fileName");
#header("Content-Description: PHP4 Generated Data");
#header("Pragma: no-cache");
#header("Expires: 0");
#fpassthru($file);
#fclose($file);
}
if (isset($BOOLDesignLayer))
{
if ($BOOLDesignLayer==true)
{
echo "</DIV>";
}
}
echo "</body>";
echo "";
function F_AddComponent($id)
{
$ExtH_Count=sizeof($GLOBALS["ARRExtHComponent"])-2;//-2 because of unknown error. In unused Array are [0]&[1]!= EMPTY
$ExtB_Count=sizeof($GLOBALS["ARRExtBComponent"])-2;//-2 because of unknown error. In unused Array are [0]&[1]!= EMPTY
switch ($id)
{
case 0;//BIT:1
$GLOBALS["ARRExtHComponent"][$ExtH_Count]=CONSTDIR_SYS."engine.inc.php";
break;
case 1://BIT:2
$GLOBALS["ARRExtHComponent"][$ExtH_Count]=CONSTDIR_SYS."sfx_begin.inc.php";
$GLOBALS["ARRExtBComponent"][$ExtB_Count]=CONSTDIR_SYS."sfx_end.inc.php";
break;
case 2://BIT:4
$GLOBALS["ARRExtBComponent"][$ExtB_Count]=CONSTDIR_SYS."loadingbar_begin.inc.php";
$GLOBALS["ARRExtBComponent"][$ExtB_Count]=CONSTDIR_SYS."loadingbar_end.inc.php";
break;
case 3://BIT:8
$GLOBALS["ARRExtBComponent"][$ExtB_Count]=CONSTDIR_SYS."cookies.inc.php";
break;
case 4://BIT:16
array_push($GLOBALS["ARR__ExtBComponent"],4);
break;
default:
F_ShowError("E_Index_out_of_bounds");
}
}
function F_AddLogEvent($F_text,$F_textadd,$F_mode=0)
{
$F_textadd=strtr($F_textadd,"<>"," ");
$F_text=$F_text."::".$F_textadd."\n";
F_WriteFile(CONST__FILE_LOG,$F_text,$F_mode);
}
function F_WriteFile($F_file,$F_text,$F_mode)
{
$fp=fopen($F_file,"a");
if ($F_mode==1)
{
fputs($fp,"<br>New Session started @ ".CONST__SYS_OPENTIME."<br>".$F_text."<br>");
}
else if ($F_mode==0)
{
fputs($fp,"Server Time: ".date("d.m.Y H:i:s",time())." | Event: ".$F_text."<br>");
}
fclose($fp);
}
function F_ReadFileSection($select,$file)
{
$fp=fopen($file,"r");
while ($line = fgets($fp,1000))
{
if (ereg("[[".$select."]+]",$line))
{
return fgets($fp,1000);
}
}
fclose($fp);
}
function F_ReadFile($file)
{
if (file_exists($file)==true)
{
readfile($file);
F_AddLogEvent(F_ReadFileSection("M_FS_READFILE",CONSTFILE_LANG),$file,0);
}
else
{
F_AddLogEvent(F_ReadFileSection("E_FS_NOFILE",CONSTFILE_LANG),$file,0);
}
}
function F_FillCharByLength($first,$second)
{
if (strlen($first)>=strlen($second))
{
$first=substr($first,strlen($second)-strlen($first)+1,strlen($first));
}
else if (strlen($second)<=strlen($first))
{
$second=substr($second,strlen($first)-strlen($second)+1,strlen($second));
}
}
function F_ShowError($STRText)
{
#F_AddLogEvent($STRText.": ".F_ReadFileSection($STRText,CONSTFILE_LANG),'',1);
#echo $STRText;
#echo "<script language=Javascript>document.location.replace('".$GLOBALS["PHP_SELF"]."?INTCFG=0&STR__LINK=error');</script>";
}
?>