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

📄 edit_xinxi.asp

📁 网上学生心里调查系统
💻 ASP
字号:
<!--#include file="config.asp" -->
<!--#include file="check.asp" -->
<%
id=trim(request("id"))
if id="" then
  response.write "<a href='javascript:history.back(1)'>请选择编号!</a>"
  response.end
end if
%>
<%
errwrite="错误!请确定您的权限!请您<a href='javascript:history.back(1)'>&gt;&gt;返回&lt;&lt;</a><br>或尝试<a href='edit_login.asp?id="&id&"'>重新登陆</a>!"

if len(session("quhao"))=0 or len(session("guanli"))=0 then
  response.redirect ("edit_login.asp?id=" & id)
  'response.write errwrite
  response.end
end if

set rs=server.CreateObject("adodb.recordset")
rs.open"select * from xinxi where 编号="&id,conn,1,1
if not rs.eof then
  if session("quhao")<>rs("城市") then
     response.write errwrite
     response.end
   end if
end if
set rscity=server.CreateObject("adodb.recordset")
rscity.open"select * from city where 区号='"& rs("城市")&"'",conn,1,1

if not rscity.eof then

	str=rscity("管理")
	checkgl=false
	if str="" then errwrite
	str=split(Cstr(str),"|")
	for i=0 to Ubound(str)
	  if session("guanli")=Lcase(str(i)) then
		checkgl=true
	    exit for
	  else
		checkgl=false
	  end if
	next
	 
  if checkgl=false then
     response.write errwrite
     response.end
   end if
end if
rscity.close
rs.close
set rscity=nothing
set rs=nothing
%>
<%
leibie=trim(request.form("leibie"))
name=trim(request.form("name"))
about=trim(request.form("about"))
address=trim(request.form("address"))
bus=trim(request.form("bus"))
site=trim(request.form("site"))
tel=trim(request.form("tel"))
pic1=trim(request.form("pic1"))
pic2=trim(request.form("pic2"))
pic3=trim(request.form("pic3"))
ctype=request.form("ctype")
tuijian=request.form("tuijian")
tui=request.form("tui")
if ctype="ok" then
  ctype="-1"
else
  ctype="0"
end if
if tui="ok" then
  tui="-1"
else
  tui="0"
end if

set rs=server.CreateObject("adodb.recordset")
if  name<>"" and leibie<>"" and about<>"" then
  rs.open"select * from xinxi where 编号="&id,conn,3,3
  
  rs("名称")=name
  rs("类别")=leibie
  rs("介绍")=about
  rs("地址")=address
  rs("公交")=bus
  rs("网站")=site
  rs("电话")=tel
  rs("图片1")=pic1
  rs("图片2")=pic2
  rs("图片3")=pic3
  rs("推荐指数")=tuijian
  rs("审核")=ctype  
  rs("推荐")=tui
  rs("日期")=date()
 
  rs.update
  rs.close
  set rs=nothing
  response.write "<font color=red>修改成功!</font>"
end if
%>

<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>资讯信息修改</title>
<link href="admin.css" rel="stylesheet" type="text/css">
<script language="VBScript">
<!--
''=======================================================''
''函数作用:检测添加资讯时的信息是否符合要求
''=======================================================''
function checkzx()
if len(edit_zx.name.value)=0 or getStrLen(edit_zx.name.value)>16 then
  msgbox"请输入资讯名称!(8汉字内)"
  edit_zx.name.focus
elseif edit_zx.leibie.value="0" then
  msgbox"请选择资讯类别!"
  edit_zx.leibie.focus
elseif len(edit_zx.about.value)=0 or Len(edit_zx.about.value)>240 then
  msgbox"请输入文字介绍!(240字内)"
  edit_zx.about.focus
elseif Len(edit_zx.address.value)>200 then 
  msgbox"您输入的地址太长了,请控制在200个字内!"
  edit_zx.address.focus
elseif Len(edit_zx.bus.value)>200 then 
  msgbox"您输入的公交地址太长了,请控制在200个字内!"
  edit_zx.bus.focus
elseif Len(edit_zx.site.value)>150 then 
  msgbox"您输入的网址太长了,请控制在150字内!"
  edit_zx.site.focus
elseif len(edit_zx.tel.value)>200 then 
  msgbox"您输入的电话信息太长了,请控制在200个字符内!"
  edit_zx.tel.focus  
elseif len(edit_zx.pic1.value)>200 then 
  msgbox"您输入的图片地址太长了,请控制在200个字符内!"
  edit_zx.pic1.focus  
elseif edit_zx.pic2.value<>"http://" and (edit_zx.pic1.value="http://" or len(edit_zx.pic1.value)=0) then 
  msgbox"请先填写图片1的地址"
  edit_zx.pic1.focus  
elseif len(edit_zx.pic2.value)>200 then 
  msgbox"您输入的图片地址太长了,请控制在200个字符内!"
  edit_zx.pic2.focus  
elseif edit_zx.pic3.value<>"http://" and (edit_zx.pic1.value="http://" or len(edit_zx.pic1.value)=0 or edit_zx.pic2.value="http://" or len(edit_zx.pic2.value)=0) then 
  msgbox"请先填写图片1和图片2的地址"
  edit_zx.pic1.focus  
elseif len(edit_zx.pic3.value)>200 then 
  msgbox"您输入的图片地址太长了,请控制在200个字符内!"
  edit_zx.pic3.focus   
elseif not(asc(edit_zx.tuijian.value)>=49 and asc(edit_zx.tuijian.value)<=53) then 
  msgbox"请输入数字1~5!"
  edit_zx.tuijian.focus
else
  edit_zx.submit
end if
end function
-->
</script>

</head>
<body leftmargin="5" topmargin="5">
<div align="<%=sitealign%>">
    <%set rs=server.CreateObject("adodb.recordset")
     rs.open"select * from xinxi where 编号="&id,conn,1,1
     if not rs.eof then
     %>
<!--表单开始-->
<table border="0" cellpadding="5" cellspacing="0" style="border:1px solid #D2E7F4; border-collapse: collapse" width="500">
  <form method="POST" action="edit_xinxi.asp?id=<%=id%>" name="edit_zx">
  <tr>
    <td width="50" align="right" height="35" bgcolor="#EBF4FA">城市:</td>
    <td width="450" bgcolor="#EBF4FA"><%set rscity=server.CreateObject("adodb.recordset")
        rscity.open "select * from city where 区号='" &rs("城市")&"'",conn,1,1
        response.write rscity("城市") & "市 (" & rscity("区号") & " | " & rscity("省份") &")"
		rscity.close
		set rscity=nothing%></td>
  </tr>
  <tr>
    <td align="right" height="35">类别:</td>
    <td>
      <select size="1" name="leibie">
      <option selected value="0">---请选择类别---</option>
       <%set rslb=server.CreateObject("adodb.recordset")
        rslb.open "select * from leibie order by 类别编号",conn,1,1
        while not rslb.eof
          if rslb("类别编号")=rs("类别")  then
            response.write"<option value='" &rslb("类别编号")& "' selected>" &rslb("类别名")& "</option>"
          else
            response.write"<option value='" &rslb("类别编号")& "'>" &rslb("类别名")& "</option>"
          end if
        rslb.movenext
        wend
		rslb.close
		set rslb=nothing%>
      </select>
    </td>
  </tr>
  <tr>
    <td align="right" height="35" bgcolor="#EBF4FA">名称:</td>
    <td bgcolor="#EBF4FA">
      <input type="text" name="name" size="46" value="<%=rs("名称")%>">(8汉字内)</td>
  </tr>
    <tr>
    <td align="right" height="35">介绍:</td>
    <td><textarea rows="7" name="about" cols="48"><%=rs("介绍")%></textarea>(240字内)</td>
  </tr>
    <tr>
    <td align="right" height="35" bgcolor="#EBF4FA">地址:</td>
    <td bgcolor="#EBF4FA"><textarea rows="4" name="address" cols="48"><%=rs("地址")%></textarea>(200字内)</td>
  </tr>
  <tr>
    <td align="right" height="35">公交:</td>
    <td><textarea rows="3" name="bus" cols="48"><%=rs("公交")%></textarea>(200字内)</td>
  </tr>
    <tr>
    <td align="right" height="35" bgcolor="#EBF4FA">网站:</td>
    <td bgcolor="#EBF4FA">
      <input type="text" name="site" size="50" value="<%=rs("网站")%>"></td>
  </tr>
    <tr>
    <td align="right" height="35">电话:</td>
    <td>
      <input type="text" name="tel" size="50" value="<%=rs("电话")%>"></td>
  </tr>
  <tr>
    <td align="right" height="35" bgcolor="#EBF4FA">图1:</td>
    <td bgcolor="#EBF4FA">
      <input type="text" name="pic1" size="50" value="<%=rs("图片1")%>"> <%if rs("图片1")<>"" and rs("图片1")<>"http://" then response.write ("<a target='_blank' href='"&rs("图片1")&"'>查看图1</a>") end if%>
</td>
  </tr>
    <tr>
    <td align="right" height="35">图2:</td>
    <td>
      <input type="text" name="pic2" size="50" value="<%=rs("图片2")%>"> <%if rs("图片2")<>"" and rs("图片2")<>"http://" then response.write ("<a target='_blank' href='"&rs("图片2")&"'>查看图2</a>") end if%>
</td>
  </tr>
    <tr>
    <td align="right" height="35" bgcolor="#EBF4FA">图3:</td>
    <td bgcolor="#EBF4FA">
      <input type="text" name="pic3" size="50" value="<%=rs("图片3")%>"> <%if rs("图片3")<>"" and rs("图片3")<>"http://" then response.write ("<a target='_blank' href='"&rs("图片3")&"'>查看图3</a>") end if%></td>
  </tr>
  <tr>
    <td align="right" height="35" bgcolor="#FFFFFF">推荐:</td>
    <td bgcolor="#FFFFFF">
      <input type="text" name="tuijian" size="5" value="<%=rs("推荐指数")%>" maxlength="1">&nbsp;(数字1-5,5最高)
      <img border="0" src="images/level<%=rs("推荐指数")%>.gif"></td>
  </tr>
  <tr>
    <td align="right" height="35" bgcolor="#EBF4FA">更新:</td>
    <td bgcolor="#EBF4FA">
      <input type="text" name="cdate" size="22" value="<%=rs("日期")%>" readonly style=background:#d3d3d3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    审核:<input type="checkbox" name="ctype" value="ok" <%if rs("审核")=-1 then%>checked<%end if%>>&nbsp;&nbsp; 
    推荐:<input type="checkbox" name="tui" value="ok" <%if rs("推荐")=-1 then%>checked<%end if%>></td>
  </tr>
  <tr>
    <td align="right" height="35" bgcolor="#FFFFFF"> </td>
    <td bgcolor="#FFFFFF">
    <input type="button" value=" 提 交 " name="admin"  onclick="checkzx()">&nbsp;&nbsp;
    <input type="reset" value=" 重 置 " name="B2"></td>
  </tr></form>
</table>
<!--表单结束-->
<%
end if
rs.close
set rs=nothing
%>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse"  width="500">
  <tr>
    <td align="right" width="480" height="40">管理选项:<a href="xinxi.asp?id=<%=id%>">资讯查看</a> | <a href="edit_xinxi.asp?id=<%=id%>">资讯管理</a> | 
    <a href="edit_zxbook.asp?id=<%=id%>">资讯评论管理</a> | 
    <a href="edit_login.asp">管理登陆</a> | 
    <a href="edit_logout.asp">退出登录</a></td>
    <td width="20"> </td>
  </tr>
</table>
</div>
</body>
</html>

⌨️ 快捷键说明

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