<?
$ext = ".php";
$id = "".$id."".$ext."";
if (file_exists($id))
{
include($id);
} else {
include ("404.php");
}
?>
if i have this ^ to get rid of having to type
mysite.com/root.php?id=main.php
it messes my website up.
like when i try to do this:
http://mysite.com/root.php?id=download/ ... file=1.zip
it always shows 404.php
agh! include program!
Moderator: General Moderators
Try
THe "@" will prevent PHP from error reporting.
$id = "".$id ....
that dot i think messed it up.
Code: Select all
$ext = '.php';
$id = $_GETї'id'] . $ext;
if (@file_exists($id)) {
@include_once($id);
} else {
@include_once('404.php');
}
?>$id = "".$id ....
that dot i think messed it up.
If this is the URL you are using to determine whether the file exists
then id will = download/download.php?category=Windows&subc=Archive
when the system looks for this file it obviously does not exist.
try :
Code: Select all
http://mysite.com/root.php?id=download/download.php?category=Windows&subc=Archive&file=1.zipwhen the system looks for this file it obviously does not exist.
try :
Code: Select all
$fileExists = substr($id, 0, strpos($id,"?") - 1);
if (file_exists($fileExists)) {
header("Location: $id");
} else {
header("Location: 404.php");
}