【php开源代码栏目提醒】:网学会员为广大网友收集整理了,ip.php,希望对大家有所帮助!
<?php
session_start();
include "../include/query.php";
include "../include/functions.php";
if($_SESSION["administrator"]=="")
{
header("location:../notice.php?id=".admin_only);
exit;
}
$ipResult = $db->query("select * from `lockedip` where 1 && (`locktime` > '".(time()-getConfig("lock_cantlogin_time")*60)."'||`always`=1)");
?>
<html>
<head>
<META http-equiv="Content-Type" content="text/html;charset=gb2312">
<title>
<?=getConfig("chatroom_name")?> -- IP管理
</title>
<link rel="StyleSheet" type="text/css" href="../styles/admin.css">
<script language=javascript>
function selectAll()
{
var fm = document.lockedIpForm;
for(var i=0;i<fm.elements.length;i++)
{
if(fm.elements[i].type=="checkbox"&&fm.elements[i].name=="ipid[]")
{
fm.elements[i].checked = fm.sl.checked;
}
}
}
function verifyForm(fm)
{
var str = fm.ip.value;
if(str=="")
{
alert("请输入IP");
fm.ip.focus();
return false;
}
var reg = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/;
if(reg.test(str))
{
return true;
}
else
{
alert("请输入正确的IP!");
return false;
}
}
</script>
</head>
<body bgcolor="<?=getConfig("page_bgcolor")?>">
<?php
include "menu.php";
?>
<table width=700 class="messagebox" align="center" cellspacing=0 cellpadding=0>
<tr>
<td class="messagetitle">
聊天室IP管理
</td>
</tr>
<tr>
<td class="messageright">
<!--设置表格-->
<table width=700 cellspacing=1 cellpadding=2 bgcolor="black">
<tr>
<td colspan=2 align=center bgcolor="#6699ff">
<b>已经被封锁的IP</b>
</td>
</tr>
<tr>
<td colspan=2 align="center" bgcolor="white">
<form name="lockedIpForm" method="post" action="saveconfig.php?w=ip">
<input type="hidden" name="sort" value="manage">
<input type="hidden" name="act" value="">
<table width=600 align="center" cellspacing=1 cellpadding=3 bgcolor="black">
<tr>
<td width=120 align="center" bgcolor="buttonface"><b>IP</b></td>
<td width=200 align="center" bgcolor="buttonface"><b>封锁时间</b></td>
<td width=80 align="center" bgcolor="buttonface"><b>是否永久</b></td>
<td width=100 align="center" bgcolor="buttonface"><b>被封用户</b></td>
<td width=100 align="center" bgcolor="buttonface"><b><input type="checkbox" name="sl" onclick="selectAll()"></b></td>
</tr>
<?php
while($ipRow = $db->fetchArray($ipResult))
{
?>
<tr>
<td width=120 align="center" bgcolor="white"><?=$ipRow["ip"]?></td>
<td width=200 align="center" bgcolor="white"><?=$ipRow["time"]?></td>
<td width=80 align="center" bgcolor="white"><?=$ipRow["always"]?"<font color='red'>是</font>":"否"?></td>
<td width=100 align="center" bgcolor="white"><?=$ipRow["username"]?></td>
<td width=100 align="center" bgcolor="white"><input type="checkbox" name="ipid[]" value="<?=$ipRow["id"]?>"></td>
</tr>
<?php
}
?>
</table>
原因 <input type="text" name="why" size=40><br>
<button onclick="act.value='unlock';lockedIpForm.submit()">解除封锁</button> <button onclick="act.value='lock';lockedIpForm.submit()">永久封锁</button>
</td>
</tr>
</form>
<tr>
<td colspan=2 align=center bgcolor="#6699ff">
<form name="ipForm" method="post" onsubmit="return verifyForm(this)" action="saveconfig.php?w=ip">
<input type="hidden" name="sort" value="lock">
<b>封锁IP</b>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
您要封锁的IP
</td>
<td width=500 bgcolor="white">
<input type="text" name="ip">输入 IP 地址
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
原因
</td>
<td width=500 bgcolor="white">
<input type="text" name="why" size=40>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
是否永久
</td>
<td width=500 bgcolor="white">
<input type="checkbox" name="always" value="1">永久封锁该IP
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
操作
</td>
<td width=500 bgcolor="white">
<input type="submit" value="立即封锁">
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<br>
</body>
</html>