<!--#include file=../conn.asp-->
<!-- #include file="inc/const.asp" -->
<%Head()
	dim admin_flag
	admin_flag=",8,"
	if not master or instr(","&session("flag")&",",admin_flag)=0 then
		Errmsg=ErrMsg + "<BR><li>本页面为管理员专用，请<a href=../"&LoginUrl&" target=_top>登录</a>后进入。<br><li>您没有管理本页面的权限。"
		Call Ms_error()
	End If
		Main(1)
		if Request("action")="list" then
		call search()
		elseif Request("action")="Toset" then
		call Toset()
		else
		call sindex()
		end if
		Main(0)
		Footer()

sub main(Str)
if Str=1 then%>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
<tr> 
<th height="23" colspan="8" class="tableHeaderText">二级域名管理中心</th>
</tr>
<tr>
<td height="25" colspan="1" class="forumrow">说明事项：
</td>
<td height="25" colspan="7" class="forumrow">1、二级域名开启请到基本设置中设置；<br>
2、点号二级域名，需要域名支持泛域名，请与服务商联系；<br>
3、二级域名删除操作不可逆；<br>
4、域名支持隐藏解析，服务器必须支持XMlhttp。
</td>
</tr>
<tr>
<td height="25" colspan="1" class="forumrow">快捷方式
</td>
<td height="25" colspan="7" class="forumrow"><a href=Freeurl.asp>管理首页</a> | <a href=?action=list&t=1>所有域名</a> | <a href=?action=list&t=2>最新100</a> | <a href=?action=list&t=3>人气100</a> | <a href=?action=list&t=4>隐藏解析</a>
</td>
</tr>
<%
	Else
%>
</table>
<p></p>
<%end if
end sub

sub sindex()''搜索表单%>
<form action="?action=list" method=post>
<input type=hidden name="t" value="5"> 
<tr>
<th align=left colspan=8 height=23>高级查询</th>
</tr>
<tr>
<td width=20% class=forumrow>注意事项</td>
<td width=80% class=forumrow colspan=7>在记录很多的情况下搜索条件越多查询越慢，请尽量减少查询条件</td>
</tr>
<tr>
<td width=20% class=forumrow>会员姓名</td>
<td width=80% class=forumrow colspan=7><input name="username" type="text" size="20">&nbsp;<input type=checkbox name="like" value="1" checked>
      完整匹配</td>
</tr>
<tr>
<td width=20% class=forumrow>二级域名</td>
<td width=80% class=forumrow colspan=7><input name="Freeurl" type="text" size="20"></td>
</tr>
<tr>
<td width=100% class=forumrow align=center colspan=8><input name="submit" type=submit value="   搜  索   "></td>
</tr>
</form>
<%
End Sub

sub search()''搜索列表
strFileName="Freeurl.asp?action="&Request("action") & "&t="&request("t")&"&username="&request("Username")&"&Freeurl="&request("Freeurl")&"&like="&request("like")&""
call tumppages()
dim sql
sql= " id,Username,Urlname,Urlms,Dayclick,Click,Addtime "
%>
<tr>
<th colspan=8 align=left height=23>搜索结果</th>
</tr>
<FORM METHOD=POST ACTION="?action=ToSet">
<tr align=center height=23>
<td class=forumRowHighlight width="20%"><B>用户名</B></td>
<td class=forumRowHighlight width="10%"><B>申请ID</B></td>
<td class=forumRowHighlight width="20%"><B>主机头</B></td>
<td class=forumRowHighlight width="10%"><B>隐藏</B></td>
<td class=forumRowHighlight width="8%"><B>点击</B></td>
<td class=forumRowHighlight width="10%"><B>今日点击</B></td>
<td class=forumRowHighlight width="15%"><B>申请时间</B></td>
<td class=forumRowHighlight><B>操作</B></td>
</tr>
<%dim sqlstr
set rs=server.createobject("adodb.recordset")
Select Case Request("t")
	Case 1
		Sql = "SELECT " & sql & " from Ms_host ORDER BY ID DESC"
	Case 2
		Sql = "SELECT top 100 " & sql & " from Ms_host ORDER BY ID DESC"
	case 3
		sql="select top 100 " & sql & " from Ms_host order by Click desc"
	case 4
		sql="select top 100 " & sql & " from Ms_host where Urlms=1 order by id desc"
	case 5
	sqlstr=""
	if request("username")<>"" then
			if request("like")=1 then
			sqlstr=" username='"&request("username")&"'"
			else
			sqlstr=" username like '%"&request("username")&"%'"
			end if
		end if
		if request("Freeurl")<>"" then
			if sqlstr<>"" then
			sqlstr=sqlstr & " and Urlname like '%"&request("Freeurl")&"%'"
			else
			sqlstr=" Urlname like '%"&request("Freeurl")&"%'"
			end if
		end if
		sql="select " & sql & " from Ms_host where "&sqlstr&" order by id desc"
	case else
		Response.Write "<tr><td colspan=8 class=forumrow>错误的参数。</td></tr>"
		Response.End
	End Select
rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
call rspages()
do while not rs.eof and page_count<Cint(MaxPerPage)%>
<tr>
<td class=forumrow align="center"><a href="admin_user.asp?action=modify&username=<%=rs(1)%>"><%=rs(1)%></a></td>
<td class=forumrow align="center"><%=rs(0)%></td>
<td class=forumrow align=left><a href=http://<%=rs(2)%><%=WebUrl%>><%=rs(2)%></a></td>
<td class=forumrow align=center><%if rs(3)=1 then
response.Write("隐藏")
else
response.Write("正常")
end if%></td>
<td class=forumrow align=center><%=rs(5)%></td>
<td class=forumrow align=center><%=rs(4)%></td>
<td class=forumrow align=center><%=rs(6)%>
</td>
<td class=forumrow align=center><input type="checkbox" name="id" value="<%=rs(0)%>"></td>
</tr>
<%page_count=page_count+1
  rs.movenext
  loop
  end if
  
 if totalrec>0 then %>
    <tr align="center"> 
      <td height="24" colspan="8" class=forumrow> <%
		  	call showpage(strFileName)
		  %></td>
    </tr>
	<%end if%>
<tr align="center"> 
      <td height="24" colspan="8" class=forumrow><input type="radio" name="paction" value=1>删除记录
	  
全部选定<input type=checkbox value="on" name="chkall" onclick="CheckAll(this.form)"></td>
    </tr>
	<tr align="center"> 
      <td height="24" colspan="8" class=forumRowHighlight><input type=submit name=submit value="执行操作"  onclick="{if(confirm('确定执行操作吗?')){return true;}return false;}"></td>
    </tr>
</form>
<%end sub

sub ToSet()''批量操作
dim delid,fixid
response.write "<tr><th colspan=8 height=23 align=left>执行结果</th></tr>"
	if request("paction")="" then
		response.write "<tr><td colspan=8 class=forumrow>请指定相关参数。</td></tr>"
		founderr=true
	end if
	delid=replace(request.form("id"),"'","")
	delid=replace(delid,";","")
	delid=replace(delid,"--","")
	delid=replace(delid,")","")
	fixid=replace(delid,",","")
	fixid=Trim(replace(fixid," ",""))
	if not founderr then
		if request("paction")=1 then''删除操作
				Conn.Execute("delete from Ms_host where id in ("&delid&")")
				response.write "<tr><td colspan=8 class=forumrow>删除记录成功。</td></tr>"
		else
			response.write "<tr><td colspan=8 class=forumrow>错误的参数。</td></tr>"
		end if
		end if
end sub
%>