<!--#include file="../here99login/0.asp"--><!--#include file="../conn/zkconn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="/css/css.css" rel="stylesheet" type="text/css">
</head>
<body>
<form action="?add=yes" method="post" name="myform" id="form">
  注：每个页面只能推荐6个产品，超过6个产品，新添加产品将自动覆盖更新添加时间最早的产品 。 
  <table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
    <tr valign="middle"> 
      <td width="394" height="40" colspan="2" align="center" nowrap>产品ID 
        <input name="cpid" type="text" class="wenbenkuang" id="cpid" size="12" maxlength="20">
        显示页面 <select name="lbid" class="wenbenkuang" id="lbid">
          <option value="0" selected>首页</option>
          <% set rs2 = conn.execute("select * from lb order by lbid")
		  do while not rs2.eof%>
          <option value="<%=rs2("lbid")%>"><%=rs2("lbname")%></option>
          <%rs2.movenext
loop
%>
        </select> 
        <input name="Submit3" type="submit" class="go-wenbenkuang" value="OK,添加">
      </td>
    </tr>
  </table>
</form>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  <tr align="center" bgcolor="#f1f1f1"> 
    <td width="75" height="20" align="center" valign="middle">产品ID</td>
    <td height="20">产品名称</td>
    <td width="100" height="20" align="center" valign="middle">显示页面</td>
    <td width="75" height="20" valign="middle">删除</td>
  </tr>
<%
if request("add")="yes" and request("cpid")<>"" then
set rstui = conn.execute("select * from tui where lbid="&request("lbid")&"")
set rs = conn.execute("select * from chanpin where id="&request("cpid")&"")
if rstui.eof or rstui.RecordCount<6 then
conn.execute("Insert into tui(cpid,mc,xt,lbid)values("&request("cpid")&",'"&rs("mc")&"','"&rs("xt")&"',"&request("lbid")&")")
else
set rstui2 = conn.execute("select * from tui where lbid="&request("lbid")&" order by sj")
id=rstui2("id")
rstui2.close
set rstui2=nothing
conn.execute("Update tui set cpid="&request("cpid")&",mc='"&rs("mc")&"',xt='"&rs("xt")&"',lbid="&request("lbid")&",sj='"&now()&"' where id="&id&"")
end if
rstui.close
set rstui=nothing
rs.close
end if
if request("del")="yes" then
conn.execute("Delete tui where id="&request("id")&"")
end if
Set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from tui order by sj desc"
rs.open sql,conn,3,1 
rs.pagesize = 15
if request("page")=""  or isempty(request("page")) then
page = 1
else
page=int(request("page"))
end if
if page>rs.pagecount then
page=rs.pagecount
end if
if not rs.BOF then
Rs.Move Rs.PageSize*(page-1)
end if
i=1
do while not rs.eof and i<=rs.pagesize
%>
  <tr bgcolor="#FFFFFF"> 
    <td width="75" height="20" align="center" valign="middle"><%=rs("cpid")%></td>
    <td height="20" valign="middle"><%=rs("mc")%></td>
    <td width="100" height="20" align="center" valign="middle"><%
	if rs("lbid")="0" then
	Response.Write("首页")
	else
	set rslb = conn.execute("select lbname from lb where lbid="&rs("lbid")&"")
	Response.Write(""&rslb("lbname")&"")
	rslb.close
	end if%></td>
    <td width="75" height="20" align="center" valign="middle"><a href="?del=yes&id=<%=rs("id")%>">删除</a></td>
  </tr><%
i=i+1
 rs.MoveNext                                              
 loop 
%>
  <tr bgcolor="#FFFFFF"><form name=form method=get action=?><td height="20" colspan="4" align="center" valign="middle">
<%
if rs.recordcount<>0 then
if page-1 mod 10=0 then
		p=(page-1) \ 10
	else
		p=(page-1) \ 10
	end if

	response.write "页次："& page &"/"& rs.pagecount &"页 每页"& rs.pagesize &" 共"& rs.recordcount &"条记录"&_
					" 分页："

	if p*10>0 then response.write "<a href='?page="&p*10&"' title=上十页>[&lt;&lt;]</a>   "
    uming_i=1
	for ii=p*10+1 to P*10+10
		   if ii=page then
	          response.write "<font color=#ff0000>["+Cstr(ii)+"]</font> "
		   else
		      response.write "<a href='?page="&ii&"'>["+Cstr(ii)+"]</a>   "
		   end if
		if ii=rs.pagecount then exit for
		 uming_i=uming_i+1
	next
	if ii<=rs.pagecount and uming_i=11 then response.write "<a href='?page="&ii&"' title=下十页>[&gt;&gt;]</a>   "
response.write(" 　跳页：<input type=text name=page size=2 maxlength=3 class=wenbenkuang> <input type=submit name=Submit value=Go class=go-wenbenkuang>")
end if
rs.close
set rs=nothing%>
</td></form>
  </tr>
</table>
</body>
</html>