📄 default.asp
字号:
<!--#include file="../Session.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>商品管理</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<link href="../../css/site.css" rel="stylesheet" type="text/css">
</head>
<%
const MaxPerPage=20
dim totalPut,CurrentPage,TotalPages,KeyWord
KeyWord=request("KeyWord")
cpid=request("cpid")
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
Select case Request("Action")
case "Commend"
Commend=Request("Commend")
if Commend=1 then
Commend=0
else
Commend=1
end if
conn.execute("Update Merchandise set Commend ='"&Commend&"' where id="&Request("id")&"")
Response.redirect "Default.asp?keywords="&request("keywords")&"&Act="&request("Act")&"&page="&request("page")&""
case "Cheap"
dim Cheap
Cheap=Request("Cheap")
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select Price from Merchandise where id="&Request("id")&""
rs.open sql,conn,0,1
if Cheap=0 then
for i=1 to Int(glevel)
if split(rs("Price"),"¥")(i)<>split(rs("Price"),"¥")(Int(glevel)) then
Response.Write("<script>alert(""特价商品的会员价必须相同!\n\n请修改会员价格!"");history.back();</script>")
Response.end
end if
next
end if
if Cheap=1 then
Cheap=0
else
Cheap=1
end if
conn.execute("Update Merchandise set Cheap='"&Cheap&"' where id="&Request("id")&"")
Response.redirect "Default.asp?keywords="&request("keywords")&"&Act="&request("Act")&"&page="&request("page")&""
case "Display"
Display=Request("Display")
if Display=2 then
Response.Write("<script>alert(""此商品已被管理员隐藏,您权修改其状态!\n\n请与管理员联系!"");history.back();</script>")
Response.End
end if
if Display=1 then
Display=0
else
Display=1
end if
conn.execute("Update Merchandise set Display ='"&Display&"' where id="&Request("id")&"")
Response.redirect "Default.asp?keywords="&request("keywords")&"&Act="&request("Act")&"&page="&request("page")&""
End Select
%>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="50" colspan="4" align="center" class="tdstyle"><strong><font color="#000000" size="3">商品管理</font></strong></td>
</tr>
<%
if KeyWord<>"" then
sql="select * from Merchandise where TradeName like '%"&trim(KeyWord)&"%' order by id desc"
elseif cpid<>"" then
sql="select * from Merchandise where id="&cpid&""
else
sql="select * from Merchandise order by id desc"
end if
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<tr><td height=30 colspan=4 align=center class=text>暂无商品</td></tr>"
else%>
</table>
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="2" bordercolorlight="#000000" bordercolordark="#FFFFFF">
<tr>
<form name="searchsoft" method="POST" action="Default.asp">
<td height="20" colspan="2" align="center" class="tdstyle"> 请输入商品名称:
<input class="input1" type="text" name="KeyWord" size="20"> <input class="button" type="submit" value="模糊查询" name="title">
</td>
</form>
<form name="searchsoft" method="POST" action="Default.asp">
<td height="20" colspan="2" align="center" class="tdstyle"> 请输入商品编号:
<input class="input1" type="text" name="cpid" size="20"> <input class="button" type="submit" value="精确查询" name="title">
</td>
</form>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="0">
<!--
<%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
showpage totalput,MaxPerPage,"Default.asp"
showContent
showpage totalput,MaxPerPage,"Default.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,"Default.asp"
showContent
showpage totalput,MaxPerPage,"Default.asp"
else
currentPage=1
showpage totalput,MaxPerPage,"Default.asp"
showContent
showpage totalput,MaxPerPage,"Default.asp"
end if
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
sub showContent
dim i
i=0
%> -->
<form method=Post action="Del.asp">
<tr align="center" valign="middle">
<td width="8%" height="30" class="tdstyle"><strong>编号</strong></td>
<td width="50%" class="tdstyle"><strong>商品名称</strong></td>
<td width="8%" class="tdstyle"><strong>修改</strong></td>
<td width="8%" class="tdstyle"><strong>推荐</strong></td>
<td width="8%" class="tdstyle"><strong>特价</strong></td>
<td width="10%" class="tdstyle"><strong>显示</strong></td>
<td width="8%" class="tdstyle"><strong>删除</strong></td>
</tr>
<%do while not rs.eof%>
<tr valign="middle">
<td height="25" align="center" class="tdstyle"><%= rs("Id") %></td>
<td align="center" class="tdstyle"><%= rs("TradeName") %></td>
<td align="center" class="tdstyle"><input name="submit" type="button" class="button2" value="修 改" onClick="window.location='../Sorry.asp'"></td>
<td align="center" class="tdstyle"><%if rs("Commend")<>0 then%>
<input name="submit" type="button" class="button5" value="是" onClick="window.location='?Action=Commend&keywords=<%=request("keywords")%>&Act=<%=request("Act")%>&Commend=<%=rs("Commend")%>&id=<%=rs("id")%>&page=<%=CurrentPage%>'">
<%else%><input name="submit" type="button" class="button4" value="否" onClick="window.location='?Action=Commend&keywords=<%=request("keywords")%>&Act=<%=request("Act")%>&Commend=<%=rs("Commend")%>&id=<%=rs("id")%>&page=<%=CurrentPage%>'"><%end if%></td>
<td align="center" class="tdstyle"><%if rs("Cheap")<>0 then%>
<input name="submit" type="button" class="button5" value="是" onClick="window.location='?Action=Cheap&keywords=<%=request("keywords")%>&Act=<%=request("Act")%>&Cheap=<%=rs("Cheap")%>&id=<%=rs("id")%>&page=<%=CurrentPage%>'">
<%else%><input name="submit" type="button" class="button4" value="否" onClick="window.location='?Action=Cheap&keywords=<%=request("keywords")%>&Act=<%=request("Act")%>&Cheap=<%=rs("Cheap")%>&id=<%=rs("id")%>&page=<%=CurrentPage%>'"><%end if%></td>
<td align="center" class="tdstyle">
<%Display=rs("Display")
If Display="1" Then%>
<input name="submit" type="button" class="button3" value="隐藏" onClick="window.location='?Action=Display&keywords=<%=request("keywords")%>&Act=<%=request("Act")%>&Display=<%=rs("Display")%>&id=<%=rs("id")%>&page=<%=CurrentPage%>'">
<%else%>
<input name="submit" type="button" class="button2" value="显 示" onClick="window.location='?Action=Display&keywords=<%=request("keywords")%>&Act=<%=request("Act")%>&Display=<%=rs("Display")%>&id=<%=rs("id")%>&page=<%=CurrentPage%>'">
<%end if%>
</td>
<td width="10%" class="tdstyle"> <p align="center"> <input name='selAnnounce' type='checkbox' value='<%=cstr(rs("id"))%>'></td>
</tr>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
<tr align="right">
<td height="30" colspan="6" class="tdstyle">
<%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 "<p align='center'> "
if CurrentPage<2 then
response.write "首页 上一页 "
else
response.write "<a href="&filename&"?page=1&KeyWord="&KeyWord&">首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&"&KeyWord="&KeyWord&">上一页</a> "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&KeyWord="&KeyWord&">"
response.write "下一页</a> <a href="&filename&"?page="&n&"&KeyWord="&KeyWord&">尾页</a>"
end if
response.write " 页次:"&CurrentPage&"/"&n&"页 "
response.write " 共"&totalnumber&"个商品 "&maxperpage&"个商品/页"
end function
%>
</td>
<td align="center" class="tdstyle">
<input name="submit" type='submit' class="button" value='删 除'></td>
<input name="page" type="hidden" id="page" value=<%=CurrentPage%>>
</tr>
</form>
<%end if%>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -