Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more - View Single Post - need help getting include script to work with PHP5
View Single Post
Old 06-21-2009, 11:24 AM   #1 (permalink)
halia123
Junior Member
 
Join Date: Apr 2009
Posts: 42
Default need help getting include script to work with PHP5

I'm working on a new site and i'm not very good with php at all. i only know the basics, and the include script i use was written by an old friend years ago. now that im using php5, the include script doesnt work. the error message doesn't even pop up. here is the script, so hopefully someone here can help

PHP Code:
<?php

$abspath = ".";
$extension = "txt";
$defaultfile = "default.txt";
$errorfile = "404.txt";
$query = "barrel";


clearstatcache();
$includestring = "";
$mainpage = urldecode($$query);
$mainstring = $abspath."/".$mainpage.".".$extension;
if (!$mainpage) {
$includestring = $abspath."/".$defaultfile;
} elseif (ereg("\.\.", $mainpage) || substr($mainpage,0,2) == "./" || substr($mainpage,0,3) == "../") {
die("Screw off.");
} else {
if (file_exists($mainstring) && is_file($mainstring)) {
$includestring = $mainstring;
} else {
$includestring = $abspath."/".$errorfile;
}
}
@include($includestring);

?>
------------------------
Acai Berry Juice Health Juice Berries Benefits Teaching Children with Autism Program Poems Behavior Treatment Center
afslanken
halia123 is offline   Reply With Quote
Sponsored Links