📄 admin_pic.asp
字号:
<!--#include file="inc/config.asp"-->
<!--#include file="mdb/home_mdb.asp"-->
<!--#include file="inc/format.asp"-->
<!--#include file="inc/error.asp"-->
<!--#include file="inc/adminpic_body.asp"-->
<title><%=webname%></title>
<%
dim founderr,errmsg
founderr=false
errmsg=""
if session("adminlogin")<>sessionvar then
founderr=true
errmsg=errmsg+"<br>"+"<li>你尚未登录,或者超时了!请<a href='admin.asp'>重新登录</a>!"
call diserror()
response.end
else
if request.form("MM_insert") then
if request.form("action")="newpiccat" then
sql="select * from piccat"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
dim piccatname
piccatname=trim(replace(request.form("piccat_name"),"'",""))
if piccatname="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须填写分类名称!"
else
rs("piccat_name")=piccatname
end if
if founderr then
call diserror()
response.end
else
rs.update
rs.close
set rs=nothing
response.redirect "admin_pic.asp?action=piccat"
end if
elseif request.form("action")="newpic" then
sql="select * from pic"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
dim piccatid,picname,picurl,picpic,picdesc,picisbest
piccatid=cint(request.form("piccatid"))
picname=trim(replace(request.form("name"),"'",""))
picurl=trim(replace(request.form("url"),"'",""))
picpic=trim(replace(request.form("pic"),"'",""))
picdesc=trim(replace(request.form("desc"),"'",""))
picisbest=request.form("isbest")
if picname="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须填写酷站名称!"
else
rs("pic_name")=picname
end if
if piccatid<1 then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须选择酷站所属分类!"
else
rs("piccat_id")=piccatid
end if
if picurl="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须填写酷站地址!"
else
rs("pic_url")=picurl
end if
if picpic="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须填写酷站的图片地址!"
else
rs("pic_pic")=picpic
end if
if picdesc="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须填写酷站的简要说明!"
else
rs("pic_desc")=picdesc
end if
if cint(picisbest)=1 then
rs("isbest")=cint(picisbest)
end if
if founderr then
call diserror()
response.end
else
rs.update
rs.close
set rs=nothing
sql="update allcount set piccount = piccount + 1"
conn.execute(sql)
closedatabase
response.redirect "admin_pic.asp?action=pic"
end if
elseif request.form("action")="editpic" then
if request.Form("id")="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须指定操作的对象!"
else
if not isInteger(request.form("id")) then
founderr=true
errmsg=errmsg+"<br>"+"<li>非法的酷站id参数。"
end if
end if
if founderr then
call diserror()
response.End
end if
sql="select * from pic where pic_id="&cint(request.form("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
piccatid=cint(request.form("piccatid"))
picname=trim(replace(request.form("name"),"'",""))
picurl=trim(replace(request.form("url"),"'",""))
picpic=trim(replace(request.form("pic"),"'",""))
picdesc=trim(replace(request.form("desc"),"'",""))
picisbest=request.form("isbest")
if picname="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须填写酷站名称!"
else
rs("pic_name")=picname
end if
if piccatid<1 then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须选择酷站所属分类!"
else
rs("piccat_id")=piccatid
end if
if picurl="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须填写酷站地址!"
else
rs("pic_url")=picurl
end if
if picpic="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须填写酷站的图片地址!"
else
rs("pic_pic")=picpic
end if
if picdesc="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须填写酷站的简要说明!"
else
rs("pic_desc")=picdesc
end if
rs("isbest")=cint(picisbest)
if founderr then
call diserror()
response.end
else
rs.update
rs.close
set rs=nothing
response.redirect "admin_pic.asp?action=pic"
end if
elseif request.form("action")="delpic" then
if request.Form("id")="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须指定操作的对象!"
else
if not isInteger(request.form("id")) then
founderr=true
errmsg=errmsg+"<br>"+"<li>非法的酷站id参数。"
end if
end if
if founderr then
call diserror()
response.End
end if
sql="select * from pic where pic_id="&cint(request.form("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.delete
rs.close
sql="update allcount set piccount = piccount - 1"
conn.execute(sql)
closedatabase
response.redirect "admin_pic.asp?action=pic"
elseif request.form("action")="editpiccat" then
if request.Form("id")="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须指定操作的对象!"
else
if not isInteger(request.form("id")) then
founderr=true
errmsg=errmsg+"<br>"+"<li>非法的酷站分类id参数。"
end if
end if
if founderr then
call diserror()
response.End
end if
sql="select * from piccat where piccat_id="&cint(request.form("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
piccatname=trim(replace(request.form("piccat_name"),"'",""))
if piccatname="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须填写分类名称!"
else
rs("piccat_name")=piccatname
end if
if founderr then
call diserror()
response.end
else
rs.update
rs.close
set rs=nothing
response.redirect "admin_pic.asp?action=piccat"
end if
elseif request.form("action")="delpiccat" then
if request.Form("id")="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须指定操作的对象!"
else
if not isInteger(request.form("id")) then
founderr=true
errmsg=errmsg+"<br>"+"<li>非法的酷站分类id参数。"
end if
end if
if founderr then
call diserror()
response.End
end if
sql="select * from piccat where piccat_id="&cint(request.form("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.delete
rs.close
set rs=nothing
response.redirect "admin_pic.asp?action=piccat"
end if
end if
call adminpic_body()
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -