我的网站基本上是5个“页面”,大约30个由php调用的“帮助页面”,每个“页面”有时包含1或2个“帮助页面”,有时每页“10页”。是否可以检测页面是否包含PHP?
因为这些都包括我有某些变量和我的mysql连接代码在“页面”和助手页面依赖于这些变量。例如,这里是我的“edit.php”页:
<form method="POST" enctype="text/plain" action="<?php echo $actual_link; ?>">
<div class="one-hundred"><?php include("include/pages/vehicle.php"); ?></div>
<div class="fifty"><?php include("include/pages/vehicle_valuations.php"); ?></div>
<div class="fifty"><?php include("include/pages/vehicle_features.php"); ?></div>
<div class="thirty-three">
<?php
include("include/pages/purchased_info.php");
include("include/pages/vehicle_Titles.php");
?>
</div>
<div class="thirty-three"><?php include("include/helper_content/warranty_lookup.php"); ?></div>
<div class="thirty-three"><?php include("include/pages/vehicle_advertising.php"); ?></div>
<div id="buttons">
<input type="submit" id="Submit" value="Submit">
</div>
我想知道如果我直接指导我的浏览器www.____.com/include/pages/vehicle.php是该页面失败,因为缺少mysql连接脚本和缺少变量。有没有办法来检测是否有人直接访问页面,或通过iframe或ajax或包括?
你应该限制访问你的'include'目录,没有必要让它可以访问。 – AntoineB
如果连接不正确,请检查每个文件或包含所有这些include/*文件的连接。 –