⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_xbook.asp

📁 在线报价程序V0.1 免费版: 1、后台添加产品 2、后台分类 3、后台添加友情连接 4、会员管理 5、客户留言 6、在线订单 7、捆绑了《忠网广告管理系统》 8、公告发布、管理 管理员:admin
💻 ASP
字号:
<!-- #include file="conn.asp"-->
<%
dim sql
dim rs
dim mboard

dim currentpage
if request("page")="" or request("page")<1 then
 currentpage=1
else
 currentpage=request("page")
end if
dim maxperpage 
maxperpage=20
dim maxpage
dim count
dim counti 
counti=0
dim countj 
countj=1

search=request("search")
if search="" then
   search="全部"
else
   search=request("search")
end if

cp=request("cpid")
lb=request("lbid")
zlb=request("zlb")

mboard=104
%>
<%
set rs=server.CreateObject("ADODB.recordset")
rs.open "index",conn,3,3
name=rs("name")
rs.close
set rs=nothing
%>
<title><%=name%>购物--管理系统</title>
<link rel="stylesheet" href="style.css" type="text/css">
<meta NAME=GENERATOR Content=""Microsoft FrontPage 4.0"" CHARSET=GB2312>
<BODY leftmargin="0" bottommargin="0" rightmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<%
if request("action")="del" then

    server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
    server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
    if mid(server_v1,8,len(server_v2))<>server_v2 then
	   response.write "<script language=JavaScript>{window.location='error.asp'}</script>"
	   response.end
    end if
    
	set rs=server.CreateObject("ADODB.recordset")
    sql="DELETE id from pic where item='"&request("sel")&"'"
	rs.open sql,conn,3,3
	rs.update
	rs.close
	set rs=nothing
    set rs=server.CreateObject("ADODB.recordset")
    sql="DELETE id from products where item='"&request("sel")&"'"
	rs.open sql,conn,3,3
	rs.update
	rs.close
	set rs=nothing
	response.write "<script language=JavaScript>{window.alert('商品删除成功!');window.location='admin_xbook.asp?page="&request("page")&"'}</script>"
	response.end	
end if
%>
<br>
<table width="95%" border="0" cellspacing="1" cellpadding="3" align=center class="tableBorder">
 <form action="admin_xbook.asp" method="post">
  <tr>
    <th width="100%" colspan="2" height=25>商品查询</th>
  </tr>
  <tr>
	<td width="15%" height=25 class="forumrow">查询类别</td>
    <td width="85%" class="forumrow">
	大类:
      <select name="cpi" onChange="var url=this.options[this.selectedIndex].value ; if(url!='') {window.location=url;} else {this.selectedIndex=0 ;}">
      <option value="admin_xbook.asp?cpid=0" <%if request("cpid")=0 then%>selected<%end if%>>请选择</option>
      <option value="admin_xbook.asp?cpid=1" <%if request("cpid")=1 then%>selected<%end if%>>IT产品</option>
      </select>
     中类:
      <%
	set rs=server.CreateObject("ADODB.recordset")
	sql="select * from lb where cpid="&request("cpid")
    rs.open sql,conn,3,3
	if rs.eof and rs.bof then
	%>
	  <select name="lbb">
	  <option>选择大类名称</option>
	  </select>
	  <%else%>
	  <select name="lbi" onChange="var url=this.options[this.selectedIndex].value ; if(url!='') {window.location=url;} else {this.selectedIndex=0 ;}">
	  <%do while not rs.eof%>
      <option value="admin_xbook.asp?cpid=<%=request("cpid")%>&lbid=<%=rs("id")%>&lbmc=<%=rs("lb")%>" <%if request("lbmc")=rs("lb") then%>selected<%end if%>><%=rs("lb")%></option>
	  <%
	  rs.movenext
	  loop
	  end if
	  rs.close
	  set rs=nothing
	  %>
      </select>
     小类:
	 <%
	set rs=server.CreateObject("ADODB.recordset")
	sql="select * from zlb where lid="&request("lbid")
    rs.open sql,conn,3,3
	if rs.eof and rs.bof then
	%>
	  <select name="zlb">
	  <option>选择中类名称</option>
	  </select>
	  <%else%>
	  <select name="zlb">
	  <%do while not rs.eof%>
      <option value="<%=rs("id")%>"><%=rs("zlb")%></option>
	  <%
	  rs.movenext
	  loop
	  end if
	  rs.close
	  set rs=nothing
	  %>
      </select>
	  <input type="hidden" name="cpid" value="<%=request("cpid")%>">
	  <input type="hidden" name="lbid" value="<%=request("lbid")%>">
    </td>
	</tr>
	<tr>
	 <td width="15%" height="25" class="forumrow">关键字</td>
     <td width="85%" class="forumrow">
      <input name="search" size="40">
    </td>
  </tr>
  <tr> 
    <td height="100%" colspan="2" class="forumrow">
	如果你要多项查找,请在关键字中加空格。
	</td>
  </tr>
  <tr> 
    <td height="15" colspan="4" class=forumrow> 
    <input type="submit" style="CURSOR:hand" value="查  询">
    </td>
  </tr>
 </form>
</table>
<br>
<%
set rs=server.CreateObject("ADODB.recordset")
if search="全部" then
   if lb="" then
      sql="select * from products where cp='"&cp&"' order by id desc"
   elseif zlb="" then
      sql="select * from products where cp='"&cp&"' and lb='"&lb&"' order by id desc"
   else
      sql="select * from products where cp='"&cp&"' and lb='"&lb&"' and zlb='"&zlb&"' order by id desc"
   end if
else
aryKeywords = Split(search, " ")
   if lb="" then
      sql = "select * from products where cp='"&cp&"' and"
      For i = 0 To UBound(aryKeywords)
	   sql = sql & tempJoinWord & "(" & _
	    "item LIKE '%" & aryKeywords(i) & "%' OR " & _
		"name LIKE '%" & aryKeywords(i) & "%' OR " & _
		"typed LIKE '%" & aryKeywords(i) & "%' OR " & _
		"zzs LIKE '%" & aryKeywords(i) & "%' OR " & _												
		"time LIKE '%" & aryKeywords(i) & "%')"
		tempJoinWord = " OR "							
        Next
       sql = sql & "order by id desc"
   elseif zlb="" then
      sql = "select * from products where cp='"&cp&"' and lb='"&lb&"' and"
      For i = 0 To UBound(aryKeywords)
	   sql = sql & tempJoinWord & "(" & _
	    "item LIKE '%" & aryKeywords(i) & "%' OR " & _
		"name LIKE '%" & aryKeywords(i) & "%' OR " & _
		"typed LIKE '%" & aryKeywords(i) & "%' OR " & _
		"zzs LIKE '%" & aryKeywords(i) & "%' OR " & _												
		"time LIKE '%" & aryKeywords(i) & "%')"
		tempJoinWord = " OR "							
        Next
       sql = sql & "order by id desc"
   else
      sql = "select * from products where cp='"&cp&"' and lb='"&lb&"' and zlb='"&zlb&"' and"
      For i = 0 To UBound(aryKeywords)
	   sql = sql & tempJoinWord & "(" & _
	    "item LIKE '%" & aryKeywords(i) & "%' OR " & _
		"name LIKE '%" & aryKeywords(i) & "%' OR " & _
		"typed LIKE '%" & aryKeywords(i) & "%' OR " & _
		"zzs LIKE '%" & aryKeywords(i) & "%' OR " & _												
		"time LIKE '%" & aryKeywords(i) & "%')"
		tempJoinWord = " OR "							
        Next
       sql = sql & "order by id desc"
   end if
end if
rs.open sql,conn,3,3
if rs.eof and rs.bof then
  response.write "<br><center>暂时还没有商品!</center>"
else
 count=rs.recordcount
 if count mod maxperpage = 0 then
   maxpage=count \ maxperpage 
 else
   maxpage=count \ maxperpage +1
 end if    
 if cint(currentpage) > cint(maxpage) then
   currentpage=1
 end if
%>
<%
sub page
if count<>0 then
%>
<table width="100%" cellspacing=0 cellpadding=0 class=forumrow align=center>
<form method="post" name="gopage" action="admin_xbook.asp?cpid=<%=cp%>&lbid=<%=lb%>&zlb=<%=zlb%>">
<tr>
<td width=100% align=center>
<%	
if CurrentPage<2 then
    		response.write "共有商品"&count&"个&nbsp;&nbsp;首页&nbsp;&nbsp;上一页&nbsp;&nbsp;"
  	else
    		response.write "共有商品"&count&"个&nbsp;&nbsp;<a href=admin_xbook.asp?cpid="&cp&"&lbid="&lb&"&zlb="&zlb&"&page=1>首页</a>&nbsp;&nbsp;"
    		response.write "<a href=admin_xbook.asp?cpid="&cp&"&lbid="&lb&"&zlb="&zlb&"&page="&CurrentPage-1&">上一页</a>&nbsp;&nbsp;"
  	end if

  	if maxpage-currentpage<1 then
    		response.write "下一页&nbsp;&nbsp;尾页&nbsp;&nbsp;"
  	else
    		response.write "<a href=admin_xbook.asp?cpid="&cp&"&lbid="&lb&"&zlb="&zlb&"&page="&(CurrentPage+1)&">"
    		response.write "下一页</a>&nbsp;&nbsp;<a href=admin_xbook.asp?cpid="&cp&"&lbid="&lb&"&zlb="&zlb&"&page="&maxpage&">尾页</a>&nbsp;&nbsp;"
  	end if
   	response.write "页次:<strong><font color=red>"&CurrentPage&"</font>/"&maxpage&"</strong>页"
   	response.write "&nbsp;&nbsp;<b>"&maxperpage&"</b>个商品/页 "
%>
&nbsp;&nbsp;转到		
<select name=page onchange="submit()">
<%
for i=1 to maxpage
if cint(i)=cint(currentpage) then
flag="selected"
else
flag=""
end if		
response.write "<option " & flag & " value=" & i & ">" & i & "</option>"
next	
%>
</select>
</td>	
</tr>
</form>
</table>
<%
end if
end sub%>
<table width="95%" border="0" cellspacing="1" cellpadding="3" align="center" class="tableBorder">
  <tr> 
    <th width="100%" colspan="6" height="25">商品管理</th>
  </tr>
  <tr> 
    <td width="18%" height=25 class=forumrow align=center>商品编号</td>
    <td width="20%" class=forumrow align=center>商品名称</td>
	<td width="20%" class=forumrow align=center>商品型号</td>
	<td width="10%" class=forumrow align=center>浏览次数</td>
	<td width="22%" class=forumrow align=center>入库时间</td>
	<td width="10%" class=forumrow align=center>删&nbsp;&nbsp;除</td>
  </tr>
<%
if cint(currentpage)<=cint(maxpage) then
rs.move (currentpage-1)*maxperpage
showcontent
end if  
sub showcontent
do while not rs.eof
%>
  <tr> 
   <td height=25 class=forumrow align=center><a href="admin_xgbook.asp?id=<%=rs("id")%>"><%=rs("item")%></a></td>
   <td class=forumrow align=center><%=rs("name")%></td>
   <td class=forumrow align=center><%=rs("typed")%></td>
   <td class=forumrow align=center><%=rs("hits")%></td>
   <td class=forumrow align=center><%=rs("time")%></td>
   <td class=forumrow align=center><a href="admin_xbook.asp?action=del&page=<%=request("page")%>&sel=<%=rs("item")%>">删除</a></td>
  </tr>    
<%
counti=counti+1
rs.movenext 
if counti>=maxperpage then
exit do
end if   
loop
end sub
end if
rs.close
set rs=nothing
%>
<tr> 
<td height="22" colspan="6" class="forumrow">
<%call page%>
</td>
</tr>
</table><br>
<%
conn.close
set conn=nothing
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -