editnews.asp

来自「百堂数字点卡程序v1.0后台路径:http://域名/admin 管理帐号和密码」· ASP 代码 · 共 80 行

ASP
80
字号
<%@ CODEPAGE = "936" %>
<!--#include file="conn.asp"-->
<%
if session("admin_rank")<>1 and session("admin_rank")<>5 then
response.write("<script>alert('您无权查看本页,SORRY!');window.location=('login.asp')</script>")
response.end
end if
%>
<%
function htmlencode(str)
htmlencode=replace(replace(replace(str,chr(13),"<br>"),"'","''"),chr(32),"&nbsp;")
end function
%>
<%
function modifycode(str)
modifycode=replace(replace(replace(str,"<br>",chr(13)),"'","''"),"&nbsp;",chr(32))
end function
%>

<%
set rs=server.createobject("adodb.recordset")
%><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css.css">
</head>
<%
if request("action")="save" then
sql="select * from news where news_id="&int(request("news_id"))
rs.open sql,conn,3,3
rs("news_title")=request("news_title")
rs("news_content")=htmlencode(request("news_content"))
rs("news_date")=date()
rs.update
response.write("<script>alert('修改新闻成功!');window.location=('delnews.asp')</script>")
response.end
rs.close
else
%>
<body style="background-color: #F0FBF1">

<div align="center">
<table border="0" width="780" cellspacing="1">
<tr>
<td width="100%">
<form method="POST" action="editnews.asp?action=save">
<input type="hidden" name="news_id" value="<%=int(request("news_id"))%>">
<table border="1" width="780" cellspacing="0" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" cellpadding="0" height="210">
<%sql="select * from news where news_id="&int(request("news_id"))
rs.open sql,conn,3,3 %>
<tr> 
</tr>
<tr> 
<td width="100%" style="padding-left: 10px">商城动态标题:
<input type="text" name="news_title" size="20" class=input value="<%=rs("news_title")%>">
</td>
</tr>
<tr> 
<td width="100%" style="padding-left: 10px">新闻内容:</td>
</tr>
<tr> 
<td width="100%" style="padding-left: 10px" height="141">
<textarea rows="9" name="news_content" cols="77" class=input><%=modifycode(rs("news_content"))%></textarea>
            </td>
          </tr>
        </table>
        <p>&nbsp;&nbsp;&nbsp;&nbsp; <input type="submit" value="提交" name="B1" class=input>&nbsp;&nbsp;&nbsp;
		<input type="reset" value="重写" name="B2" class=input></p>
      </form>
 </td>
  </tr>
</table>
</div>

<%
end if
set rs=nothing
conn.close
set conn=nothing
%>

⌨️ 快捷键说明

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