<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("agentusername")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
end if
if not ef then%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html5")%>订单管理
<%=htmlwrite("html6")%><br>

<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0>
  <TBODY>
    <TR>
      <TD height="300" align="center" vAlign=top bgcolor="#FFFFFF"><%
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set dsph = Server.CreateObject("ADODB.Recordset")
SQL="Select * from FreeHost.FreeHost_Order where "
if Request.QueryString ("status")<>"" then
Sql=Sql+" status = '"&trim(Request.QueryString ("status"))&"' and "
end if
if Request.QueryString ("starttime") <>"" then  Sql=Sql+" starttime>'"&Request.QUERYSTRING ("starttime")&"' and "
if Request.QueryString ("endtime") <>"" then  Sql=Sql+" and endtime<'"&Request.QUERYSTRING ("endtime")&"' and "
if right(sql,5)=" and " then sql=left(sql,len(sql)-5)&" and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') order by id desc"
if right(SQL,6)="where " then  SQL="Select * from FreeHost.FreeHost_Order where (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') order by id desc"

'Response.Write sql
	if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsph.PageSize = 25
        dsph.Open Sql,conn,1,1
if not dsph.eof then
if Request.ServerVariables("QUERY_STRING")<>"" then
ask=Split(Request.ServerVariables("QUERY_STRING"), chr(38)&"pn")
else
ask=Split("freehost=1", "")
ask(0)="freehost=lsoft"
end if
	pn=1
if Request.QueryString ("pn")<>"" then pn=Request.QueryString ("pn")
If dsph.RecordCount <> 0 Then dsph.AbsolutePage = CLng(pn)  
    if clng(pn)<=10 then
    begini=1
      if dsph.PageCount<=10 then
       endini=dsph.PageCount 
       else
       endini=10
      end if
    end if
%>
          <%if clng(pn)<=10 then%>
          最新
          <%for i=begini to endini
    if clng(pn)=i then%>
          <font color=red>[<%=i%>]</font>
          <%else%>
          <a href="?<%=ask(0)%>&pn=<%=i%>"><font color="#000000">[<%=i%>]</font></a>
          <%end if%>
          　
          <%next%>
          <%else%>
          　
          <a href="?<%=ask(0)%>&pn=1"><font color="#000000">最新[1]--[10]</font></a>　　现在是第<font color=red>[<%=pn%>]</font>页 　共<%=dsph.PageCount%>页　
                <%end if%>
                <%If Clng(pn)>1 Then%>
                <a href="?<%=ask(0)%>&pn=<%=pn-1%>">上一页</a>
                <%End If%>
                |
                <%If Clng(pn)<dsph.PageCount Then%>
                <a href="?<%=ask(0)%>&pn=<%=pn+1%>">下一页</a>
                <%End If%>
                <a href="admorder.asp?starttime=<%=formatdatetime(now,2)%>"><font color="#000000">今天新订单</font></a> | <a href="admorder.asp?starttime=<%=formatdatetime(dateadd("d",-7,now),2)%>"><font color="#000000">一周新订单</font></a> | <a href="admorder.asp?status=未处理&starttime=<%=formatdatetime(now,2)%>"><font color="#000000">一周未完成订单</font></a> | <a href="admorder.asp?status=未处理&starttime=<%=formatdatetime(dateadd("d",-7,now),2)%>"><font color="#000000">30天未完成订单</font></a>
                <DIV class="tableborder">
                  <table width="100%" border="0" cellspacing="1" cellpadding="2" align="center">
                    <tr bgcolor="#C1BFBF" align="center">
                      <td width="40" height="24" background="img/tablebg.gif"><font color="#FFFFFF">编号</font></td>
                      <td background="img/tablebg.gif"><font color="#FFFFFF">内容</font></td>
                      <td width="50" height="24" background="img/tablebg.gif"><font color="#FFFFFF">用户名</font></td>
                      <td height="24" background="img/tablebg.gif"><font color="#FFFFFF">用户提交的信息</font></td>
                      <td width="80" height="24" background="img/tablebg.gif"><font color="#FFFFFF">时间</font></td>
                      <td width="80" height="24" background="img/tablebg.gif"><font color="#FFFFFF">状态</font></td>
                      <td width="80" height="24" background="img/tablebg.gif"><font color="#FFFFFF">操作</font></td>
                    </tr>
                    <%
For N=1 To dsph.PageSize 
					If dsph.RecordCount=0 Then Exit For
%>
                    <%Hosttype=dsph("Hosttype")&dsph("Emailtype")&dsph("SQLtype")&dsph("Othertype")%>
                    <tr align="center" bgcolor="#E4EAF2" title="<%=dsph("site")%>：<%=dsph("regip")%> 用户信息：<%=replace(dsph("truename"),"""","“")%> 内部信息：<%=dsph("coreinfo")%>">
                      <td width="40"><%=dsph("id")%></td>
                      <td><%=Hosttype%></td>
                      <td width="50" height="30"><a href="searchuser.asp?username=<%=dsph("username")%>" target="_blank"><%=dsph("username")%></a>
                          <%if dsph("agent1")<>"n" then%>
                          (<a href="searchagent.asp?username=<%=dsph("agent1")%>" target="_blank"><font color="blue"><%=dsph("agent1")%></font></a>)
                          <%end if%></td>
                      <td><%=dsph("userremindinfo")%></td>
                      <td width="80" bgcolor="#E4EAF2"><%=dsph("starttime")%></td>
                      <td width="80"><%=dsph("status")%></td>
                      <td width="80"><a href="handorder1.asp?username=<%=dsph("username")%>&id=<%=dsph("id")%>"><font color="#000000">管理</font></a></td>
                    </tr>
                    <%
If clng(pn)=dsph.PageCount Then
I = dsph.RecordCount - (dsph.PageCount-1) * dsph.PageSize
If N=I Then Exit For
End If
dsph.movenext
Next%>
                  </table>
                </div>
                <%dsph.close
set dsph=nothing
else%>
                <DIV class="tableborder"><br>
                    <br>
          没有相关的记录。<br>
          <br>
                </div>
                <%end if%>
                <br>
      </TD>
    </TR>
  </TBODY>
</TABLE>
<%=htmlwrite("html7")%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
