📄 admin_pic.asp
字号:
<!--#include file="Include/Gaobei_setup.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="Include/check.asp"-->
<%CheckAdmin3%>
<%
Rem 判断数字是否整型
function isInteger(para)
on error resume next
dim str
dim l,i
if isNUll(para) then
isInteger=false
exit function
end if
str=cstr(para)
if trim(str)="" then
isInteger=false
exit function
end if
l=len(str)
for i=1 to l
if mid(str,i,1)>"9" or mid(str,i,1)<"0" then
isInteger=false
exit function
end if
next
isInteger=true
if err.number<>0 then err.clear
end function
%>
<%
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
Response.Write("<script language=javascript>alert('你必须填写分类名称!');history.back(1);</script>")
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,picspic,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"),"'",""))
picspic=trim(replace(request.form("spic"),"'",""))
picdesc=trim(replace(request.form("desc"),"'",""))
picisbest=request.form("isbest")
if picname="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写图片标题!');history.back(1);</script>")
else
rs("pic_name")=picname
end if
if piccatid<1 then
founderr=true
Response.Write("<script language=javascript>alert('你必须选择图片所属分类!');history.back(1);</script>")
else
rs("piccat_id")=piccatid
end if
if picurl="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写文件大小!');history.back(1);</script>")
else
rs("pic_url")=picurl
end if
if picspic="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写缩图地址!');history.back(1);</script>")
else
rs("pic_spic")=picspic
end if
if picpic="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写图片地址!');history.back(1);</script>")
else
rs("pic_pic")=picpic
end if
if picdesc="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写图片的简要说明!');history.back(1);</script>")
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)
response.redirect "admin_pic.asp?action=pic"
end if
elseif request.form("action")="editpic" then
if request.Form("id")="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须指定操作的对象!');history.back(1);</script>")
else
if not isInteger(request.form("id")) then
founderr=true
Response.Write("<script language=javascript>alert('非法的id参数。');history.back(1);</script>")
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"),"'",""))
picspic=trim(replace(request.form("spic"),"'",""))
picdesc=trim(replace(request.form("desc"),"'",""))
picisbest=request.form("isbest")
if picname="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写图片标题!');history.back(1);</script>")
else
rs("pic_name")=picname
end if
if piccatid<1 then
founderr=true
Response.Write("<script language=javascript>alert('你必须选择图片所属分类!');history.back(1);</script>")
else
rs("piccat_id")=piccatid
end if
if picurl="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写图片大小!');history.back(1);</script>")
else
rs("pic_url")=picurl
end if
if picspic="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写缩图地址!');history.back(1);</script>")
else
rs("pic_spic")=picspic
end if
if picpic="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写图片地址!');history.back(1);</script>")
else
rs("pic_pic")=picpic
end if
if picdesc="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写图片的简要说明!');history.back(1);</script>")
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
Response.Write("<script language=javascript>alert('你必须指定操作的对象!');history.back(1);</script>")
else
if not isInteger(request.form("id")) then
founderr=true
Response.Write("<script language=javascript>alert('非法的id参数。');history.back(1);</script>")
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)
response.redirect "admin_pic.asp?action=pic"
elseif request.form("action")="editpiccat" then
if request.Form("id")="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须指定操作的对象!');history.back(1);</script>")
else
if not isInteger(request.form("id")) then
founderr=true
Response.Write("<script language=javascript>alert('非法的分类id参数。');history.back(1);</script>")
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
Response.Write("<script language=javascript>alert('你必须填写分类名称!');history.back(1);</script>")
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
Response.Write("<script language=javascript>alert('你必须指定操作的对象!');history.back(1);</script>")
else
if not isInteger(request.form("id")) then
founderr=true
Response.Write("<script language=javascript>alert('非法的分类id参数。');history.back(1);</script>")
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%>
<HTML><HEAD><TITLE>高贝系统 - 图片展示管理</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<link href="other/Admin.css" rel="stylesheet" type="text/css">
</HEAD>
<p align="center"><a href="admin_pic.asp?action=newpic">添加图片</a> | <a href="admin_pic.asp?action=pic">修改图片</a> | <a href="admin_pic.asp?action=piccat">分类管理</a> | <a href="admin_pic.asp?action=newpiccat">添加分类</a></p>
<body onkeydown=return(!(event.keyCode==78&&event.ctrlKey))>
<%
if request.querystring("action")="piccat" then
sql="select * from piccat order by piccat_id DESC"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table align="center" width="98%" align="center" border="1" cellspacing="0" cellpadding="4" style="border-collapse: collapse">
<tr>
<td colspan="3">
图片分类管理</td>
</tr>
<tr align="center">
<td width="10%">编号</td>
<td width="70%">分类名称</td>
<td width="20%">操作</td>
</tr>
<%do while not rs.eof%>
<tr>
<td align="center"><%=rs("piccat_id")%> </td>
<td><a href="#"><%=rs("piccat_name")%></a> </td>
<td align="center"><a href="admin_pic.asp?id=<%=rs("piccat_id")%>&action=editpiccat">编辑</a>
<a href="admin_pic.asp?id=<%=rs("piccat_id")%>&action=delpiccat">删除</a> <a href="pic.asp?piccat_id=<%=rs("piccat_id")%>" target="_blank">查看</a></td>
</tr>
<%rs.movenext
loop
if rs.bof and rs.eof then%>
<tr align="center">
<td colspan="3">当前没有分类!</td>
</tr>
<%rs.close
set rs=nothing
end if%>
</table>
<%end if
if request.querystring("action")="newpiccat" then%>
<table align="center" width="98%" align="center" border="1" cellspacing="0" cellpadding="4" style="border-collapse: collapse">
<form name="form1" method="post" action="">
<tr>
<td>
新增分类</td>
</tr>
<tr>
<td>分类名称-
<input type="text" name="piccat_name" size="40">
</td>
</tr>
<tr>
<td align="center">
<input type="submit" name="Submit" value="确定新增">
<input type="reset" name="Reset" value="清空重填">
</td>
</tr>
<input type="hidden" name="action" value="newpiccat">
<input type="hidden" name="MM_insert" value="true">
</form>
</table>
<%end if
if request.QueryString("action")="editpiccat" then
if request.querystring("id")="" then
Response.Write("<script language=javascript>alert('请指定操作的对象!');history.back(1);</script>")
response.end
else
if not isinteger(request.querystring("id")) then
Response.Write("<script language=javascript>alert('非法的分类ID参数!');history.back(1);</script>")
response.end
end if
end if
sql="select * from piccat where piccat_id="&cint(request.querystring("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table align="center" width="98%" align="center" border="1" cellspacing="0" cellpadding="4" style="border-collapse: collapse">
<form name="form1" method="post" action="">
<tr>
<td>
修改分类</td>
</tr>
<tr>
<td>分类名称-
<input name="piccat_name" type="text" id="piccat_name" size="40" value="<%=rs("piccat_name")%>">
</td>
</tr>
<tr>
<tdalign="center"> <input name="Submit" type="submit" id="Submit" value="确定修改">
<input name="Reset" type="reset" id="Reset" value="清空重填"> </td>
</tr>
<input type="hidden" name="id" value="<%=rs("piccat_id")%>">
<input type="hidden" name="action" value="editpiccat">
<input type="hidden" name="MM_insert" value="true">
</form>
</table>
<%end if
if request.QueryString("action")="delpiccat" then
if request.querystring("id")="" then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -