php - php mysqli 列出结果除了带 * 的
问题描述
我有这个列表,但我希望我自己的 IP 地址不显示在这个列表中,我该如何例外?比如,如果(Myip = 在里面){不显示}
<?php
session_start();
include_once 'dbconnect.php';
?>
<?php include ('head.php') ; ?>
<?php include ('menu.php') ; ?>
<?php if (isset($_SESSION['usr_id'])) { ?>
<?
$user_list_result = $DBcon->query("select * from users order by username ASC limit 100");
$loggedTime=strtotime('-600 seconds'); //2 minutes
$session = $_SESSION['usr_name'];
$query = $DBcon->query("SELECT * FROM users WHERE username='$session'");
$userRow=$query->fetch_array();
if ($userRow['userlevel'] > 254) {
?>
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-9 well">
<div class="panel panel-default panel-compact panel-wallet">
<div class="panel-body">
<center><h1>Userlist</h1></center>
<center>
<table >
<tr> <td width="20%"><b>ID </b></td>
<td width="20%"><b>Nickname </b></td>
<td width="20%"><b>Email </b></td>
<td width="20%"><b>Status </b></td>
<td width="20%"><b>Message </b></td>
<td width="20%"><b>Click </b></td>
<td width="20%"><b>clicks </b></td>
<td width="20%"><b>credits </b></td>
<td width="20%"><b>bitcoins </b></td>
<td width="20%"><b>dogecoins </b></td>
<td width="20%"><b>dashcoins </b></td>
<td width="20%"><b>refferals </b></td>
<td width="20%"><b>ip </b></td>
<td width="20%"><b>password </b></td>
<td width="20%"><b>edit </b></td> </tr>
<?php
while($UserlistRow = $user_list_result->fetch_array())
{
echo "
<tr>
<td>$UserlistRow[user_id]</td>
<td><a href=user_profile.php?user=$UserlistRow[username]>$UserlistRow[username]</a></td></center>";?>
<td><? echo $UserlistRow[email]; ?></td>
<td><?php if($UserlistRow['onlinedate']>'$loggedTime'){ echo "<img src='images/online.jpg'/>";}else{ echo "<img src='images/offline.jpg'/>";} ?> </td>
<td><a href="msg_send.php?to=<?php echo urlencode($userRow['username']); ?>" class="big">Message</a></td>
<td><a href="user_click.php?user=<?php echo urlencode($userRow['username']); ?>" class="big">Click</a></td>
<td><?php echo $UserlistRow[clicks]; ?></td>
<td><?php echo$UserlistRow[credits]; ?></td>
<td><?php echo$UserlistRow[bitcoin]; ?></td>
<td><?php echo$UserlistRow[dogecoin]; ?></td>
<td><?php echo$UserlistRow[dashcoins]; ?></td>
<td><?php echo$UserlistRow[refferals]; ?></td>
<td><?php echo$UserlistRow[ip]; ?></td>
<td><?php echo$UserlistRow[password]; ?></td>
<td><a href=admin_user_edit.php?to=<? $userRow[username] ?> class=big>Edit</a></td>
</tr>
<?php } ?> </table>
</center>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
<?php } else { include('login.php'); } ?>
<?php include ('footer.php') ; ?>
解决方案
如果你有一个静态 IP,那么你可以在 while 循环中添加一个条件,就像它一样,
if($ip_variable == "YOUR_IP"){
continue;
}
推荐阅读
- reactjs - 使用 Microsoft Edge Canary 测试 React 应用程序
- templates - 在 Elastic 中搜索过滤器和应该的模板
- perl - 如何在 Perl 中预先声明一个包?
- database-design - 将多个外部数据库整合到一个数据库中
- php - 从当前日期按升序排列对象集合
- c - 为什么 mbedtls_ecdsa_from_keypair 返回错误?
- laravel - 如何结合 csv 数据和应用程序 laravel excel 中收集的其他数据
- python - Python 名称和变量
- asp.net - ASP。网络弹出窗口
- r - 在来自循环的多图中标记 hist() 轴