<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="checklogin.asp"-->
<%
dim act,currentpage,totalpage,totalnum,recpage,urls,listtitle
recpage=20
act=request.QueryString("act")
if(act="del") then
	id=Clng(request.QueryString("id"))
	conn.execute("delete from t_favorite where id="&id&" and f_userid='"&checkusername&"'")
end if
dim areaid,infotypeid,roomtypeid,floorlevelid,housetype
if(request.QueryString("page")<>"") then
	currentpage=Clng(request.QueryString("page"))
else
	currentpage=1
end if

if(request.QueryString("areaid")<>"") then
	areaid=Clng(request.QueryString("areaid"))
else
	areaid=0
end if
if(request.QueryString("infotypeid")<>"") then
	infotypeid=Clng(request.QueryString("infotypeid"))
else
	infotypeid=0
end if
if(request.QueryString("roomtypeid")<>"") then
	roomtypeid=Clng(request.QueryString("roomtypeid"))
else
	roomtypeid=0
end if
if(request.QueryString("floorlevelid")<>"") then
	floorlevelid=Clng(request.QueryString("floorlevelid"))
else
	floorlevelid=0
end if
if(request.QueryString("housetype")<>"") then
	housetype=Clng(request.QueryString("housetype"))	
else
	housetype=0
end if
urls="areaid="&areaid&"&infotypeid="&infotypeid&"&roomtypeid="&roomtypeid&"&floorlevelid="&floorlevelid&"&housetype="&housetype
%>
<!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/member.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.width100{width:100%;}

-->
</style>
</head>

<body>
<!--#include file="top.asp"-->

<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="25" align="center"><h2 class="v1_right_h2">收藏管理</h2></td>
      </tr>
      <tr>
        <td height="3" bgcolor="#FE833F"></td>
      </tr>
    </table>
      <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="border_lrb">
        <tr>
          <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td>
              	<div class="br"></div>
              	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#eeeeee">
                    <tr>
                      <td width="9%" align="center" bgcolor="#F3F3F3">序号</td>
                      <td width="54%" height="24" bgcolor="#F3F3F3"><div align="center">标题</div></td>
                      <td width="20%" align="center" bgcolor="#F3F3F3">类别</td>
                      <td width="17%" align="center" bgcolor="#F3F3F3">操作</td>
                    </tr>
                    <%
										dim css
										sql="select count(*) from t_favorite where f_userid='"&checkusername&"'"
										if(infotypeid>0) then
											sql=sql&" and InfotypeId="&infotypeid
										end if
										set rs=server.CreateObject("adodb.recordset")
										rs.open sql,conn,3,1
										if not rs.eof then
											allrec=rs(0)
										else
											allrec=0
										end if
										rs.close
										set rs=nothing                    
                    totalpage=Cint((allrec-1+recpage)/recpage)
										sql="select top "&recpage&" id,f_title,f_url,f_type from t_favorite where id<=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from t_favorite where f_userid='"&checkusername&"'"
										if(infotypeid>0) then
											sql=sql&" and InfotypeId="&infotypeid
										end if
										sql=sql&" order by id desc) as c)"
										if(infotypeid>0) then
											sql=sql&" and InfotypeId="&infotypeid
										end if
										sql=sql&" and  f_userid='"&checkusername&"' order by id desc"
										'response.Write(sql)
										set rs=server.CreateObject("adodb.recordset")
										rs.open sql,conn,3,1
										if not rs.eof then
                    	listArr=rs.getrows()
									  end if
										rs.close
										set rs=nothing
                    if(isarray(listArr)) then
                      for j=0 to ubound(listArr,2)
												if(j<ubound(listArr,2)) then
													css=" class=""zj_td"""
												else
													css=" class=""zj_td2"""
												end if
                    %>
                    <tr>
                      <td align="center" bgcolor="#FFFFFF"<%=css%>><%=recpage*(currentpage-1)+j+1%></td>
                      <td height="25" bgcolor="#FFFFFF"<%=css%>><a href="<%=listArr(2,j)%>" target="_blank" class="orange"><%=listArr(1,j)%></a></td>
                      <td align="center" bgcolor="#FFFFFF"<%=css%>>
                      <%=listArr(3,j)%>
                      </td>
                      <td align="center" bgcolor="#FFFFFF"<%=css%>>
                      <div align="center"><a href="?act=del&id=<%=listArr(0,j)%>" onclick="return confirm('确认删除？')">删除</a>
                      </div>
                      </td>
                    </tr>
                    <%
                    next
                    end if
                    set listArr=nothing
                    %>
                </table></td>
            </tr>
          </table>
          </td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="32"><div align="center">
              <div class="page">
              <%
              dim n,p,startpage,endpage,j
              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("<a href=""?"&urls&"&page=1"">首页</a> ")
              if p>0then
                response.write("<a class=""number"" href=""?"&urls&"&page="&cstr(p)&""">&lt;&lt;</a> ")
              else 
                response.write("<a class=""number"" href=""#"">&lt;&lt;</a> ")
              end if 
              '''''''''''''''''
              for j=startpage to endpage
                  if(j=currentpage) then
                    response.write("<a class=""number hover"">"&j&"</a>")
                  else
                    response.write("<a class=""number"" href=""?"&urls&"&page="&j&""">"&j&"</a> ")
                  end if
                  if(j>(startPage+10)) then
                    exit for
                  end if
              next
              '''''''''''''''''''''''''''''''''''''
              if (n-1)*recpage>=Clng(totalnum) then 
                response.Write("<a class=""number"" href=""#"">&gt;&gt;</a> ")
              else
                response.Write("<a class=""number"" href=""?"&urls&"&page="&cstr(n)&""">&gt;&gt;</a> ")
              end if
              response.write(" <a href=""?"&urls&"&page="&totalpage&""">末页</a> ")
              response.Write(""&currentpage&"/"&totalpage&"页")
              %>
						</div>
          </div></td>
        </tr>
</table>
    
</body>
</html>
<%
call connclose()
%>