I'm currently busy on my index.php
to include the via $_GET
requested file.
The only problem is that it is always returning admin
and never returning the declared value in the $_GET
variable.
All the files are in a directory used as subdomain.
Warning: include(pages/admin.php): failed to open stream: No such file or directory in /home/tjattern/domains/*censored*/public_html/admin/index.php on line 20
I am requesting http://admin.*censored*.nl/index.php?page=dashboard
index.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// include required files
require_once('core/config.php');
require_once('template/tpl_top.php');
if(isset($_COOKIE['as']))
{
if(isset($_GET['page']))
{
$file = "pages/".$_GET['page'].".php";
if(file_exists($file))
{
include($file); // actual line 20
}
else
{
echo 'This page could not be found';
}
}
else
{
include('pages/dashboard.php');
}
}
else
{
include('pages/login.php');
}
require_once('template/tpl_bot.php');
?>
http://ww.example.com/index.php?page=sample
requesting this url
$_GET['page'] in index.php end will be "sample"
Are you passing correct values in page atribute?