<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/function.asp"-->
<!--#include file="checklogin.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>管理我的分类信息</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.width100{width:100%;}

-->
</style>
</head>

<body>
<!--#include file="top.asp"-->
<%
dim sql,csql,totalpage,totalnum,pagesizes,currentpage,carr,j,infotype
if(request.QueryString("page")<>"") then
	currentpage=Clng(request.QueryString("page"))
else
	currentpage=1
end if
pagesizes=15
if(request.QueryString("infotype")<>"") then
	infotype=Cint(request.QueryString("infotype"))
else
	infotype=0
end if
sql="select top "&pagesizes&" t_info.id as tid,t_info.Title as gtitle,t_info.Province,City,Price,PubDate,t_info.SavePath,catalogs.Title as ititle,t_info.IsCheck,Color from t_info,catalogs where t_info.id<=(select min(id) from (select top "&((currentpage-1)*pagesizes+1)&" id from t_info where UserId='"&checkusername&"' order by id desc) as t) and t_info.CatalogId=catalogs.id and t_info.UserId='"&checkusername&"' order by t_info.id desc"
csql="select count(*) from t_info where UserId='"&checkusername&"'"
'response.Write(sql)
totalnum=conn.execute(csql)(0)
totalpage=int((totalnum-1+pagesizes)/pagesizes)
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,3,1
if not rs.eof then
	carr=rs.GetRows()
end if
rs.close
set rs=nothing
%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
  <tr>
    <td height="28" colspan="7" class="th_title">管理我的分类信息</td>
  </tr>
  <tr>
    <td width="34%" class="td_row"><strong>标题</strong></td>
    <td width="8%" align="center" class="td_row"><strong>价格</strong></td>
    <td width="11%" align="center" class="td_row"><strong>类别</strong></td>
    <td width="10%" align="center" class="td_row"><strong>地区</strong></td>
    <td width="12%" align="center" class="td_row"><strong>更新日期</strong></td>
    <td width="10%" align="center" class="td_row"><strong>审核状态</strong></td>
    <td width="15%" align="center" class="td_row"><strong>操作</strong></td>
  </tr>
  <%
  if(isarray(carr)) then
	for j=0 to ubound(carr,2)
  %>
  <tr>
    <td class="td_row"><%=(currentpage-1)*pagesizes+j+1%> <a href="../show.asp?id=<%=carr(0,j)%>" target="_blank" style="color:<%=carr(9,j)%>"><%=carr(1,j)%></a></td>
    <td align="center" class="td_row"><%=carr(4,j)%></td>
    <td align="center" class="td_row"><%=carr(7,j)%></td>
    <td align="center" class="td_row"><%=carr(2,j)%>-<%=carr(3,j)%></td>
    <td align="center" class="td_row"><%=carr(5,j)%></td>
    <td align="center" class="td_row">
    <%
		if(carr(8,j)=0) then
			response.Write("正在审核")
		else
			response.Write("<span style=""color:red;"">已审</span>")
		end if
		%>
    </td>
    <td align="center" class="td_row"><a href="info_del.asp?id=<%=carr(0,j)%>" onclick="return confirm('确认删除？')">删除 </a> &nbsp; <a href="info_mod.asp?id=<%=carr(0,j)%>">修改</a></td>
  </tr>
  <%
	next
  else
	response.Write("<tr><td colspan=""5"">暂时没有记录</td></tr>")
  end if
  set carr=nothing
  %>
  <tr>
    <td colspan="7" class="td_row">
	<div align="center">
	<%
	dim n,p,startpage,endpage
	n=currentpage+1
	p=currentpage-1
	startpage=currentpage-5
	if(startpage<=0) then
		startpage=1
	end if
	endpage=currentpage+5
	if(endpage>totalpage) then
		endpage=totalpage
	end if
	response.write("&nbsp;共"&totalnum&"条&nbsp;")
	if p>0then
		response.write("["&"<a href='?infotype="&infotype&"&page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
	else 
		response.write("上一页&nbsp;&nbsp;&nbsp;")
	end if 
	'''''''''''''''''
	for j=startpage to endpage
			if(j=currentpage) then
				response.write(j&"&nbsp;")
			else
				response.write("<a href=""?infotype="&infotype&"&page="&j&""">["&j&"]</a>&nbsp;")
			end if
			if(j>(startPage+10)) then
				exit for
			end if
	next
	'''''''''''''''''''''''''''''''''''''
	if currentpage>=totalpage then 
		response.write("下一页" )
	else
		response.Write("["&"<a href='?infotype="&infotype&"&page="&cstr(n)&"'>下一页</a>]")
	end if
	response.Write("&nbsp;共"&totalpage&"页&nbsp;")
	response.Write("&nbsp;第"&currentpage&"页&nbsp;")
	%>              
	</div>	</td>
  </tr>  
</table>
<div style="line-height:22px; text-align:center;">提示：信息只要发布一次就可以，如果希望信息排列到最前面，只要点击一下“更新”，系统根据时间排序也就是最新“更新”的信息自动排列最前。</div>
</body>
</html>
<%
call connclose()
%>