admin_lockip.asp
上传用户:qyswxdl
上传日期:2013-06-01
资源大小:1373k
文件大小:16k
源码类别:

家庭/个人应用

开发平台:

ASP/ASPX

  1. <!--#include file="../checkpost.asp"-->
  2. <!--#include file="articleconn.asp" -->
  3. <!--#include file="security.asp"-->
  4. <%
  5. if session("flag")>2 then
  6. response.write "<br><p align=center>您没有操作的权限</p>"
  7. response.end
  8. end if
  9. %>
  10. <link rel="stylesheet" type="text/css" href="inc/Admin_STYLE.CSS">
  11. <META content="Microsoft FrontPage 6.0" name=GENERATOR><style type="text/css">
  12. <!--
  13. body,td,th {
  14. font-size: 9pt;
  15. }
  16. .??1 {
  17. color: #000000;
  18. font-weight: bold;
  19. }
  20. .??2 {color: #000000}
  21. .??1 {color: #000000}
  22. -->
  23. </style></HEAD>
  24. <BODY leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
  25. <TABLE class=tableBorder  width="98%" align=center border=0>
  26.   <TR>
  27.     <TH height=25 style="background-image: url('images/admin_bg_1.gif')">
  28. <font face="宋体">&nbsp;授权网吧管理</font></TH></TR>
  29.   <TR>
  30.     <TD class=forumrow height=100>
  31. <table border="0" style="border-collapse: collapse" width="100%">
  32. <tr><td>
  33. </TD></TR>
  34.   <TR>
  35.     <TD class=forumrow height=100>
  36. <%
  37. call main()
  38. sub main()
  39. dim userip,ips,GetIp1,GetIp2
  40. if request("userip")<>"" then
  41. userip=request("userip")
  42. ips=Split(userIP,".")
  43. GetIp1=ips(0)&"."&ips(1)&"."&ips(2)&".1"
  44. GetIp2=ips(0)&"."&ips(1)&"."&ips(2)&".255"
  45. else 
  46. userip=""
  47. GetIp1=""
  48. GetIp2=""
  49. end if
  50. if request("action")="add" then
  51. %>
  52.         <table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
  53.           <%
  54. dim sip,str1,str2,str3,str4,num_1,num_2
  55. if request.querystring("reaction")="save" then
  56. sip=cstr(request.form("ip1"))
  57. 'dot=instr(ip,".")-1
  58. 'response.write dot
  59. str1=left(sip,cint(instr(sip,".")-1))
  60. sip=mid(sip,cint(instr(sip,"."))+1)
  61. str2=left(sip,cint(instr(sip,"."))-1)
  62. sip=mid(sip,cint(instr(sip,"."))+1)
  63. str3=left(sip,cint(instr(sip,"."))-1)
  64. str4=mid(sip,cint(instr(sip,"."))+1)
  65. num_1=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1
  66. mbname=cstr(request.form("mbname"))
  67.  mbpass=cstr(request.form("mbpass"))
  68. data=cstr(request.form("data"))
  69. sip=cstr(request.form("ip2"))
  70. str1=left(sip,instr(sip,".")-1)
  71. sip=mid(sip,instr(sip,".")+1)
  72. str2=left(sip,instr(sip,".")-1)
  73. sip=mid(sip,instr(sip,".")+1)
  74. str3=left(sip,instr(sip,".")-1)
  75. str4=mid(sip,instr(sip,".")+1)
  76. num_2=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1
  77. 'response.write num_1 &","& num_2
  78. 'response.end
  79. set rs = server.CreateObject ("adodb.recordset")
  80. sql="select * from goip"
  81. rs.open sql,conn,1,3
  82. rs.addnew
  83. rs("ip1")=num_1
  84. rs("why")=trim(request.form("why"))
  85. rs("ip2")=num_2
  86. rs("sip1")=request.form("ip1")
  87. rs("sip2")=request.form("ip2")
  88. rs("mbname")=mbname
  89. rs("mbpass")=mbpass
  90. rs("time")=now()+data
  91. rs.update
  92. rs.close
  93. set rs=nothing
  94. conn.close
  95. set conn=nothing
  96. %>
  97.           </span>
  98. <tr>
  99. <td width="100%" class=forumrow>
  100. <span style="font-size: 9pt">添加成功!</td>
  101. </tr> 
  102. </table>
  103. <%
  104. elseif request("mb")="mb" then
  105. %>  
  106. <table class="border" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  107.   <tr class="title"> 
  108.           <tr> 
  109.             <th width="98%" height="22" colspan=2 class="title" ><span style="font-size: 9pt"> 网吧IP开通管理--添加</th>
  110.           </tr>
  111.           <form action="?action=add&reaction=save" method="post">
  112.             <tr> 
  113.               <td width="20%" class=tdbg><div align="center"><span style="font-size: 9pt">网吧名称</span></div></td>
  114.               <td width="76%" class=tdbg><span style="font-size: 9pt"> 
  115.                 <input type="text" name="mbname" size="30" value="<%=mbname%>">
  116.                 </span></td>
  117.             </tr>
  118.             <tr> 
  119.               <td width="20%" class=tdbg><div align="center"><span style="font-size: 9pt">起始I&nbsp;P</span></div></td>
  120.               <td width="76%" class=tdbg><span style="font-size: 9pt">
  121.                 <input type="text" name="ip1" size="30" value="<%=GetIp1%>">
  122.                 &nbsp;如202.96.0.0</span></td>
  123.             </tr>
  124.             <tr> 
  125.               <td width="20%" class=tdbg><div align="center"><span style="font-size: 9pt">结尾I&nbsp;P</span></div></td>
  126.               <td width="76%" class=tdbg><span style="font-size: 9pt">
  127.                 <input type="text" name="ip2" size="30" value="<%=GetIp2%>">
  128.                 &nbsp;如202.96.0.255</span></td>
  129.             </tr>
  130.             <tr> 
  131.               <td width="20%" class=tdbg><div align="center"><font color="#FF0000">管理密码</font></div></td>
  132.               <td width="76%" class=tdbg><span style="font-size: 9pt">
  133. <input type="text" name="mbpass" size="30" value="<%=mbpass%>"></span></td>
  134.             </tr>
  135.             <tr> 
  136.             
  137.             </tr>
  138.             <tr> 
  139.               <td width="20%" class=tdbg><div align="center">到期时间</div></td>
  140.               <td width="76%" class=tdbg><span style="font-size: 9pt"> 
  141.                 <select size="1" name="data">
  142.                   <option value="30" selected>一个月</option>
  143.                   <option value="60">三个月</option>
  144.                   <option>半年</option>
  145.                   <option value="365">一年</option>
  146.                   <option value="800">二年</option>
  147.                   <option value="9999">无限制</option>
  148.                 </select>
  149.                 </span></td>
  150.             </tr>
  151.             <tr> 
  152.               <td width="20%" class=tdbg><div align="center">授权说明</div></td>
  153.               <td width="76%" class=tdbg> <span style="font-size: 9pt"> 
  154.                 <textarea rows="3" name="why" cols="28">没有说明</textarea>
  155.                 </span></td>
  156.             </tr>
  157.             <tr> 
  158.               <td width="20%" class=tdbg></td>
  159.               <td width="76%" class=tdbg> <span style="font-size: 9pt"> 
  160.                 <input type="submit" name="Submit" value="提 交"> </td>
  161.             </tr>
  162.           </form>
  163.           <%else%>
  164.           <%end if
  165. elseif request("action")="delip" then
  166. conn.execute("delete from goip where id in ("&request.form("delid")&")")
  167. response.write "删除成功!"
  168. else
  169. %> <FORM METHOD=POST ACTION="?action=delip">
  170.             <tr> 
  171.               <th width="100%" colspan=8 height="14" style="background-image: url('images/admin_bg_1.gif')"> 
  172.                 <p align="right"><font color="#FFFFFF"> <span style="font-size: 9pt">
  173.                   <input type=submit name=submit value="删除">
  174.                   <input type=checkbox value="on" name="chkall" onclick="CheckAll(this.form)">
  175.               </span></th>
  176.             </tr>
  177.             <tr class="title"> 
  178.               <td width="38" height="22" align="center" class="forumHeaderBackgroundAlternate" > 
  179.                 <span class="&#26679;&#24335;1"> <span style="font-size: 9pt">ID</span></span></td>
  180.               <%if request("action")="mb" then%>
  181.               <td width="15%" height="22" align="center" class="forumHeaderBackgroundAlternate" > 
  182.                 <span class="&#26679;&#24335;1">网吧名称</span></td>
  183.               <%end if%>
  184.               <td width="15%" height="22" align="center" class="forumHeaderBackgroundAlternate" > 
  185.                 <span class="&#26679;&#24335;2"><B> <span style="font-size: 9pt">起始IP</span></B></span></td>
  186.               <td width="15%" height="22" align="center" class="forumHeaderBackgroundAlternate" > 
  187.                 <span class="&#26679;&#24335;2"><B> <span style="font-size: 9pt">结尾IP</span></B></span></td>
  188.               <td width="15%" height="22" align="center" class="forumHeaderBackgroundAlternate" > 
  189.                 <span class="&#26679;&#24335;2"> <b>原因说明</b></span></td>
  190.               <td width="15%" height="22" align="center" class="forumHeaderBackgroundAlternate" > 
  191.                 <span class="&#26679;&#24335;2"> <b>時間</b></span></td>
  192.               <td width="15%" height="22" align="center" class="forumHeaderBackgroundAlternate" > 
  193.                 <span class="&#26679;&#24335;2"> <b>到期</b></span></td>
  194.               <td width="5%" height="22" align="center" class="forumHeaderBackgroundAlternate" > 
  195.                 <span class="&#26679;&#24335;2"><B> <span style="font-size: 9pt">操作</span></B></span></td>
  196.             </tr>
  197.             <%
  198. dim currentpage,page_count,Pcount
  199. dim totalrec,endpage
  200. currentPage=request("page")
  201. if currentpage="" then
  202. currentpage=1
  203. else
  204. currentpage=clng(currentpage)
  205. if err then
  206. currentpage=1
  207. err.clear
  208. end if
  209. end if
  210. if request("action")="mb" then
  211. sql="select * from goip where mbname<>'' order by id desc"
  212. else
  213. sql="select * from goip where mbname='' order by id desc"
  214. end if
  215. Set rs= Server.CreateObject("ADODB.Recordset")
  216. rs.open sql,conn,1,3
  217. if rs.eof and rs.bof then
  218. %>
  219.             <tr> 
  220.               <td width="846" colspan=8 class=forumrow> <span style="font-size: 9pt">还没有任何IP限制数据。</td>
  221.             </tr>
  222.             <%
  223. else
  224. rs.PageSize = 500
  225. 'rs.AbsolutePage=currentpage
  226. page_count=0
  227. totalrec=rs.recordcount
  228. while (not rs.eof) and (not page_count = 15)
  229. %>
  230.             
  231.             <tr class="tdbg"> 
  232.               <td width="38" align="center" class=forumrow><%=rs("id")%></td>
  233.               <%if request("action")="mb" then%>
  234.               <td width="15%" align="center" class=forumrow><%=rs("mbname")%></td>
  235.               <%end if%>
  236.               <td width="15%" align="center" class=forumrow><%=rs("sip1")%></td>
  237.               <td width="15%" align="center" class=forumrow><%=rs("sip2")%></td>
  238.               <td width="15%" align="center" class=forumrow><%=rs("why")%></td>
  239.               <td width="15%" align="center" class=forumrow><%=rs("tim")%></td>
  240.               <td width="15%" align="center" class=forumrow><%=rs("time")%></td>
  241.               <td width="5%" align="center" class=forumrow> 
  242.                 <span style="font-size: 9pt">
  243.                 <input type=checkbox name="delid" value="<%=cstr(rs("ID"))%>">
  244.                 <a href="?action=mod&id=<%=rs("id")%>">修改</a> </span></td>
  245.             </tr>
  246.             <%
  247. page_count = page_count + 1
  248. rs.movenext
  249. wend
  250. %>
  251.             <span style="font-size: 9pt"> </span> 
  252.             <tr> 
  253.               <td colspan=8 class=forumrow align=center width="846" height="18"> 
  254.                 <span style="font-size: 9pt">分页: 
  255.                 <%Pcount=rs.PageCount
  256. if currentpage > 4 then
  257. response.write "<a href=""?page=1"">[1]</a> ..."
  258. end if
  259. if Pcount>currentpage+3 then
  260. endpage=currentpage+3
  261. else
  262. endpage=Pcount
  263. end if
  264. for i=currentpage-3 to endpage
  265. if not i<1 then
  266. if i = clng(currentpage) then
  267.         response.write " <font color=red>["&i&"]</font>"
  268. else
  269.         response.write " <a href=""?page="&i&""">["&i&"]</a>"
  270. end if
  271. end if
  272. next
  273. if currentpage+3 < Pcount then 
  274. response.write "... <a href=""?page="&Pcount&""">["&Pcount&"]</a>"
  275. end if
  276. %>
  277.                 </span> </td>
  278.             </tr>
  279.             <%
  280. end if
  281. rs.close
  282. set rs=nothing
  283. %>
  284.             <span style="font-size: 9pt"> </span> 
  285.           </FORM>
  286.         </table>
  287. </div>
  288. <script language="JavaScript">
  289. <!--
  290. function CheckAll(form)  {
  291.   for (var i=0;i<form.elements.length;i++)    {
  292.     var e = form.elements[i];
  293.     if (e.name != 'chkall')       e.checked = form.chkall.checked; 
  294.    }
  295.   }
  296. //-->
  297. </script></form>
  298. <%
  299. if request("action")="mod" then
  300. id=request("id")
  301. sql="select * from goip where id="&id
  302. Set rs= Server.CreateObject("ADODB.Recordset")
  303. rs.open sql,conn,1,3
  304. %>
  305. <table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
  306.           <tr>
  307.     <td>
  308.              <table class="border" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  309.   <tr class="title"> 
  310.                 <tr> 
  311.                   <th height="22" colspan=3 class="title" >                    网吧IP管理--<span style="font-size: 9pt">修改</span></th>
  312.                 </tr>
  313.                 <form action="?action=mod1&reaction=save" method="post">
  314.                   <tr class="tdbg"> 
  315.                     <td width="17%" class=forumrow><div align="center"><span style="font-size: 9pt">网吧名称</span></div></td>
  316.                     <td colspan="2" class=forumrow><span style="font-size: 9pt"> 
  317.                       <input type="text" name="mbname" size="30" value="<%=rs("mbname")%>">
  318.                       <input name="id" type="hidden" id="id" value="<%=id%>">
  319.                     </span></td>
  320.                   </tr>
  321.                   <tr class="tdbg"> 
  322.                     <td width="17%" class=forumrow><div align="center"><span style="font-size: 9pt">起始I&nbsp;P</span></div></td>
  323.                     <td colspan="2" class=forumrow><span style="font-size: 9pt"> 
  324.                       <input type="text" name="ip1" size="30" value="<%=rs("sip1")%>">
  325.                     &nbsp;如202.96.0.0</span></td>
  326.                   </tr>
  327.                   <tr class="tdbg"> 
  328.                     <td width="17%" class=forumrow><div align="center"><span style="font-size: 9pt">结尾I&nbsp;P</span></div></td>
  329.                     <td colspan="2" class=forumrow><span style="font-size: 9pt"> 
  330.                       <input type="text" name="ip2" size="30" value="<%=rs("sip2")%>">
  331.                     &nbsp;如202.96.0.255</span></td>
  332.                   </tr>
  333.                   <tr class="tdbg"> 
  334.                     <td width="17%" class=forumrow><div align="center"><span style="font-size: 9pt">开始时间</span></div></td>
  335.                     <td width="23%" class=forumrow><span style="font-size: 9pt"> 
  336.                       <input name="starttime" type="text" id="starttime" value="<%=rs("tim")%>" size="15">
  337.                     </span></td>
  338.                     <td width="60%">结束时间
  339.                     <input name="endtime" type="text" id="endtime" value="<%=rs("time")%>" size="15"></td>
  340.                   </tr>
  341.                   <tr class="tdbg"> 
  342.                     <td width="17%" class=forumrow><div align="center"><font color="#FF0000">管理密码</font></div></td>
  343.                     <td colspan="2" class=forumrow> 
  344.                       <span style="font-size: 9pt">
  345. <input type="text" name="mbpass" size="30" value="<%=rs("mbpass")%>"></span></td>
  346.                   </tr>
  347.                   <tr class="tdbg"> 
  348.                     <td width="17%" class=forumrow><div align="center">授权说明</div></td>
  349.                     <td colspan="2" class=forumrow> 
  350.                       <span style="font-size: 9pt"> 
  351.                       <textarea rows="3" name="why" cols="28"><%=rs("why")%></textarea>
  352.                     </span></td>
  353.                   </tr>
  354.                   <tr class="tdbg"> 
  355.                     <td width="17%" class=forumrow></td>
  356.                     <td colspan="2" class=forumrow> <span style="font-size: 9pt"> 
  357.                     <input type="submit" name="Submit" value="提 交"> </td>
  358.                   </tr>
  359.                 </form>
  360.               </table></td>
  361.   </tr>
  362. </table>
  363. <%
  364. rs.close
  365. end if
  366. if request("action")="mod1" and request("reaction")="save" then
  367. id=request("id")
  368. sip=cstr(request.form("ip1"))
  369. 'dot=instr(ip,".")-1
  370. 'response.write dot
  371. str1=left(sip,cint(instr(sip,".")-1))
  372. sip=mid(sip,cint(instr(sip,"."))+1)
  373. str2=left(sip,cint(instr(sip,"."))-1)
  374. sip=mid(sip,cint(instr(sip,"."))+1)
  375. str3=left(sip,cint(instr(sip,"."))-1)
  376. str4=mid(sip,cint(instr(sip,"."))+1)
  377. num_1=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1
  378. mbname=cstr(request.form("mbname"))
  379. mbpass=cstr(request.form("mbpass"))
  380. data=cstr(request.form("data"))
  381. sip=cstr(request.form("ip2"))
  382. str1=left(sip,instr(sip,".")-1)
  383. sip=mid(sip,instr(sip,".")+1)
  384. str2=left(sip,instr(sip,".")-1)
  385. sip=mid(sip,instr(sip,".")+1)
  386. str3=left(sip,instr(sip,".")-1)
  387. str4=mid(sip,instr(sip,".")+1)
  388. num_2=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1
  389. 'response.write num_1 &","& num_2
  390. 'response.end
  391. set rs = server.CreateObject ("adodb.recordset")
  392. sql="select * from goip where id="&id
  393. rs.open sql,conn,1,3
  394. rs("ip1")=num_1
  395. rs("why")=trim(request.form("why"))
  396. rs("ip2")=num_2
  397. rs("sip1")=request.form("ip1")
  398. rs("sip2")=request.form("ip2")
  399. rs("mbname")=mbname
  400. rs("mbpass")=mbpass
  401. rs("tim")=request("starttime")
  402. rs("time")=request("endtime")
  403. rs.update
  404. rs.close
  405. set rs=nothing
  406. %>
  407.         <table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
  408.           <tr>
  409.             <td align="center"> <span style="font-size: 9pt">修改成功!</span></td>
  410.   </tr>
  411. </table>
  412. <%
  413. end if
  414. conn.close
  415. set conn=nothing
  416. end if
  417. end sub
  418. %>
  419. </BODY></HTML>