📄 sort_ok2.asp
字号:
<%@language="VBscript"%>
<!--#include file="../checkuser.asp" -->
<!--#include file="../../include/db_conn.asp" -->
<%
m_ver=request("ver")
sort_action=Request.Form("sort_action")
boardname=replace(Request.Form("boardname"),"'","''") '取得新栏目名
'*****************当添加时**************************
if sort_action="add_new" then
root_sort=cint(Request.Form("root_sort"))
set rs=conn.execute("select catalogname from ys_product2_catalog where catalogname='" & boardname &"' ")
if rs.eof then
conn.execute("insert into ys_product_catalog(catalogname,version) values('" & boardname & "','"&m_ver&"')")
Response.Redirect "productcatalog.asp?ver="&m_ver
else
showError chr(34) & replace(boardname,"''","\'") & chr(34) & "栏目已经存在!"
end if
'************当修改时************************
elseif sort_action="edit" then
boardname=replace(Request.Form("boardname"),"'","''") '取得修改后分类栏目名
product_id=Request.Form("product_id")
set rs=conn.execute("select catalogname from ys_product2_catalog where catalogname='" & boardname & "'")
if rs.eof then
conn.execute "UPDATE ys_product_catalog SET catalogname='" & boardname & "' where catalogID=" & product_id
Response.Redirect "productcatalog.asp?ver="&m_ver
else
showError chr(34) & replace(boardname,"''","\'") & chr(34) & "栏目已经存在!"
end if
'*************当删除时 *******************************
elseif sort_action="del" then
catalog_id=Request.Form("id")
sqlstr="select bigphoto,smallphoto from ys_product2 where catalogid = (" & catalog_id & ")"
set rs=conn.execute(sqlstr)
if not rs.eof then
do while not rs.eof
bigphoto=trim(rs("bigphoto"))
smallphoto=trim(rs("smallphoto"))
if isnull(bigphoto)=false or bigphoto<>"" then delfile "/product/product2img/b/", bigphoto
if isnull(smallphoto)=false or smallphoto<>"" then delfile "/product/product2img/s/",smallphoto
rs.movenext
loop
end if
set rs=nothing
conn.execute "DELETE from ys_product2_catalog WHERE catalogID=" & catalog_id
conn.execute "DELETE from ys_product2 WHERE catalogid=" & catalog_id
'**删除文件**
Response.Redirect "productcatalog.asp?ver="&m_ver
'****************删除图片文件子过程
sub delfile(filePath,fileName)
if filePath<>"" then
filePath=server.MapPath(filePath)
else
exit sub
end if
SET fs=server.CreateObject("Scripting.FileSystemObject") ' 删除文件
if FS.FileExists(filePath & "/" & fileName) then
FS.DeleteFile filePath & "/" & fileName,true
end if
set fs=nothing
end sub
'**************************排序时******************
elseif sort_action="taxis" then
aa=request("released_news_str")
i=1
do while not len(aa)=0
myid=int(left(aa,instr(aa,",")-1))
sqlstr="update ys_product_catalog set orderid="&i&" where version='"&m_ver& "' and catalogid="&myid
' response.Write i
conn.execute(sqlstr)
i=i+1
aa=right(aa,len(aa)-instr(aa,","))
loop
Response.Redirect "productcatalog.asp?ver="&m_ver
end if
%>
<%sub showError(msg)%>
<script language="javascript">
alert('<%=msg%>');
location.href="productcatalog.asp?ver=<%=m_ver%>";
</script>
<%end sub%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -