0

我有一个 index.php 文件,其中包含 2 个文件

require("stats.php");
require("stats_encry.php");
  1. stats.php 有一些变量声明。
  2. stats_encry.php 有另一组变量声明。

现在,如果用户只是通过搜索或直接访问 index.php(通过访问 mysite.com/root/index.php),我希望索引加载 stats_encry.php

但是,如果用户转到 index.php?auth=jHh87fBinJ0Nj1EcDPOPxeXQe 我希望加载 stats.php 而不是 stats_encry.php

这样做的目的是防止某人意外进入 index.php 页面时看到某些内容。因此,如果我给某人索引文件的特定 url,并在最后添加一个值,他应该能够看到内容(将通过 stats.php 加载)

我该怎么做 index.php ?非常感谢任何帮助..

4

1 回答 1

0

您可以检查$_GET

if (isset($_GET['auth'])
{
  require 'stats_encry.php';
}
else
{
  require 'stats.php';
}
于 2012-07-03T12:25:37.150 回答