fjellaksel
August 6th, 2004, 09:07 AM
Hi guys...
I use a include script on my index page, so all pages are loaded into the index page... yeah, you probably know what I am talking about.. like:
index.php?page=photos ... but, the server that the site is hosted on has the global_variable set to off, and it won't work if I do not declare my variables first.. at least, that's what they say... Below is the code, and I hope that someone can tell me what I have to change to get it to work...
--------------------------------------------------
<?php
$IncludeDir = "inc_files";
$DefaultPath = "inc_files/bilder.inc";
$FileExtension = ".inc";
if (isset($side)) {
$side = stripslashes(strip_tags($side));
$Forbidden1 = ereg("\.\./", $side);
$Forbidden2 = ereg("/", $side);
$IncludePath = $IncludeDir . "/" . $side . $FileExtension;
if ($Forbidden1 OR $Forbidden2) {
echo "<h1>Warning</h1>\n";
echo "<p>Forespørsler på tvers av definerte \n";
echo "områder er ikke tillatt.</p>\n";
}
else {
if (@fopen("$IncludePath", "r")) {
include ("$IncludePath");
}
elseif (!(@fopen("$IncludePath", "r"))) {
echo "<p>Denne siden finnes ikke!</p>\n";
}
}
}
else {
include("$DefaultPath");
}
?>
------------------------------------------
Hope someone can help me out here...
Best Regards
Eirik Fjellaksel
I use a include script on my index page, so all pages are loaded into the index page... yeah, you probably know what I am talking about.. like:
index.php?page=photos ... but, the server that the site is hosted on has the global_variable set to off, and it won't work if I do not declare my variables first.. at least, that's what they say... Below is the code, and I hope that someone can tell me what I have to change to get it to work...
--------------------------------------------------
<?php
$IncludeDir = "inc_files";
$DefaultPath = "inc_files/bilder.inc";
$FileExtension = ".inc";
if (isset($side)) {
$side = stripslashes(strip_tags($side));
$Forbidden1 = ereg("\.\./", $side);
$Forbidden2 = ereg("/", $side);
$IncludePath = $IncludeDir . "/" . $side . $FileExtension;
if ($Forbidden1 OR $Forbidden2) {
echo "<h1>Warning</h1>\n";
echo "<p>Forespørsler på tvers av definerte \n";
echo "områder er ikke tillatt.</p>\n";
}
else {
if (@fopen("$IncludePath", "r")) {
include ("$IncludePath");
}
elseif (!(@fopen("$IncludePath", "r"))) {
echo "<p>Denne siden finnes ikke!</p>\n";
}
}
}
else {
include("$DefaultPath");
}
?>
------------------------------------------
Hope someone can help me out here...
Best Regards
Eirik Fjellaksel