【发布时间】:2016-04-13 15:01:32
【问题描述】:
我创建了一个具有禁止功能的 CMS,以禁止违反规则的帐户。
但是,当我禁止某人时,我会禁止该用户,也禁止我自己。仅当您是管理员时才会出现无样式文本:
You have been banned.
如果您是被禁止的用户,您将获得
Your account has been disabled and cannot be used anymore.
You find the details below.
Date: 13-04-2016 16:06:27
Reason: Violation of the EULA.
If you have questions, feel free to contact the administrator.
现在它变得令人毛骨悚然:上面的文字是我脚本中唯一的文字。 “你已被禁止”是一些旧的预字母文本,但它仍然令人毛骨悚然。 为了记录,我很久以前就删除了这段文字。我搜索了每个文件、每个包含和每个数据库。
我什至对“你已被禁止”这句话进行了地图搜索。不走运,他什么也找不到!我还重新启动了 XAMPP 和数据库,我也注销并再次登录;也没有用。
有关问题的详细信息。
文字完全是白纸,没有样式或任何东西。
只出现在 admin.php
当用户被禁止时出现 - 我已经仔细检查了禁止脚本并且一切运行正常。查询指向正确的数据库等。
因为文本只出现在admin.php,我们需要看一下admin.php。这是一个 520 行的文件。
封禁脚本在最上面:
$sql = "SELECT * FROM bans WHERE user_name='".$_SESSION['user_name']."'";
$result = $conn->query($sql);
if(mysqli_num_rows($result) != 0) {
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$blocked = "
<div class='modal-inner' style='width:500px'>
<h2>Account disabled</h2>
Your account has been disabled and cannot be used anymore.<br />You find the details below.<br /><br />
Processed: ". $row["user_dateofban"] ."<br />
Reason: ". $row["reason"] ."<br /><br />
If you have questions, feel free to contact the administrator.
</div>
";
exit($blocked);
}
}
}
希望有人能帮帮我,太令人沮丧了!
admin.php
top.php 和 bot.php 都只是 html 文件。没有 php。
<?php
include("loginsys.php");
if ($login->isUserLoggedIn() == true) {
//ban config
$sql = "SELECT * FROM bans WHERE user_name='".$_SESSION['user_name']."'";
$result = $conn->query($sql);
if(mysqli_num_rows($result) != 0) {
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$blocked = "
<div class='modal-inner' style='width:500px'>
<h2>Account disabled</h2>
Your account has been disabled and cannot be used anymore.<br />You find the details below.<br /><br />
Processed: ". $row["user_dateofban"] ."<br />
Reason: ". $row["reason"] ."<br /><br />
If you have questions, feel free to contact the administrator.
</div>
";
exit($blocked);
}
}
}
if(isset($_SESSION['user_rank']) && $_SESSION['user_rank'] == "3") {
if(isset($_GET["page"]) && $_GET["page"] == "customization") {
include("assets/top.php");
if(isset($_POST['editcustom'])) {
$sql = "UPDATE customization SET iam='".$_POST["iam"]."', iam2='".$_POST["iam2"]."', about='".$_POST["about"]."', about2='".$_POST["about2"]."', about3='".$_POST["about3"]."', recentwork='".$_POST["recentwork"]."', recentwork2='".$_POST["recentwork2"]."', getintouch='".$_POST["getintouch"]."', getintouch2='".$_POST["getintouch2"]."', address='".$_POST["address"]."', phone='".$_POST["phone"]."', email='".$_POST["email"]."', sendbutton='".$_POST["sendbutton"]."', copyright='".$_POST["copyright"]."'";
$updateuser = $conn->query($sql);
if ($updateuser) {
echo '<div class="alert alert-success">Settings saved.</div>';
} else {
echo '<div class="alert alert-danger">Something went wrong executing the query. Try again.</div>';
}
}
$sql = "SELECT * FROM customization LIMIT 1";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
?>
<h1>Header</h1>
<form method="post">
<table>
<tr>
<td>Header 1</td>
<td><input type="text" value="<?php echo $row["iam"]; ?>" name="iam" />
</tr>
<tr>
<td>Header 2</td>
<td><input type="text" value="<?php echo $row["iam2"]; ?>" name="iam2" />
</tr>
</table>
<h1>About</h1>
<table>
<tr>
<td>About heading</td>
<td><input type="text" value="<?php echo $row["about"]; ?>" name="about" />
</tr>
<tr>
<td>About text</td>
<td><input type="text" value="<?php echo $row["about2"]; ?>" name="about2" />
</tr>
<tr>
<td>About button</td>
<td><input type="text" value="<?php echo $row["about3"]; ?>" name="about3" />
</tr>
</table>
<h1>Recent Work</h1>
<table>
<tr>
<td>Recent Work heading</td>
<td><input type="text" value="<?php echo $row["recentwork"]; ?>" name="recentwork" />
</tr>
<tr>
<td>Recent Work button</td>
<td><input type="text" value="<?php echo $row["recentwork2"]; ?>" name="recentwork2" />
</tr>
</table>
<h1>Contact</h1>
<table>
<tr>
<td>Heading</td>
<td><input type="text" value="<?php echo $row["getintouch"]; ?>" name="getintouch" />
</tr>
<tr>
<td>Text</td>
<td><input type="text" value="<?php echo $row["getintouch2"]; ?>" name="getintouch2" />
</tr>
<tr>
<td>Address</td>
<td><input type="text" value="<?php echo $row["address"]; ?>" name="address" />
</tr>
<tr>
<td>Phone</td>
<td><input type="text" value="<?php echo $row["phone"]; ?>" name="phone" />
</tr>
<tr>
<td>Email</td>
<td><input type="text" value="<?php echo $row["email"]; ?>" name="email" />
</tr>
<tr>
<td>Button text</td>
<td><input type="text" value="<?php echo $row["sendbutton"]; ?>" name="sendbutton" />
</tr>
</table>
<h1>Copyright</h1>
<table>
<tr>
<td>Copyright</td>
<td><input type="text" value="<?php echo $row["copyright"]; ?>" name="copyright" />
</tr>
</table>
<input type="submit" value="Save changes" name="editcustom" />
</form>
<?php
}
} else {
echo "No customization yet.";
}
include("assets/bot.php");
} else {
?>
<iframe src="admin.php?page=dashboard" style="width:700px;height:500px;">
Your browser doesn't support iframes. Please upgrade.
</iframe>
<?php
}
} else {
echo "Error: No permissions";
}
} else {
echo "Error: Not signed in";
}
?>
【问题讨论】:
-
因此,如果您将文件更改为
hello或其他内容,您仍然会得到You have been banned.?您还应该使用准备好的语句。 -
@chris85 是的,改文件名后还是报错
-
不是名称,而是内容...除非您加载了新命名的文件并得到相同的输出?
-
@chris85 同样奇怪的是,当你转到
/admin时,它会重定向到/admin/pages/index.html,即使没有/admin文件夹并且任何.htaccess 文件中也没有重定向。我认为我的本地主机可能闹鬼 -
恕我直言,“您的浏览器不支持 iframe。请升级”这句话类似于“您的汽车不支持使用含铅燃料,请升级。”。由于各种安全问题,各种浏览器都有严格的限制甚至拒绝使用 iframe。