一个BBS的源代码(五)
程序员文章站
2022-07-04 11:47:06
=================================case "modify"================================ 修改文章which =...
=================================
case "modify"
================================
修改文章
which = request("which")
whichid = getid( which )
if left( which , 1 ) = "e" then table = "bbs" else table = "bbsreply"
wrongmsg = ""
if request("modify") = "yes" then
userid = request("userid")
password = request("password")
title = trim(request("title"))
content = rtrim(request("content"))
if title = "\" then wrongmsg = wrongmsg + "<dd><li>题目不能为空。</li>"
if content = "" then wrongmsg = wrongmsg + "<dd><li>内容不能为空。</li>"
if wrongmsg = "" then
recbbs.open "select [作者] from " & table & " where [序号]=" & whichid , con , 1
if recbbs.fields("作者") = userid then
sql = "select count(*) from bbsmember where [账号]=" & sqlstr(userid) & " and [密码]=" & sqlstr(password) & ""
recmember.open sql , con , 1
if recmember.fields(0) > 0 then
sql = "update " & table & " set [题目]=" & sqlstr(title) & ",[内容]=" & sqlstr(content) & " where [序号]=" & whichid
con.execute( sql )
else
wrongmsg = "<dd><li>密码不正确。</li>"
end if
recmember.close
else
wrongmsg = "<dd><li>用户名不正确。</li>"
end if
recbbs.close
end if
end if
title = "\"
content = ""
sql = "select [题目],[内容] from " & table & " where [序号]=" & whichid
recbbs.open sql , con , 1
if not recbbs.eof then
title = recbbs.fields("题目")
content = recbbs.fields("内容")
end if
recbbs.close
%>
<table align=center border=0 cellpadding=1 cellspacing=0 width=650>
<tr>
<td class="menu">
<a href="/">飞林庄</a>-><a href="<%= asp_file_name %>">经验交流</a>-><a href="<%= asp_file_name %>?job=content&which=<%= session("bbs_which") %>"><%= session("bbs_whichtitle") %></a>
<% if wrongmsg <> "" then %>
<br><br>修改失败!<br><br>
<%= wrongmsg %><br>
<% else %>
<br><br>修改成功!<br><br>
<% end if %>
<form action="<%= asp_file_name %>" method=post>
<input type=hidden name=job value=modify>
<input type=hidden name=modify value=yes>
<input type=hidden name=which value="<%= which %>">
账号:<input type=text id=userid name=userid size=30 maxlength=80><br>
密码:<input type=password id=password name=password size=30 maxlength=80><br><br>
题目:<input type=text id=title name=title value="<%= title %>">
<textarea id=content name=content cols=80 rows=16><%= content %></textarea><br>
<input type=submit value="确认修改">
</form>
</td>
</tr>
</table>
<%
===============================
case "apply"
===============================
申请账号
%>
<table align=center border=0 cellpadding=7 cellspacing=0 width=650>
<tr>
<td class=menu>
<form action="<%= asp_file_name %>" method=post>
<input type=hidden name=job value=adduser>
<p>飞林庄->经验交流->注册账号</p>
case "modify"
================================
修改文章
which = request("which")
whichid = getid( which )
if left( which , 1 ) = "e" then table = "bbs" else table = "bbsreply"
wrongmsg = ""
if request("modify") = "yes" then
userid = request("userid")
password = request("password")
title = trim(request("title"))
content = rtrim(request("content"))
if title = "\" then wrongmsg = wrongmsg + "<dd><li>题目不能为空。</li>"
if content = "" then wrongmsg = wrongmsg + "<dd><li>内容不能为空。</li>"
if wrongmsg = "" then
recbbs.open "select [作者] from " & table & " where [序号]=" & whichid , con , 1
if recbbs.fields("作者") = userid then
sql = "select count(*) from bbsmember where [账号]=" & sqlstr(userid) & " and [密码]=" & sqlstr(password) & ""
recmember.open sql , con , 1
if recmember.fields(0) > 0 then
sql = "update " & table & " set [题目]=" & sqlstr(title) & ",[内容]=" & sqlstr(content) & " where [序号]=" & whichid
con.execute( sql )
else
wrongmsg = "<dd><li>密码不正确。</li>"
end if
recmember.close
else
wrongmsg = "<dd><li>用户名不正确。</li>"
end if
recbbs.close
end if
end if
title = "\"
content = ""
sql = "select [题目],[内容] from " & table & " where [序号]=" & whichid
recbbs.open sql , con , 1
if not recbbs.eof then
title = recbbs.fields("题目")
content = recbbs.fields("内容")
end if
recbbs.close
%>
<table align=center border=0 cellpadding=1 cellspacing=0 width=650>
<tr>
<td class="menu">
<a href="/">飞林庄</a>-><a href="<%= asp_file_name %>">经验交流</a>-><a href="<%= asp_file_name %>?job=content&which=<%= session("bbs_which") %>"><%= session("bbs_whichtitle") %></a>
<% if wrongmsg <> "" then %>
<br><br>修改失败!<br><br>
<%= wrongmsg %><br>
<% else %>
<br><br>修改成功!<br><br>
<% end if %>
<form action="<%= asp_file_name %>" method=post>
<input type=hidden name=job value=modify>
<input type=hidden name=modify value=yes>
<input type=hidden name=which value="<%= which %>">
账号:<input type=text id=userid name=userid size=30 maxlength=80><br>
密码:<input type=password id=password name=password size=30 maxlength=80><br><br>
题目:<input type=text id=title name=title value="<%= title %>">
<textarea id=content name=content cols=80 rows=16><%= content %></textarea><br>
<input type=submit value="确认修改">
</form>
</td>
</tr>
</table>
<%
===============================
case "apply"
===============================
申请账号
%>
<table align=center border=0 cellpadding=7 cellspacing=0 width=650>
<tr>
<td class=menu>
<form action="<%= asp_file_name %>" method=post>
<input type=hidden name=job value=adduser>
<p>飞林庄->经验交流->注册账号</p>
上一篇: 网站外链如何合理布局