dpsyssiv90846 2014-02-14 12:48
浏览 55
已采纳

$ _GET总是返回管理员

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');

?>
  • 写回答

1条回答 默认 最新

  • dongzhou8764 2014-02-14 12:56
    关注

    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?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 hexo+github部署博客
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥100 H5网页如何调用微信扫一扫功能?