<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="checklogin.asp"-->
<%
dim currentpage,totalpage,totalnum,recpage,urls
recpage=10
dim BrandId,SerialId,infotypeid,title
if(request.QueryString("page")<>"") then
	currentpage=Clng(request.QueryString("page"))
else
	currentpage=1
end if
title=request.queryString("title")
title=replace(title,"'","")
urls="title="&title
%>
<html>
<head>
<title>汽车信息管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
}
form{margin:0px; padding:0px;}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/js/catalogs.js"></script>
<script type="text/javascript">
function goto(frm)
{	
	var gourl ="?<%=urls%>&";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	 
	window.location.href=gourl;
}
function checkint(elem)
{
  var checkOK = ".0123456789";
  var checkStr = elem.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
		ch = checkStr.charAt(i);
    	for (j = 0;  j < checkOK.length;  j++)
      	if (ch == checkOK.charAt(j))
        break;
    	if (j == checkOK.length)
    	{
      		allValid = false;
      		break;
    	}
  }
  if (!allValid)
  {
    	alert("只能输入数字。");
    	elem.focus();
    	return (false);
  }
  return (true);
}
</script>
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
.style4 {color: #000000}
.style5 {color: #000000; font-weight: bold; }
.red {
	color: #F00;
}
.padleft{ padding-left:10px;}
-->
</style>
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr>
    <td height="22" bgcolor="#FF9900"><div align="center"><span class="style1">◆ 信息管理 ◆</span></div></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
      <tr>
        <td width="15%" height="22" bgcolor="#F5F5F5"><div align="center">序号</div></td>
        <td width="41%" bgcolor="#F5F5F5"><div align="center">标题</div></td>
        <td width="15%" bgcolor="#F5F5F5" class="style4"><div align="center"><span class="dash_bottom">状态</span></div></td>
        <td width="11%" align="center" bgcolor="#F5F5F5">操作</td>
        <td width="11%" align="center" bgcolor="#F5F5F5"><span class="dash_bottom">日期</span></td>
    </tr>
	  <%
			dim sql,k
			k=1
			sql="select count(*) from news where username='com_"&checkusername&"'"
			set rs=server.CreateObject("adodb.recordset")
			rs.open sql,conn,3,1
			allrec=rs(0)
			rs.close
			set rs=nothing
			totalpage=int((allrec+recpage-1)/recpage)	
			sql="select top "&recpage&" id,title,pagepath,moditime,checked,linkurl from news where id <=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from news where username='com_"&checkusername&"'"
			sql=sql&" order by id desc) as t) and username='com_"&checkusername&"'"
			sql=sql&" order by id desc"
			set rs=server.CreateObject("adodb.recordset")
			'response.Write(sql)
			rs.open sql,conn,3,1
			while not rs.eof
			%>
      <tr>
        <td height="30" align="center" bgcolor="#FFFFFF"><%=recpage*(currentpage-1)+k%></td>
        <td align="left" bgcolor="#FFFFFF" class="padleft"><span class="padleft_10"><a href="<%if(rs(4)=0) then response.Write("news_show.asp?id="&rs(0)) else response.Write(rs(5)) end if%>"><%=rs(1)%></a></span></td>
        <td bgcolor="#FFFFFF"><div align="center">
        <%
				if(rs(4)=0) then
					response.Write("正在审核")
				elseif(rs(4)=1) then
					response.Write("正常")
				elseif(rs(4)=2) then
					response.Write("已删除")
				end if
				%>
        </div></td>
        <td align="center" bgcolor="#FFFFFF"><a href="news_del.asp?id=<%=rs(0)%>" onClick="return confirm('确认删除吗？')">删除</a></td>
        <td align="center" bgcolor="#FFFFFF"><%=rs(3)%></td>
      </tr>
	  <%
				rs.movenext
				k=k+1
			wend
			rs.close
			set rs=nothing
			%>
  </table>
<table width="100%" height="20"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
	<form name="form2" method="post" action="" style="margin:0 0 0 0">
      <div align="center">
<%
dim n,p
n=currentpage+1
p=currentpage-1
if p>0then
response.write("["&"<a href='?page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
else response.write("上一页&nbsp;&nbsp;&nbsp;")
end if 
if (n-1)*recpage>=allrec then 
response.write("下一页" )
else
response.Write("["&"<a href='?page="&cstr(n)&"'>下一页</a>]")
end if
response.write("&nbsp;共"&allrec&"条&nbsp;")
response.Write("&nbsp;共"&totalpage&"页&nbsp;")
response.Write("&nbsp;第"&currentpage&"页&nbsp;")
%>
            <input type="hidden" name="hid" value="<%=totalpage%>">
&nbsp;&nbsp;跳至
<input name="page" type="text" size="5" onKeyPress="if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" onChange="goto(this.form)" style="border:1px solid #000000;height:18px ">
          页
          <input type="button" name="Button22" value="Go->" style="font-size:12px ;border:1px solid #000000;height:18px ">
        </div>
    </form></td>
  </tr>
</table>
</body>
</html>
<%
call connclose()
%>
