📄 product.asp
字号:
<!--#include file="i_login.asp"-->
<%
Response.Expires = 0
keyword=trim(request("keyword"))
page=clng(request("page"))
showclassid=trim(request.QueryString("showclassid"))
orderby=trim(request.QueryString("orderby"))
dim pars,pars2
pars="keyword="&server.URLEncode(keyword)&"&page="&page&"&showclassid="&showclassid&"&orderby="&orderby&""
pars2="keyword="&server.URLEncode(keyword)&"&page="&page&"&showclassid="&showclassid&""
select case mode
case "del"
call del_sub(trim(request("id")))
case "time"
call time_sub()
case "Batch"
call Batch_sub()
case "tuijian"
call tuijian_sub()
case "display"
call display_sub()
end select
sub Batch_sub()
dim Submit
Submit=trim(request.Form("Submit"))
select case Submit
case "删 除"
call Batch_delete()
case "移 动"
call Batch_move()
case "推 荐"
call tuijians_sub()
case "显 示"
call displays_sub()
end select
end sub
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Product</title>
<LINK href="images/style.css" type=text/css rel=stylesheet>
<script language="javascript" src="../inc/functions.js"></script>
<script language="javascript">
function chk_select(id){
if (id.length>1)
{ for (j=0;j<id.length;j++) if (id[j].checked==true) break;
if (j==id.length) { alert("未选择!"); return false; }
} else
if (id.checked==false) { alert("未选择!"); return false; }
return true;
}
function chk_delete(id){
if(chk_select(id))
{
if(confirm('确定删除吗?')){return true;}else{return false;}
}
else
{
return false;
}
}
function chk_tuijian(id){
if(chk_select(id))
{
}
else
{
return false;
}
}
function chk_move(id,classid){
if(chk_select(id)){
if (classid.value=="")
{
alert("未选择目标目录!");
return false;
}
}else
{
return false;
}
return true;
}
</script>
</head>
<body >
<table width="98%" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="54%" align="left" nowrap><span class="gray"> CMS >> 作品管理
<select name="showclassid" class="input_200" onChange="window.open('?showclassid='+this.options[this.selectedIndex].value,'_self');">
<%
call site_class_showpid2(0," ")
function site_class_showpid2(byval classid,byval str)
dim rs,request_id
if str=" " then
response.Write("<option value="""">全部信息</option>")
end if
set rs=conn.execute("select id,name from data_class where classid="&classid&" order by orderby,id")
while not rs.eof
response.Write("<option value="""&rs("id")&""">"&str&rs("name")&"</option>")
site_class_showpid2 cint(rs("id")),str & " "
rs.movenext
wend
rs.close
set rs=nothing
end function
%>
</select>
<script>document.getElementById('showclassid').value='<%=showclassid%>';</script>
</td>
<td width="46%" align="right" nowrap><table border="0">
<form name="form" method="get" action="?">
<tr>
<td nowrap class="gray"><a href="?"> 全部 </a></td>
<td nowrap class="gray"><input name="keyword" type="text" id="keyword"
<%
response.write "value="""&keyword&""""
%>
size="25">
</td>
<td nowrap><input name="Search" type="submit" id="Search" value=" 搜 索 "></td>
<td nowrap><span class="gray">(关键字之间用空格分开!)</span></td>
</tr>
</form>
</table></td>
</tr>
</table>
<form name="form1" method="post" action="?<%=pars%>">
<input name="mode" type="hidden" value="Batch">
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#C2BDBD">
<tr>
<td width="4%" height="25" align="center" nowrap bgcolor="#CCCCCC">ID</td>
<td width="19%" align="center" nowrap bgcolor="#CCCCCC">名称</td>
<td width="5%" align="center" nowrap bgcolor="#CCCCCC">价格</td>
<td width="27%" align="center" nowrap bgcolor="#CCCCCC">目录</td>
<td width="5%" align="center" nowrap bgcolor="#CCCCCC" > <%
if orderby="tuijian" then
Response.Write "<a href=""?orderby=tuijian desc&" & pars2 & """ style=""color:#0000ff;"">↓推荐</a>" & vbNewLine
Response.Write "" & vbNewLine
elseif orderby="tuijian desc" then
Response.Write "<a href=""?orderby=tuijian&" & pars2 & """ style=""color:#0000ff;"">↑推荐</a>" & vbNewLine
Response.Write "" & vbNewLine
else
Response.Write "<a href=""?orderby=tuijian desc&" & pars2 & """ style=""color:#0000ff;"">推荐</a>" & vbNewLine
Response.Write "" & vbNewLine
end if
%> </td>
<td width="6%" align="center" nowrap bgcolor="#CCCCCC"><%
if orderby="display" then
Response.Write "<a href=""?orderby=display desc&" & pars2 & """ style=""color:#0000ff;"">↓显示</a>" & vbNewLine
Response.Write "" & vbNewLine
elseif orderby="display desc" then
Response.Write "<a href=""?orderby=display&" & pars2 & """ style=""color:#0000ff;"">↑显示</a>" & vbNewLine
Response.Write "" & vbNewLine
else
Response.Write "<a href=""?orderby=display desc&" & pars2 & """ style=""color:#0000ff;"">显示</a>" & vbNewLine
Response.Write "" & vbNewLine
end if
%></td>
<td width="7%" align="center" nowrap bgcolor="#CCCCCC">更新日期</td>
<td width="8%" align="center" nowrap bgcolor="#CCCCCC">操作</td>
</tr>
<%
if showclassid<>"" then
sql_where=" classid in ("&get_sids(showclassid)&") and "
end if
sql_where=sql_where & keyword_sousuo("item,code,colour,size,material,content,classnames",keyword)
'排序字段
if orderby<>"" then
sql_order="order by "&orderby&",Updatetime desc,id desc"
else
sql_order="order by Updatetime desc,id desc"
end if
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select id,item,price,tuijian,display,updatetime,img,img_s,colour,size,material,color,classnames from data_product where "&sql_where&" "&sql_order&""
rs.Open sql,conn,1,2
if rs.eof and rs.bof then
response.Write("无产品")
else
rs.PageSize=15
if page=0 then page=1
pages=rs.pagecount
if page > pages then page=pages
rs.AbsolutePage=page
for j=1 to rs.PageSize
%>
<tr bgcolor="#FFFFFF">
<td height="22" align="center" nowrap><input type="checkbox" name="id" value="<%=rs("id")%>"></td>
<td valign="middle" nowrap style="cursor:hand;"
<%
response.Write("title=""颜色:"&rs("colour")&""&vbcrlf)
response.Write("规格:"&rs("size")&""&vbcrlf)
response.Write("材料:"&rs("material")&""""&vbcrlf)
%>> <%
if trim(rs("img_s"))<>"" then
response.Write("<a href="""&rs("img")&""" target=""_blank"" ><img src="""&rs("img_s")&""" border=""0"" align=""absmiddle"" width=""20"" height=""20"" onload=""ResizeImage(this, 20, 20);""></a> ")
end if
%>
<%
response.Write("<a href=""../Product.asp?id="&rs("id")&""" target=""_blank"" style=""color:"&rs("color")&""">"&keyword_tag(rs("item"),keyword)&"</a>")
%> </td>
<td align="center" nowrap><%
response.Write(keyword_tag(rs("price"),keyword))
%></td>
<td align="left" nowrap>
<a href="?keyword=<%=server.URLEncode(rs("classnames"))%>"><%=keyword_tag(strleft(rs("classnames"),22,".."),keyword)%></a> </td>
<td align="center" nowrap><%
Response.Write "" & vbNewLine
if rs("tuijian")=1 then
Response.Write "<a href=""?mode=tuijian&id="&rs("id")&"&"&pars&""" style=""color:#FF0000"">是</a>" & vbNewLine
else
Response.Write "<a href=""?mode=tuijian&id="&rs("id")&"&"&pars&""">否</a>" & vbNewLine
end if
%></td>
<td align="center" nowrap><%
Response.Write "" & vbNewLine
if rs("display")=1 then
Response.Write "<a href=""?mode=display&id="&rs("id")&"&"&pars&""" style=""color:#FF0000"">是</a>" & vbNewLine
else
Response.Write "<a href=""?mode=display&id="&rs("id")&"&"&pars&""">否</a>" & vbNewLine
end if
%></td>
<td align="center" nowrap>
<a href="?mode=time&id=<%=rs("id")%>&<%=pars%>">
<%
if rs("updatetime")<>"" then
if DateDiff("d",rs("updatetime"),now())>0 then
response.Write formatdatetime(rs("updatetime"),2)
else
response.Write formatdatetime(rs("updatetime"),3)
end if
end if
%></a></td>
<td align="center" nowrap>
<a href="product_edit.asp?id=<%=rs("id")%>&<%=pars%>">编辑</a>
<a href="?mode=del&id=<%=rs("id")%>&<%=pars%>" onClick="javascript:if(confirm('确定删除吗?')){return true;}else{return false;}">删除</a></td>
</tr>
<%
rs.movenext
if rs.eof then exit for
next
%>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="40"><input type="button" name="buttonfx" id="buttonfx2" value=" 反 选 " onClick="checkAll(this.form);" />
<input type="submit" name="Submit" value=" 删 除 " onClick="return chk_delete(this.form.id);">
<input type="submit" name="Submit" value=" 推 荐 " onClick="return chk_tuijian(this.form.id);" >
<input name="Submit" type="submit" id="Submit" onClick="return chk_tuijian(this.form.id);" value=" 显 示 " >
<select name="classid" >
<%
call site_class_showpid(0," ")
function site_class_showpid(byval classid,byval str)
dim rs,request_id
if str=" " then
response.Write("<option value="""">移动到...</option>")
end if
set rs=conn.execute("select id,name from data_class where classid="&classid&" order by orderby,id")
while not rs.eof
response.Write("<option value="""&rs("id")&""">"&str&rs("name")&"</option>")
site_class_showpid cint(rs("id")),str & " "
rs.movenext
wend
rs.close
set rs=nothing
end function
%>
</select>
<input type="submit" name="Submit" value=" 移 动 " onClick="return chk_move(this.form.id,this.form.classid);">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="30" align="center">
<%
response.Write("共"&rs.recordcount&"个产品 ")
call showpage_fun(rs.pagecount,page,4)
%> </td>
</tr>
</table></form>
<%
end if
rs.close
set rs=nothing
%>
</body>
</html>
<%
conn.close
set conn=nothing
%>
<%
sub tuijians_sub()
dim ids
ids=trim(request.Form("id"))
conn.execute("update data_product set tuijian=(tuijian+1) mod 2 where id in("&ids&") ")
end sub
sub tuijian_sub()
dim ids
ids=trim(request("id"))
conn.execute("update data_product set tuijian=(tuijian+1) mod 2 where id="&ids&" ")
end sub
sub displays_sub()
dim ids
ids=trim(request.Form("id"))
conn.execute("update data_product set display=(display+1) mod 2 where id in("&ids&") ")
end sub
sub display_sub()
dim ids
ids=trim(request("id"))
conn.execute("update data_product set display=(display+1) mod 2 where id="&ids&" ")
end sub
sub Batch_delete()
dim ids,rs
ids=trim(request.Form("id"))
if ids<>"" then
set rs=conn.execute("select id from data_product where id in ("&ids&")")
while not rs.eof
del_sub(rs(0))
rs.movenext
wend
rs.close
set rs=nothing
end if
end sub
sub Batch_move()
dim ids,rs,classid
ids=trim(request.Form("id"))
classid=trim(request.Form("classid"))
if ids<>"" and classid<>"" then
set rs=server.CreateObject("adodb.recordset")
rs.open"select id,classid,classnames from data_product where id in ("&ids&")",conn,1,2
while not rs.eof
rs("classid")=classid
rs("classnames")=get_classnames(classid)
rs.update
rs.movenext
wend
rs.close
set rs=nothing
end if
end sub
sub del_sub(byval id)
dim rs
if id="" then
response.Write("<script>alert('ERR!');</script>")
end if
set rs=conn.execute("select img,img_s from data_product where id="&id&" and img is not null ")
if not rs.eof then
if localhost(rs(0)) then
call del_file(rs(0))
end if
if localhost(rs(1)) then
call del_file(rs(1))
end if
end if
rs.close
set rs=nothing
conn.execute("delete from data_product where id="&id&"")
end sub
sub time_sub()
dim id
id=trim(request("id"))
if id="" then
response.Write("<script>alert('ERR!');</script>")
end if
conn.execute("update data_product set updatetime=now() where id="&id&"")
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -