error_reporting(0);
session_start();
if(!isset($_SESSION['fstatsajko'])){
#LICZNIK
$plik = file_get_contents("fcounter.txt");
$plik += 1;
$fd = fopen("fcounter.txt",'w');
if($fd){
fwrite($fd,$plik);
fclose($fd);
};
session_register("fstatsajko");
$_SESSION['fstatsajko'] = 1;
}
//dolacz dane konfiguracyjne----------------------------------------------------------
include("config.php");
include("$page_file/modrewrite.php");
//zabezpiecz. zmienna $_GET[a]
$_GET[a]=(int)$_GET[a];
include("$system/base_function.php");
//połącz się z bazą danych
if (mysql_connect($ip, $uzytkownik, $haslo) and mysql_select_db($db)) {
//ustaw kodowanie utf8
@mysql_query ("SET NAMES utf8");
//odpytaj o ustawienia strony---------------------------------------------------------
$setting=setting(1);
//$setting[page_name]
//$setting[page_not_found]
//$setting[page_status]
//$setting[lang_01]
//$setting[lang_02]
//$setting[lang_03]
//$setting[lang_04]
//sprawdzanie jezykow panelu
if($_SESSION[lang]==""){$lang_p="01";}else{$lang_p="$_SESSION[01]";}
function menu_top($id){
$pytaniea = "SELECT * FROM html_page WHERE parrent_id='$id' AND run_element='1' ORDER by pos_element ASC";
$resa = mysql_query($pytaniea);
while ($rowxa = mysql_fetch_array($resa)){
//sprawdzam przekierowanie itworze link
if(!($rowxa[redirecturl]=="")){$link=stripcslashes($rowxa[redirecturl]);}else{
//$naglowek=l_nagl(stripcslashesx($rowxa[title01]));
$link="web.php/a,$rowxa[id]";}
if(($_GET[a]==$rowxa[id]) OR ($_GET[b]==$rowxa[id])){$klasa=' id="active"';}else{$klasa='';}
//if($rowxa[parrent_id]==$_GET[a]){$klasa=' class="active"';}else{$klasa='';}
//tworze menu
$menu_top.='
'.stripcslashes($rowxa[title01]).'';
$menu_check=menu_top_sub($rowxa[id]);
if(!($menu_check=="")){if(($_GET[a]==$rowxa[id]) OR ($_GET[b]==$rowxa[id])){$menu_top.=$menu_check;}}
}
//if(!($id==2)){$menu_top="Poprzednia strona$menu_top";}
if($menu_top==""){
$pytaniea = "SELECT * FROM html_page WHERE id='$id' AND run_element='1' LIMIT 1";
$resa = mysql_query($pytaniea);
while ($rowxa = mysql_fetch_array($resa)){
$next_id=$rowxa[parrent_id];
}
if($next_id=='0'){$menu_top=menu_top(2);}else{$menu_top=menu_top($next_id); }
}
return $menu_top;
}
function menu_top_sub($id){
global $bmenu;
$pytaniea = "SELECT * FROM html_page WHERE parrent_id='$id' AND run_element='1' ORDER by pos_element ASC";
$resa = mysql_query($pytaniea);
while ($rowxa = mysql_fetch_array($resa)){
$menu_top_next='';
//sprawdzam przekierowanie itworze link
if(!($rowxa[redirecturl]=="")){$link=stripcslashes($rowxa[redirecturl]);}else{
//$naglowek=l_nagl(stripcslashesx($rowxa[title01]));
if($rowxa[parrent_id]==$_GET[b]){$bmenu=$_GET[b];}
$link="web.php/a,$rowxa[id],b,$id";}
//tworze menu
$menu_top.='
'.stripcslashes($rowxa[title01]).' •';
//if($menu_top_next==""){$menu_top_next=menu_top($rowxa[parrent_id]);}
//substrony
if(($rowxa[id]==$_GET[a]) OR ($_GET[b]==$rowxa[id])){
if(!($rowxa[parrent_id]==0)){
if(!($bmenu)){$bmenu=$rowxa[id];}
$menu_top_next=menu_top_sub($rowxa[id]);
//$menu_top_next=$rowxa[parrent_id];
$bmenu='';
}
//jesli nie ma podstron w otwartej stronie.
//sprawdz czy w parrencie jest submenu
//sprawdz czy sa podstrony
//
} //end
//} //end2
//daj submenu jesli jest
if(!($menu_top_next=="")){
$menu_top.='
';
}
}
return $menu_top;
}
//tworzenie www -----------------------------------------------------------------------
//sterownik stron
include("$page_file/swith.php");
//ustawiam dane podstawowe - nagłowek title strony
$title.=' - '.$setting[page_name].' ';
//wyswietlam template
//if(($_GET[a]==0) OR ($_GET[a]==1)){
include("$tmpl/index.tmpl.php");
//}else{
//include("$tmpl/index.tmpl.2.php");
//}
//zamykam polaczenie z baza------------------------------------------------------------
mysql_close();
}
else{
//gdy brak polaczenia z baza danych----------------------------------------------------
echo'Blad systemu';
}
?>