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

📄 admin_pic.asp

📁 政府网站集成OA办公考勤新闻发布网站信息管理会员管理
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->

<%
if WS_S.MemberPriv("WS_FrontSetPhoto")<>1 then HX_GoBack "对不起,您的权限不够!",""

dim totalpic,currentpage,totalpages,showye,founderr
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")="newpic" then
sql="select * from a125_p_news"
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=WS_s.HX_Replace(trim(replace(request.form("name"),"'","")))
picurl=WS_s.HX_Replace(trim(replace(request.form("url"),"'","")))
picpic=WS_s.HX_Replace(trim(replace(request.form("pic"),"'","")))
picspic=WS_s.HX_Replace(trim(replace(request.form("spic"),"'","")))
picdesc=WS_s.HX_Replace(trim(replace(request.form("desc"),"'","")))
picisbest=request.form("isbest")

Function GetStrLen(str)
If IsNull(str) Or str = "" Then
getStrLen = 0
Else
Dim i, n, k, chrA
k = 0
n = Len(str)
For i = 1 To n
chrA = Mid(str, i, 1)
If Asc(chrA) >= 0 And Asc(chrA) <= 255 Then
k = k + 1
Else
k = k + 2
End If
Next
getStrLen = k
End If
End Function 
if GetStrLen(picname)>22 then
  founderr=true
  Response.Write("<script language=javascript>alert('你图片标题不得超过11个汉字');history.back(1);</script>")
end if
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
    rs("author")=LOGINUSERNAME
    rs("department")=LOGdepartment
    rs("writerid")=LOGINUid 
if founderr then
  call diserror()
  response.end
else
  rs.update
  rs.close
  set rs=nothing
 	conn.Close
	Set conn=nothing
  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 a125_p_news where id="&cint(request.form("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
piccatid=cint(request.form("piccatid"))
picname=WS_s.HX_Replace(trim(replace(request.form("name"),"'","")))
picurl=WS_s.HX_Replace(trim(replace(request.form("url"),"'","")))
picpic=WS_s.HX_Replace(trim(replace(request.form("pic"),"'","")))
picspic=WS_s.HX_Replace(trim(replace(request.form("spic"),"'","")))
picdesc=WS_s.HX_Replace(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
	conn.Close
	Set conn=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 a125_p_news where id="&cint(request.form("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
  rs.delete
  rs.close
  set rs=nothing 	
 	conn.Close 
	Set conn=nothing
  response.redirect "admin_pic.asp?action=pic"
end if

end if%>
<HTML><HEAD><TITLE>网站管理系统 - 图片展示管理</title>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<link href="../HXinclude/HX_Style.css" rel="stylesheet" type="text/css">
</HEAD>
<body onkeydown=return(!(event.keyCode==78&&event.ctrlKey)) topmargin='20' leftmargin='0' bottommargin='0'>
<%
if request.querystring("action")="pic" then
    if WS_S.MemberPriv("WS_FrontSetadmin")=1 then
sql="select * from a125_p_news order by id desc"
if request.querystring("piccat_id")<>"" then
sql="select * from a125_p_news where piccat_id="&cint(request.querystring("piccat_id"))&" order by id desc"
end if
    else  
sql="select * from a125_p_news where writerid="&LOGINUid&" order by id desc"
if request.querystring("piccat_id")<>"" then
sql="select * from a125_p_news where piccat_id="&cint(request.querystring("piccat_id"))&" and writerid="&LOGINUid&" order by id desc"
end if
    end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
totalpic=rs.recordcount
%>
<p align="center"><a href="admin_pic.asp?action=newpic">添加图片</a> | <a href="admin_pic.asp?action=pic">修改图片</a></p>
<table width='596'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#115F8F'><tr><td colspan='2' bgcolor=ffffff>
 <table width='100%'  border='0' cellspacing='0' cellpadding='0'><form name="form3" method="post" action=""><tr><td height='25' background='../hximages/titleline.gif'><font class='fontmenu'>图片列表</font></td>
    <td align="right" width="20%" colspan="4" style="padding-top:2px;" background='../hximages/titleline_2.gif'>
      <select style="margin:-3px" name="go" onChange='window.location=form.go.options[form.go.selectedIndex].value'>
			  <option value="">选择显示方式</option>
			  <option value="admin_pic.asp?action=pic">显示所有图片</option>
<%sql="select * from a125_pic"
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
do while not rs2.eof%>
<option value="admin_pic.asp?action=pic&piccat_id=<%=rs2("piccat_id")%>"><%=rs2("piccat_name")%></option>
<%rs2.movenext
loop
if rs2.bof and rs2.eof then%><option value="">当前没有分类</option>
<%end if
rs2.close
set rs2=nothing%>
       </select>
      </td>
		</tr></form></table>
  <table width='100%'  border='0' cellspacing='1' cellpadding='3' bgcolor='#f1f1f1'>
    <tr bgcolor='#A1BBE0' class='td4'>
      <td width="30%" height="20" ><div align="center">图片</div></td>
      <td width="40%" height="20" ><div align='center'>图片名称</div></td>
      <td width="30%" height="23"><div align='center'>管理</div></td>
    </tr>
<%
dim picperpage
picperpage=10

if not rs.eof then
rs.movefirst
rs.pagesize=picperpage
if trim(request("page"))<>"" then
   currentpage=clng(request("page"))
   if currentpage>rs.pagecount then
      currentpage=rs.pagecount
   end if

⌨️ 快捷键说明

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