📄 product_check.asp
字号:
<%@ language="vbscript"%>
<%response.Expires = 0%>
<!--#include file="conn.asp"-->
<!--#include file="check_user.asp"-->
<%
P_shop=request.cookies("sp_name")
%>
<html>
<head>
<STYLE>BODY {
FONT-SIZE: 10pt
}
TD {
FONT-SIZE: 10pt; LINE-HEIGHT: 150%
}
A {
TEXT-DECORATION: none
}
A:hover {
TEXT-DECORATION: underline
}
</STYLE>
<script language="javascript">
function confirmdel(id,page){
if (confirm("真的要删除这件产品吗?"))
window.location.href="../test.htm?id="+id+"&page="+page
}
</script>
<title>后台管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body background="../pic/user/bg.jpg">
<%
set rs=server.createobject("adodb.recordset")
up=request("up")
select case up
case "search"
sqltext="select * from Product where p_shop='" &P_shop & "' and Product_Name like '%"& request.form("Product_Name") &"%' order by id desc"
case "newpinglun"
sqltext="select * from Product where p_shop='" &P_shop & "' and pingji>0 order by pingji_time desc"
case "newprice"
sqltext="select * from Product where p_shop='" &P_shop & "'order by P_newprice desc"
case "Look"
sqltext="select * from Product where p_shop='" &P_shop & "'order by Look_Count desc"
case else
sqltext="select * from Product where p_shop='" &P_shop & "'order by id desc"
end select
rs.open sqltext,conn,1,1
dim MaxPerPage
MaxPerPage=14
'假如没有数据时
If rs.eof and rs.bof then
response.write "<p align='center'><font color='#ff0000'>你还没任何商品资料,请点击“商品添加”后按照提示添加新商品</font></p>"
End if
'取得页数,并判断用户输入的是否数字类型的数据,如不是将以第一页显示
text="0123456789"
Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next
If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if
call list
call showpages
'显示帖子的子程序
Sub list()
%>
<table width="94%" border="0" align="center" cellpadding="2" cellspacing="3">
<form name="form1" method="post" action="product_check.asp?up=search">
<tr>
<td width="371" bgcolor="#AAEEFF">商品排序:<a href="product_check.asp?up=newadd">按最新添加</a> <a href="product_check.asp?up=newpinglun">按最新评论</a> <a href="product_check.asp?up=newprice">按会员价</a> <a href="product_check.asp?up=Look">按访问数</a></td>
<td width="210" bgcolor="#AAEEFF"><div align="center">
<input name="Product_Name" type="text" size="15" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-RIGHT: #666666 1px solid; BORDER-TOP: #666666 1px solid; FONT-SIZE: 9pt">
<input name="Submit14" src style="BACKGROUND-COLOR: #00CCFF; BORDER-BOTTOM: #00CCFF 1px solid; BORDER-LEFT: #00CCFF 1px solid; BORDER-RIGHT: #00CCFF 1px solid; BORDER-TOP: #00CCFF 1px solid; COLOR: #FFFFFF; HEIGHT: 18px" type="submit" value="商品搜索">
</div></td>
</tr>
</form>
</table>
<table width="94%" border="0" align="center" cellpadding="0" cellspacing="3">
<tr class=main1 bgcolor="#00CCFF">
<td width="213" align="center" bgcolor="#00CCFF"><font color="#FFFFFF">商 品 名 称</font></td>
<td width="49" align="center"><font color="#FFFFFF">会员价</font></td>
<td width="49" align="center"><font color="#FFFFFF">市场价</font></td>
<td width="49" align="center"><font color="#FFFFFF">访问数</font></td>
<td width="49" align="center"><font color="#FFFFFF">操 作</font></td>
<td width="49" align="center"><font color="#FFFFFF">推 荐</font></td>
<td width="49" align="center"><font color="#FFFFFF">评 论</font></td>
<td width="56" align="center"><font color="#FFFFFF">删 除</font></td>
</tr>
<%
if not rs.eof then
i=0
do while not rs.eof
%>
<tr class=main1 bgcolor="#EEEEEE">
<td align="center"><a href="../<%=P_shop%>/default.asp?sb=product&Product_id=<%=rs("Product_id")%>" target="_blank"><%=rs("Product_Name")%></a></td>
<td align="center"><%=rs("P_newprice")%></td>
<td align="center"><%=rs("P_oldprice")%></td>
<td align="center"><%=rs("Look_Count")%></td>
<td align="center">
<%response.write "<a href='product_update.asp?ID="&rs("Product_id")&"&page="&CurrentPage&"'><font color=#0000FF>编辑</font></a>"
%>
</td>
<td align="center">
<%
if rs("tuijian")=0 then
response.write "<a href='product_tuijian.asp?tuijian=1&Product_id="&rs("Product_id")&"&page="&CurrentPage&"'><font color=#0000FF> / </font></a>"
else
response.write "<a href='product_tuijian.asp?tuijian=0&Product_id="&rs("Product_id")&"&page="&CurrentPage&"'><font color=#FF0000>推荐</font></a>"
end if
%>
</td>
<td align="center">
<%if rs("pingji")>0 then
response.write "<a href='PingLun.asp?Product_id="&rs("Product_id")&"&Product_name="&rs("Product_name")&"'><font color=#FF0000>管理</font></a>"
else
response.write "<a href='PingLun.asp?Product_id="&rs("Product_id")&"&Product_name="&rs("Product_name")&"'><font color=#0000FF>无</font></a>"
end if
%>
</td>
<td align="center">
<%response.write "<a href='javascript:confirmdel(" & rs("Product_id") & ","& CurrentPage&")'><font color=#0000FF>删除</font></a>" %>
</td>
</tr>
<%
i=i+1
if i >= MaxPerpage then exit do
rs.movenext
loop
end if
%>
</table>
<%
End sub
%>
<%
'显示翻页的子程序
sub showpages()%>
<table border="0" cellPadding="0" cellSpacing="0" width="94%" align="center" >
<form method=Post action='product_check.asp'>
<tr>
<td>
<table border="0" cellPadding="0" cellSpacing="3" width="100%" align="center">
<tr>
<td class=main1 bgcolor="#AAEEFF">
<p align="center">
<%
If currentpage > 1 Then
response.write "<a href='product_check.asp?up="+up+"&page="+cstr(1)+"'>首页</a><font color='#ffffff'><b>-</b></font>"
Response.write "<a href='product_check.asp?up="+up+"&page="+Cstr(currentpage-1)+"'>前页</a><font color='#ffffff'><b>-</b></font>"
Else
Response.write "首页<font color='#ffffff'><b>-</b></font>"
Response.write "前页<font color='#ffffff'><b>-</b></font>"
End if
If currentpage < Rs.PageCount Then
Response.write "<a href='product_check.asp?up="+up+"&page="+Cstr(currentPage+1)+"'>后页</a><font color='#ffffff'><b>-</b></font>"
Response.write "<a href='product_check.asp?up="+up+"&page="+Cstr(Rs.PageCount)+"'>尾页</a> "
Else
Response.write "后页-"
Response.write "尾页 "
End if
Response.write "页次:" & "<font color=#FF0000>" & Cstr(CurrentPage) & "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "</font> "
Response.write "<font color=#ffffff>" & Cstr(MaxPerPage) & "</font>" & "种产品/页 " & "共" & "<font color=#ffffff>" & Cstr(Rs.RecordCount) & "</font>" & "<font color='#000000'>种产品</font> "
response.write "</td><td align='right' bgcolor='#AAEEFF'>"
response.write "<font class=main1>转到:<input type='text' name='page' size=4 maxlength=4 class=smallInput value="&Currentpage&"> "
response.write "<input class=buttonface type='submit' value='Go' name='cndok' style='background-color: #E6E4C4'></span> "
%>
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<%
end sub
rs.close
conn.close
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -