<!--#include file=conn.asp-->
<!--#include file=config.asp-->
<!--#include file=const.asp-->
<!--#include file=char.asp-->
<%
 '=========================================================
' File: admin_lockip.asp
' Version:3.0
' Date: 2005-9-17
' Script Written by xmrxw
'=========================================================
' Copyright (C) 2004,2005 Xmrxw.Com All rights reserved.
' Web: http://www.xmrxw.com,http://www.xmzxw.com
' Email: info@mssky.com,super@mssky.com
' QQ：10689579　Msn：zdlmicr@hotmail.com
'=========================================================
stats="锁定IP"
call nav()
if founderr then
	call head_var("","")
	call Mslove_error()
else
	call head_var("IP限制管理","admin_lockip.asp")
	If UserGroupID=1 and Master Then
		Master = True
	Else
		Master = False
	End If
	If Not Master Then
	Errmsg=Errmsg+"<br>"+"<li>您不是系统管理员！请与管理员联系！"
	Founderr=true
	end if
	If Master And Session("flag")<>"" Then
		call main()
	end if
	if founderr then call Mslove_error()
end if
call activeonline()
call footer()

sub main()
Dim lockiplist
		Set Rs = Conn.Execute("select Userlockip from Ms_setup where Cid=1")
		if not (rs.eof and rs.bof) then
		lockiplist=Trim(rs(0))
		else
		lockiplist=""
		end if
		rs.close
dim userip,ips,GetIp1,GetIp2
if request("userip")<>"" then
userip=request("userip")
ips=Split(userIP,".")
If Ubound(ips)=3 Then GetIp1=ips(0)&"."&ips(1)&"."&ips(2)&".*"
end if
if request("action")="add" or request("userip")<>"" then%>
  <table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
    <tr align="left"> 
      <th width="100%" height="28" align=center colspan=2 class=tablebody1>IP限制管理－－添加</th>
    </tr>
	<%
dim sip,str1,str2,str3,str4,num_1,num_2
if request.querystring("reaction")="save" then
	sip=cstr(request.form("ip1"))
	If sip<>"" Then
		If Trim(lockiplist)<>"" Then
			sip=Trim(lockiplist) & "|" & Replace(sip,"|","")
		End If
	End If
	if sip<>"" then
		Conn.execute("update Ms_setup set UserLockIP='"&replace(sip,"'","''")&"'")
	end if
%><tr>
<td width="100%"  class=tablebody1 colspan=2 align=center>限制IP添加成功！</td>
</tr>
<tr>
<td width="100%"  class=tablebody1 colspan=2 align=center><a href="<%=Request.ServerVariables("HTTP_REFERER")%>">&lt;&lt;返回上一页</a></td>
</tr>
<%
else
%>
<form action="?action=add&reaction=save" method="post">
<tr>
<td width="100%"  class=tablebody1 colspan=2><B>说明</B>：您可以添加多个限制IP，每个IP用|号分隔，限制IP的书写方式如202.152.12.1就限制了202.152.12.1这个IP的访问，如202.152.12.*就限制了以202.152.12开头的IP访问，同理*.*.*.*则限制了所有IP的访问。在添加多个IP的时候，请注意最后一个IP的后面不要加|这个符号</td>
</tr>
<tr>
<td width="20%" class=tablebody1>限制I&nbsp;P</td>
<td width="80%"  class=tablebody1><input type="text" name="ip1" size="30" value="<%=GetIp1%>">&nbsp;如202.152.12.*</td>
</tr>
<tr>
<td width="20%" class=tablebody2  colspan=2 align=center>
<input type="submit" name="Submit" value="添 加">
</td>
</tr>
</form>
<%
end if
elseif request("action")="delip" then
	userip=request("ips")
	'userip=split(userip,chr(10))
	userip=split(userip,vbCrLf)
	for i = 0 to ubound(userip)
		if not (userip(i)="" or userip(i)=" ") then
			If i=0 Then
				getip1 = userip(i)
			Else
				getip1 = getip1 & "|" & userip(i)
			End If
		End If
	next
	Conn.execute("update Ms_setup set Userlockip='"&replace(getip1,"'","''")&"'")
	response.write "更新限制IP成功！"
else
%>
<table width="100%" border="0" cellspacing="1" cellpadding="3"  align=center  class=tableborder1>
<FORM METHOD=POST ACTION="?action=delip">
<tr> 
<th width="100%">IP限制管理－－管理</th>
</tr>
<tr>
<td width="100%" class=forumrow>
<B>说明</B>：您可以添加多个限制IP，每个IP用回车分隔，限制IP的书写方式如202.152.12.1就限制了202.152.12.1这个IP的访问，如202.152.12.*就限制了以202.152.12开头的IP访问，同理*.*.*.*则限制了所有IP的访问。在添加多个IP的时候，请注意最后一个IP的后面不要加回车.
</td>
</tr>
<tr>
<td width="100%" class=forumrow colspan=2>
<textarea name="ips" cols="80" rows="8">
<%
userip=split(Trim(lockiplist),"|")
For i=0 To Ubound(userip)
	Response.Write userip(i)
	If i<Ubound(userip) Then Response.Write chr(10)
Next
%>
</textarea>
</td>
</tr>
<tr>
<td width="20%" class=forumrow></td>
<td width="80%" class=forumrow>
<input type="submit" name="Submit" value="修 改">
</td>
</tr>
</FORM>
</table>
<%
end if
end sub
%>   
</body>
</html> 