www.gusucode.com > 维六酷博客管理系统 1.1源码程序 > articleframe.asp

    <!-- #include file="conn.asp" -->
<!-- #include file="inc/function.asp" -->
<!--#include file="inc/asppage.asp"-->
<%
If RequestFormStr("action")="save" Then
	Call save()
End If
Dim id,strContent,strTitle
id=RequestQueryNum("id")
password2=RequestFormStr("password2")
Set rs=conn.Execute("Select * From notebook Where id="&id)
strTitle=rs("title")
strContent=rs("content")
hits=rs("hits")
password=rs("password")
posttime=rs("posttime")
Set rs=nothing
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> articleframe </TITLE>
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<link href="css/css.css" rel="stylesheet" type="text/css" />
<style type="text/css">

body {
	background-color: #000000;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	SCROLLBAR-FACE-COLOR:#000000;
}
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #FFFFFF;
}
.STYLE2 {color: #CCCCCC;}
.STYLE3 {font-family: "宋体"}
.STYLE4 {font-size: 10px}
.white{color:#FFFFFF;}
-->
</style>
</HEAD>

<BODY bgcolor="#000000">
<center>
<h4><%=strTitle%></h4>
发表日期:<%=Year(posttime) &"-"&Month(posttime)&"-"&Day(posttime)%>&nbsp;&nbsp;点击:<%=hits%>次
</center>
<%
If password<>"" Then
	If password2<>"" then
		If password=password2 Then
			Response.Write strContent
			conn.Execute("update notebook set hits=hits+1 Where id="& id &"")
		Else
			Call MessageBox("密码不正确!","")
			Response.End
		End If
	Else
%>

		<form name="pass" action=""method="post">
			<input type="hidden" name="id" value="<%=id%>">
			此文章作者已经加密,请输入密码:<input type="password" name="password2" size="10" class="css">
			<input type="submit" name="submit" value="提交" class="css">
		</form>
<%
	End If
Else
	Response.Write strContent
	conn.Execute("update notebook set hits=hits+1 Where id="& id &"")
End If
%>
<%

Call show()
Randomize 
codes = Int((9999 - 1000 + 1) * Rnd + 1000)
session("codes")=codes
If siteIsComment=True then
%>
<table align="center" width="450"  border="0" cellpadding="0" cellspacing="0" class="border" style="padding-left:5px;">
<form name="form1" action="articleFrame.asp?id=<%=id%>" method="post">
<input type="hidden" name="action" value="save">
<input type="hidden" name="id" value="<%=id%>">
<tr><td colspan="2" >发表评论:</td></tr>
	<tr>
		<td align="right">昵称</td>
		<td width="100" height="25" align="left">
		<input type="text" name="title" id="name" size="10" maxlength="10" value="昵称" onclick="this.value='';" onmouseout="javascript:if (this.value=='') {this.value='昵称';}" style="color:#999999;" class="border"></td>
	</tr>
	<tr>
		<td align="right">内容:</td>
		<td >
		<textarea rows="5" cols="40" name="content" class="border"></textarea>
		</td>
	</tr>
	<tr>
		<td align="right">验证码:</td>
		<td width="100" height="25">
			<input type="text" name="codes" id="name" size="10" maxlength="10" class="border"><font color=red><%=codes%></font></td>
	</tr>
	<tr>
		<td></td>
		<td><input type="submit" name="submit" value="发表"></td></tr>
	</form>
</table>
<%
End If
%>
</BODY>
</HTML>
<%
Sub save()
	title=requestFormStr("title")
	content=requestFormStr("content")
	codes=requestFormNum("codes")
	id=requestFormNum("id")
	'response.write title&"<br>"&content&"<br>"&codes&"<br>"
	If siteIsComment=False Then
		Call MessageBox("评论功能已经关闭!","")
		response.End
	End If
	If title="" Or title="昵称" Then
		Call MessageBox("请输入您的昵称!","")
		response.End
	End If
	If content=""  Then
		Call MessageBox("请输入评论内容!","")
		response.End
	End If
	If codes<>session("codes") Then
		Call MessageBox("验证码不正确!","")
		response.End
	End If
	sql="select * from comment"
	set rs=Server.CreateObject("ADODB.Recordset")
	rs.open sql,conn,1,3
	rs.addNew
		rs("title")=title
		rs("content")=content
		rs("reid")=id
	rs.Update
	Set rs=Nothing
		Call MessageBox("评论成功!","articleframe.asp?id="&id)
		response.End
End Sub

Sub show()
	sql="Select * From comment where reid="& id &" order by id desc"
	Set mypage=new xdownpage   '创建对象
	mypage.getconn=conn    '得到数据库连接
	mypage.getsql=sql
	mypage.pagesize=20    '设置每一页的记录条数据为5条
	set rs=mypage.getrs()    '返回Recordset
%>
	<table align="center" width="450"  border="0" cellpadding="0" cellspacing="0" class="border" style="margin-top:15px;">
	<tr><td colspan="2" height="1" bgcolor="#999999"></td></tr>
	<%
		for i=1 to mypage.pagesize 
			If rs.eof Then
				Exit for
			End If
	%>
		<tr><td width="90" height="25">昵称:<%=rs("title")%></td><td>评论时间:<%=rs("posttime")%></td></tr>
		<tr><td align="right"></td><td>评论内容:<br><%=HTMLEncode(rs("content"))%></td></tr>
		<tr><td colspan="2" height="1" bgcolor="#999999"></td></tr>
	<%
	rs.MoveNext
	Next
	%>
	</table>
<%
End Sub
%>