📄 modify.asp
字号:
<!-- #include file="function.asp" -->
<!-- #include file="code.asp" -->
<%
myfilename="modify.asp"
username=Request.Cookies("username")
userpass=Request.Cookies("userpass")
id=int(Request("id"))
thisttime=Now()
dim listid, modifytimeout
if Request.Cookies("username")=empty or Request.Cookies("userpass")=empty then
error("您还未登录论坛")
message="<li>您还未登录论坛<li><a href=./ulogin.asp>返回登录口</a>"
succeed(""&message&"<meta http-equiv=refresh content=1;url=./ulogin.asp>")
Response.End
end if
set rs=server.createobject("ADODB.Recordset")
sql="select distinction,userface from [user] where username='"&username&"'"
rs.Open sql,Conn,1,1
distinction=Rs("distinction")
userface=Rs("userface")
rs.close
qqwmcopayout=""
sql="select txttitle,username,upid,content,posttime from list,forum where list.id="&id&" and forum.listid=list.id"
rs.Open sql,Conn,1,1
txttitle=rs("txttitle")
upid=rs("upid")
zzname=rs("username")
content=rs("content")
posttime=rs("posttime")
rs.close
if distinction<3 and zzname<>username then error("您没有编辑该文章的权利")
if action="modify" and Request.ServerVariables("request_method") = "POST" then
icon=Request("icon")
txttitle=HTMLEncode(Trim(Request.Form("txttitle")))
content=ContentEncode(RTrim(Request.Form("content")))
if Len(txttitle)<3 then error("文章标题不能小于 3 字符")
if Len(content)>contentlen then error("内容太长,不能超过"&contentlen&"字节")
if Len(content)<3 then error("<文章内容不能小于 3 字符")
if badwords<>empty then
filtrate=split(badwords,"|")
for i = 0 to ubound(filtrate)
txttitle=ReplaceText(txttitle,""&filtrate(i)&"",string(len(filtrate(i)),"*"))
content=ReplaceText(content,""&filtrate(i)&"",string(len(filtrate(i)),"*"))
next
end if
'''''''''''''''''''''''''''''''''''
sql="select * from [list] where id="&id
rs.Open sql,Conn,1,3
rs("icon")=icon
rs("txttitle")=txttitle
rs.update
rs.close
sql="select * from [forum] where listid="&id
rs.Open sql,Conn,1,3
rs("content")=content
rs.update
rs.close
'''''''''
Set rs=Nothing
''''''''''''''''''''''
htmlfilename=id
if upid=0 or upid=empty then upid=id
content = ubb(content)
modifytimeout=""
if ifmodifytime=1 then modifytimeout="本帖在"&thisttime&"被"&username&"重新编辑"
set fileobject = Server.CreateObject("Scripting.FileSystemObject")
TempletTopPath=Server.MapPath("templet\top.html")
TempletBottomPath=Server.MapPath("templet\bottom.html")
set TOPTEMP=fileobject.openTextFile(TempletTopPath,,True)
set BOTTOMTEMP=fileobject.openTextFile(TempletBottomPath,,True)
topt=TOPTEMP.ReadAll
bottomt=BOTTOMTEMP.ReadAll
topt=replace(topt,"<#qqwmbbstitle#>", txttitle)
topt=replace(topt,"<#qqwmbbsusername#>", username)
topt=replace(topt,"<#qqwmbbsuserface#>", userface)
bottomt=replace(bottomt,"<#qqwmbbsposttime#>", posttime)
set addhtmlfile = fileobject.CreateTextFile(Server.MapPath(".")&"\html\"&upid&"\"&htmlfilename&wmhtmlkzn)
addhtmlfile.writeline topt
addhtmlfile.writeline("<table width='100%' border='0' cellspacing='0' cellpadding='0'>")
addhtmlfile.writeline("<tr><td height='20' align='right' class='unnamed1'><a href=../../>返回首页</a> 阅读:<font color=red><script src=../../count.asp?id="&id&"></script></font> 次 <a href=../../reply.asp?upid="&upid&">回复主题</a> <a href=../../modify.asp?id="&id&">作者编辑</a> <a href=javascript:location.reload()>刷新文章</a> <a href=javascript:window.close()>关闭本页</a></td></tr>")
addhtmlfile.writeline("<tr><td valign=top class=unnamed2>"&content&"<br>"&qqwmcopayout&modifytimeout&"</td></tr>")
addhtmlfile.writeline("<tr><td class=adstd id=wmbbscontentads> </td></tr>")
addhtmlfile.writeline("</table>")
addhtmlfile.writeline bottomt
Response.Cookies("posttime")=now'在COOKIE里记录发表时间
message="<li>新主题发表成功<li><a href=./>返回论坛首页</a>"
succeed(""&message&"<meta http-equiv=refresh content=3;url=html/"&upid&"/"&htmlfilename&wmhtmlkzn&">")
Response.End
end if'结束存数及生成HTML网页
Set rs=Nothing'
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<Meta name="description" content="www.qqwwm.com">
<title><%=forumname%></title>
<style type=text/css>
<!--
body, td, p, a{font-family:宋体;font-size:9pt; text-decoration:none}
a, a.visited{text-decoration:none;color:#000000}
a:hover{text-decoration:none;color:#FF0000}
-->
</style>
<style>
.gray {CURSOR:hand;filter:gray}
</style>
</head>
<body>
<script>
function storeCaret(textEl) {if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();}
function HighlightAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
therange=tempval.createTextRange()
therange.execCommand("Copy")}
function DoTitle(addTitle) {
var revisedTitle;var currentTitle = document.FORM.intopictitle.value;revisedTitle = addTitle+currentTitle;document.FORM.intopictitle.value=revisedTitle;document.FORM.intopictitle.focus();
return;}
</script>
<form name="FORM" action="<%=myfilename%>" method="post" onSubmit="if(this.name.value==''){alert('请填写用户名');return false}else{if(this.pass.value==''){alert('请填写密码');return false}else{if(this.txttitle.value==''){alert('请填写标题');return false}else{if(this.content.value==''){alert('请输入内容');return false}}}}">
<input type="hidden" name="action" value="modify">
<input type="hidden" name="id" value="<%=id%>">
<table cellSpacing="0" cellPadding="0" width="650" align="center" border="0">
<tr>
<td colSpan="3" height="29">
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td width="7">
<img alt src="images/topbg_01.gif" width="7" height="29"></td>
<td background="images/topbg_02.gif">
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td width="3%"></td>
<td vAlign="center" align="left" width="85%"> <font color="#ffffff"><b><?=$home_name?></b></font></td>
<td align="right" width="12%">
</td>
</tr>
</table>
</td>
<td width="8">
<img alt src="images/topbg_03.gif" width="8" height="29"></td>
</tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -