?? 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 + -