📄 shop_list.asp
字号:
<%@ codepage ="936" %>
<!--#include file="conn.asp"-->
<!--#include file="checkuser.asp"-->
<%
const MaxPerPage=10
dim totalPut
dim CurrentPage
dim TotalPages
dim i
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
dim sql
dim rs
if request("act")="del" then
'sql="delete * from Product where shop_id="&request("shop_id") '不支持FSO
'conn.execute sql'不支持FSO
'response.redirect "shop_list.asp" '不支持FSO
'支持FSO
set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from Product where shop_id="&request("shop_id")
rs.open sql,conn,3,3
pic_url=rs("pic")
pic2_url=rs("pic2")
if pic_url<>"" then
whichfile=Server.MapPath("../pic/"&pic_url&"")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.GetFile(whichfile)
f1.delete
end if
if pic2_url<>"" then
whichfile=Server.MapPath("../pic/"&pic2_url&"")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f2 = fso.GetFile(whichfile)
f2.delete
end if
rs.delete
rs.close
response.Redirect("shop_list.asp")
end if
if request("act")="audit" then
sql="update product set audit=1 where shop_id="&request("shop_id")
conn.execute sql
response.redirect "shop_list.asp"
end if
if request("act")="noaudit" then
sql="update product set audit=0 where shop_id="&request("shop_id")
conn.execute sql
response.redirect "shop_list.asp"
end if
sql="select * from product order by dateandtime desc"
set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<script language='javascript'>alert('您还没有发布产品信息,请发布!');this.location.href='shop_add.asp';</SCRIPT>"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"shop_list.asp"
content
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"shop_list.asp"
content
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"shop_list.asp"
content
end if
end if
end if
conn.close
set conn=nothing
sub showContent
%>
<html>
<head>
<link rel="stylesheet" href="../style.css" type="text/css">
</head>
<BODY text=#000000 bgcolor="#FFFFFF">
<table border="0" cellspacing="1" width="600" bgcolor="#CCCCCC" cellpadding="3" align="center">
<tr>
<td bgcolor="#eeeeee" colspan="2" height="30" > <b><font size="2" color="#FF0000"><img src="IMAGES/bul_arrowGrnSm.gif" width="12" height="12">
产 品 管 理</font></b></td>
</tr>
<%do while not rs.eof%>
<tr>
<td bgcolor="#FFFFFF" width="101" >
<div align="center"></div>
</td>
<td width="476" bgcolor="#eeeeee" > </td>
</tr>
<tr>
<td bgcolor="#FFFFFF" rowspan="3" ><a target="_blank" href="../List.asp?shop_id=<%=rs("shop_id")%>"><img border=0 src="<%if rs("PIC")<>"" then%>../pic/<%=rs("pic")%><%else%>../pic/no.jpg<%end if%>" width="100" height="75" alt="<%=rs("shop_name")%>" ></a></td>
<td width="476" bgcolor="#FFFFFF" >产品名称:<a href="../show.asp?shop_id=<%=rs("shop_id")%>"><%=rs("shop_name")%></a></td>
</tr>
<tr>
<td width="476" bgcolor="#FFFFFF" >产品简介:</td>
</tr>
<tr>
<td width="476" bgcolor="#FFFFFF" ><%=mid(rs("introduce"),1,22)%>... </td>
</tr>
<tr>
<td colspan="3" height="1" align="right" bgcolor="#FFFFFF">
<%if rs("audit")=0 then%>
<a href="?act=audit&shop_id=<%=rs("shop_id")%>"><span class="style1">设为推荐</span></a>
<%else%>
<a href="?act=noaudit&shop_id=<%=rs("shop_id")%>"><span class="style2">取消推荐</span></a>
<%end if%>
<a href="shop_edit.asp?shop_id=<%=rs("shop_id")%>&page=<%=request("page")%>">
<img src="IMAGES/Edit_2.gif" width="47" height="18" border="0"></a><a href="?shop_id=<%=rs("shop_id")%>&act=del"><img src="IMAGES/A_delete.gif" width="52" height="16" border="0"></a></td>
</tr>
<% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
rs.close
set rs=nothing
%>
</table>
<table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="center" height="60">
<%
end sub
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<form method=Post action="&filename&"gsid="&gsid&">"
if CurrentPage<2 then
response.write "<table border=0 width=100% cellspacing=2 cellpadding=2>"
response.write "<tr height=0>"
response.write "<td align=left valign=top>"
response.write "<font color=red><b>共"&n&"页 第"&CurrentPage&"页 "
response.write "共查询到 "&totalnumber&" 个产品</b></font>"
response.write "</td>"
response.write "<td VALIGN=middle align=right >"
response.write "【最前页】【上一页】"
else
response.write "<table border=0 width=100% cellspacing=2 cellpadding=2>"
response.write "<tr height=0>"
response.write "<td align=left VALIGN=top>"
response.write "<font color=red><b>共"&n&"页 第"&CurrentPage&"页 "
response.write "共查询到 "&totalnumber&" 个产品</b></font>"
response.write "</td>"
response.write "<td VALIGN=center align=right >"
response.write "【<a href="&filename&"?page=1&gsid="&gsid&">最前页</a>】"
response.write "【<a href="&filename&"?page="&CurrentPage-1&"&gsid="&gsid&">上一页</a>】"
end if
if n-currentpage<1 then
response.write "【下一页】【最后页】</font>"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&gsid="&gsid&">"
response.write "【下一页</a>】【 <a href="&filename&"?page="&n&"&gsid="&gsid&">最后页</a>】"
end if
response.write "</form>"
response.write "</td>"
response.write "</tr>"
response.write "</table>"
end function
%>
<%sub content%>
<%end sub%>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -