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

📄 admin_sort.asp

📁 电子商城代码
💻 ASP
📖 第 1 页 / 共 3 页
字号:
 <!--#include file="conn.asp" -->
<%
'on error resume next
admintop()
Dim admin_flag
admin_flag=",10,"
	if session("admin_name")="" or instr(","&session("flag")&",",admin_flag)=0 then
	adminflag()	
	else
sort_id=Safereplace(trim(request("sort_id")))
csort_id=Safereplace(trim(request("csort_id")))
cxsort_id=Safereplace(trim(request("cxsort_id")))
sort_name=Safereplace(trim(request("sort_name")))
csort_name=Safereplace(trim(request("csort_name")))
cxsort_name=Safereplace(trim(request("cxsort_name")))
sort_pic=Safereplace(trim(request("sort_pic")))
paixu=Safereplace(trim(request("paixu")))
If paixu="" Then paixu="1"
if paixu="" or isnumeric(paixu)=false then paixu=1

Select Case Request("action")
	Case "addsort" : addsort()
	Case "sortadd" : sortadd()
	Case "delsort" : delsort()
	Case "sortdel" : sortdel()
	Case "modisort" : modisort()
	Case "sortmodi" : sortmodi()
	Case "hbsort" : hbsort()
	Case "sorthb" : sorthb()
	Case "addcsort" : addcsort()
	Case "csortadd" : csortadd()
	Case "delcsort" : delcsort()
	Case "csortdel" : csortdel()
	Case "modicsort" : modicsort()
	Case "csortmodi" : csortmodi()
	Case "hbcsort" : hbcsort()
	Case "csorthb" : csorthb()
	Case "addcxsort" : addcxsort()
	Case "cxsortadd" : cxsortadd()
	Case "delcxsort" : delcxsort()
	Case "cxsortdel" : cxsortdel()
	Case "modicxsort" : modicxsort()
	Case "cxsortmodi" : cxsortmodi()
	Case "hbcxsort" : hbcxsort()
	Case "cxsorthb" : cxsorthb()
	Case Else
		list()
        End Select
end if
'开始添加操作
sub addsort
sort_name=trim(request("addsort"))
if sort_name="" then        
response.write"<SCRIPT language=JavaScript>alert('分类名称不能为空!');javascript:history.go(-1)</SCRIPT>"
response.end
else
sql="select * from [56770_sort] where sort_name='"&sort_name&"'"
set rs=server.createobject("ADODB.Recordset")
rs.open sql, conn, 1, 3
if not(rs.eof or rs.bof)then
        response.write"<SCRIPT language=JavaScript>alert('分类名称已存在!');javascript:history.go(-1)</SCRIPT>"
response.end
else
 rs.addnew
rs("sort_name")=sort_name
rs("sort_pic")=sort_pic
rs("paixu")=paixu
rs.update
end if
rs.close
set rs=nothing
response.redirect "Admin_sort.asp"
response.end
end if
end sub

sub addcsort
if csort_name="" then        
response.write"<SCRIPT language=JavaScript>alert('分类名称不能为空!');javascript:history.go(-1)</SCRIPT>"
response.end
else
sql="select * from [56770_csort] where sort_id="&request("sort_id")&" and csort_name='"&csort_name&"'"
set rs=server.createobject("ADODB.Recordset")
rs.open sql, conn, 1, 1
if not(rs.eof or rs.bof)then
        response.write"<SCRIPT language=JavaScript>alert('分类名称已存在!');javascript:history.go(-1)</SCRIPT>"
response.end
end if
rs.close
set rs=Nothing
conn.execute "insert into [56770_csort] (sort_id,csort_name, paixu)values("&request("sort_id")&", '"&csort_name&"', '"&paixu&"')"
response.redirect "?sort_id="&request("sort_id")&""
response.end
end if
end sub

sub addcxsort
if cxsort_name="" then        
response.write"<SCRIPT language=JavaScript>alert('分类名称不能为空!');javascript:history.go(-1)</SCRIPT>"
response.end
else
sql="select * from [56770_cxsort] where sort_id="&request("sort_id")&" and csort_id="&request("csort_id")&" and cxsort_name='"&cxsort_name&"'"
set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,1,1
if not(rs.eof or rs.bof) then
response.write"<SCRIPT language=JavaScript>alert('分类名称已存在!');javascript:history.go(-1)</SCRIPT>"
response.end
end if
rs.close
set rs=nothing
conn.execute "insert into [56770_cxsort] (sort_id,csort_id,cxsort_name,paixu) values ("&request("sort_id")&","&request("csort_id")&",'"&cxsort_name&"','"&paixu&"')"
response.redirect "?sort_id="&request("sort_id")&"&csort_id="&request("csort_id")&""
response.end
end if
end sub



'开始删除操作
sub delsort
 conn.execute "delete from [56770_sort] where sort_id="&sort_id&""
 conn.execute "delete from [56770_csort] where sort_id="&sort_id&""
 conn.execute "delete from [56770_cxsort] where sort_id="&sort_id&""
 conn.execute "delete from [56770_product] where sort_id="&sort_id&""
response.redirect "Admin_sort.asp"
response.end
end sub

sub delcsort
conn.execute "delete from [56770_csort] where csort_id="&csort_id&""
conn.execute "delete from [56770_cxsort] where csort_id="&csort_id&""
conn.execute "delete from [56770_product] where csort_id="&csort_id&""
response.redirect "?sort_id="&request("sort_id")&""
response.end
end sub

sub delcxsort
conn.execute "delete from [56770_cxsort] where cxsort_id="&cxsort_id&""
response.redirect "?sort_id="&request("sort_id")&"&csort_id="&csort_id&""
response.end
end sub


'开始修改操作
sub modisort
sql="select * from [56770_sort] where sort_name='"&request("sort_name")&"' order by sort_id desc"
set rs=server.createobject("ADODB.Recordset")
rs.open sql, conn, 1, 1
if not(rs.eof or rs.bof)then
        response.write"<SCRIPT language=JavaScript>alert('分类名称已存在!');javascript:history.go(-1)</SCRIPT>"
response.end
end if
rs.close
set rs=nothing
if request("sort_name")="" then
       conn.execute "update [56770_sort] set sort_pic='"&sort_pic&"',paixu="&paixu&" where sort_name='"&request("modisort")&"'"
else
       conn.execute "update [56770_sort] set sort_pic='"&request("sort_pic")&"',sort_name='"&sort_name&"',paixu="&paixu&" where sort_name='"&request("modisort")&"'"
end if
response.redirect "Admin_sort.asp"
response.end
end sub

sub modicsort

sql="select * from [56770_csort] where sort_id="&request("sort_id")&" and csort_name='"&request("modicsortto")&"' order by csort_id desc"
set rs=server.createobject("ADODB.Recordset")
rs.open sql, conn, 1, 1
if not(rs.eof or rs.bof)then
        response.write"<SCRIPT language=JavaScript>alert('分类名称已存在!');javascript:history.go(-1)</SCRIPT>"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
rs.close
set rs=Nothing
If request("modicsortto")="" then
        conn.execute "update [56770_csort] set paixu="&paixu&" where csort_name='"&request("modicsort")&"' and sort_id="&request("sort_id")&""
Else
        conn.execute "update [56770_csort] set csort_name='"&request("modicsortto")&"',paixu="&paixu&" where csort_name='"&request("modicsort")&"' and sort_id="&sort_id&""
End if
response.redirect "?sort_id="&request("sort_id")&""
response.end

end sub

sub modicxsort
if request("modicxsortto")="" then        
response.write"<SCRIPT language=JavaScript>alert('分类名称不能为空!');javascript:history.go(-1)</SCRIPT>"
response.end
else
sql="select * from [56770_cxsort] where sort_id="&request("sort_id")&" and csort_id="&request("csort_id")&" and cxsort_name='"&request("modicxsortto")&"' order by cxsort_id desc"
set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,1,1
if not(rs.eof or rs.bof) then
response.write"<SCRIPT language=JavaScript>alert('分类名称已存在!');javascript:history.go(-1)</SCRIPT>"
response.end
end if
rs.close
set rs=nothing
conn.execute "update [56770_cxsort] set cxsort_name='"&request("modicxsortto")&"',paixu="&paixu&" where cxsort_name='"&request("modicxsort")&"' and cxsort_id="&cxsort_id&""
'conn.execute "update [56770_product] set ssortname='"&request("modicxsortto")&"' where ssortname='"&request("modicxsort")&"' and csort_id="&request("csort_id")&" and sort_id="&request("sort_id")&""
response.redirect "?sort_id="&request("sort_id")&"&csort_id="&request("csort_id")&""
response.end
End if
end sub

'开始合并操作
sub hbsort
on error resume next
unitesort1=trim(request("unitesort1"))
unitesort2=request("unitesort2")
unitesortto=trim(request("unitesortto"))
if unitesort1="" or unitesort2="" or unitesort1=unitesort2 or unitesortto="" then
        response.write"<SCRIPT language=JavaScript>alert('对不起,您在合并分类时有错误操作, 请核实!');javascript:history.go(-1)</SCRIPT>"
response.end
end if
sql="select * from [56770_sort] where sort_name='"&unitesort2&"'"
set rs=server.createobject("ADODB.Recordset")
rs.open sql, conn, 1, 1
sortid=rs("sort_id")
rs.close
set rs=nothing
conn.execute "update [56770_sort] set sort_name='"&unitesortto&"',paixu="&paixu&" where sort_name='"&unitesort1&"'"
conn.execute "delete from [56770_sort] where sort_name='"&unitesort2&"'"
conn.execute "update [56770_csort] set sort_id="&sort_id&" where sort_id="&sortid&""
conn.execute "update [56770_cxsort] set sort_id="&sort_id&" where sort_id="&sortid&""
conn.execute "update [56770_product] sort_id="&sort_id&" where sort_id="&sortid&""
response.redirect "Admin_sort.asp"
response.end
end sub

sub hbcsort
on error resume next
unitecsort1=request("unitecsort1")
unitecsort2=request("unitecsort2")
unitecsortto=request("unitecsortto")
if unitecsort1="" or unitecsort2="" or unitecsortto="" then
        response.write"<SCRIPT language=JavaScript>alert('对不起,您在合并分类时有错误操作, 请核实!');javascript:history.go(-1)</SCRIPT>"
response.end
end if
sql="select * from [56770_csort] where csort_name='"&unitecsort2&"'"
set rs=server.createobject("ADODB.Recordset")
rs.open sql, conn, 1, 1
csortid=rs("csort_id")
rs.close
set rs=nothing
conn.execute "update [56770_csort] set csort_name='"&unitecsortto&"',paixu="&paixu&" where csort_name='"&unitecsort1&"'"
conn.execute "delete from [56770_csort] where csort_name='"&unitecsort2&"'  and sort_id="&sort_id&""
conn.execute "update [56770_cxsort] set csort_id="&csort_id&" where csort_id="&csortid&" and sort_id="&sort_id&""
conn.execute "update [56770_product] set csort_id="&csort_id&" where csort_id="&csortid&" and sort_id="&sort_id&""
response.redirect "?sort_id="&request("sort_id")&""
response.end
end sub

sub hbcxsort
on error resume next
unitecxsort1=request("unitecxsort1")
unitecxsort2=request("unitecxsort2")
unitecxsortto=request("unitecxsortto")
if unitecxsort1="" or unitecxsort2="" or unitecxsortto="" then
response.write"<SCRIPT language=JavaScript>alert('对不起,您在合并分类时有错误操作,请核实!');javascript:history.go(-1)</SCRIPT>"
response.end
end if
conn.execute "update [56770_cxsort] set cxsort_name='"&unitecxsortto&"',paixu="&paixu&" where cxsort_name='"&unitecxsort1&"' and sort_id="&sort_id&""
conn.execute "delete from [56770_cxsort] where cxsort_name='"&unitecxsort2&"' and sort_id="&sort_id&""
conn.execute "update [56770_product] set ssortname='"&unitecxsortto&"' where ssortname='"&unitecxsort1&"' or ssortname='"&unitecxsort2&"' and csort_id="&request("csort_id")&" and sort_id="&request("sort_id")&""
response.redirect "?sort_id="&sort_id&"&csort_id="&csort_id&""
response.end
end sub

sub list
%>
       <table border="0" cellspacing="1" cellpadding="0" height="0" align=center width="98%" bgcolor="#183789">
        <tr>
         <td>
           <table width="100%" border="0" cellspacing="1" bgcolor="#FFFFFF" cellpadding="0">
               <tr>
                 <td class="classtop" height="27" align="center" colspan="6">商品分类列表</td>
               </tr>
   <tr>
      <td class="classtop2" height="50" align="center" colspan="6">
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "Select sort_id,sort_name From [56770_sort] order by paixu desc", conn, 1, 1
do while not rs.eof
%>
<a href=?sort_id=<%=rs("sort_id")%>><font color=#ffffff><%=rs("sort_name")%></font></a>&nbsp;|&nbsp;
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
</td>
</tr>
<%if request("sort_id")<>"" then%>
   <tr>
      <td class="classtd" height="25" align="center" colspan="6">
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "Select sort_id,csort_id,csort_name From [56770_csort] where sort_id="&request("sort_id")&" order by paixu desc", conn, 1, 3
do while not rs.eof
%>
<a href=?sort_id=<%=rs("sort_id")%>&csort_id=<%=rs("csort_id")%>><%=rs("csort_name")%></a>&nbsp;|&nbsp;
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
</td>
</tr>
<%
end if
%>
 </table>
<table border="0" cellspacing="1" cellpadding="2" bgcolor="#FFFFFF" width="100%" align="center"> 
<tr>
<td height="25" class=classtop1 width="6%" align="center">图标</td>
<td height="25" class=classtop1 width="50%" align="center">分类名称       <input type="button" name="Submit2" value="添加一级分类" onClick="location.href='?action=sortadd'" class="button"></td>
<td height="25" class=classtop1 width="5%" align="center">序号</td>
<td height="25" class=classtop1 width="15%" align="center">排序</td>
<td colspan="3" class=classtop1 align="center">操作</td>
</tr>
<%
dim rscsort
set rs=server.CreateObject("adodb.recordset")
if request("sort_id")<>"" then
rs.open "Select sort_id,sort_name,sort_pic,paixu From [56770_sort] where sort_id="&request("sort_id")&" order by paixu desc", conn, 1, 3
else
rs.open "Select sort_id,sort_name,sort_pic,paixu From [56770_sort] order by paixu desc", conn, 1, 3
end if
if request("edit")="up1" then
conn.execute "update [56770_sort] set paixu="&request("paixu")&"+1 where sort_id=" &request("sort_id")
response.redirect "Admin_sort.asp"
end if
if request("edit")="down1" then
conn.execute "update [56770_sort] set paixu="&request("paixu")&"-1 where sort_id=" &request("sort_id")
response.redirect "Admin_sort.asp"
end if
do while not rs.eof

⌨️ 快捷键说明

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