<!--#include file="../p_inc/Include_func.asp"-->
<!--#include file="../p_inc/openconn.asp"-->
<%
'留言信息保存
'保存留言次数
'1:网址异常举报 2:求 
IF Not ChkPost() Then
	response.Redirect "./"
	response.End()
End IF
Response.Buffer=True
response.contenttype="text/html;charset=gb2312"
Dim ranNum

Dim u,c,ip,datee
IF Request.Cookies("q")("soojs_u")<>"" Then
	u=Request.Cookies("q")("soojs_u")
Else
	'产生随机数，避免与现在的ID重复 
	randomize
	ranNum=int(900*rnd)+100
	'u=replace(request("n_name"),"'","")	&"_"&ranNum
	u=replace(request("n_name"),"'","")
End IF
Dim temp_sql,gb_jiange,m_type
c=request("n_content")
m_type=Replace(request("m_type"),"'","")
m_type=StayNub(m_type):IF m_type="" Then m_type=3
datee=FormatDate(now,55)
ip=getIP()
gb_jiange=request.cookies("gbook")("add")
Dim temp_jg
temp_jg=DateDiff("s",gb_jiange,now())
IF u<>"" and trim(c)<>"" Then
	IF temp_jg<30 Then
		response.Write "<div style=""text-align:center"" id=""liuyan_jiange""><font color=red>您的提交的太频繁，还有"&Cint(30-temp_jg)&"秒您才可以发布下一次留言谢谢！</font></div>"
	Else
		Dim ss_sql
		ss_sql="select * from qingtiandy_gbook"
		Set ss_rs=server.CreateObject(G_RS)
		ss_rs.open ss_sql,conn,1,3
		ss_rs.addnew
		ss_rs("g_m_name")=u
		ss_rs("g_m_content")=c
		ss_rs("g_ip")=ip
		ss_rs("g_m_date")=datee
		ss_rs("g_type")=m_type
		ss_rs.update
		Response.cookies("gbook")("add")=now()'留言间隔
	End IF
End IF

set rs=server.CreateObject(G_RS)
rs.open "select g_m_name,g_m_content,g_ip,g_m_date,g_hname,g_hcontent,id,g_hdate,g_type from qingtiandy_gbook Where g_type=2 order by id desc",conn,1,1

'输出内容
		response.Write "<div style=""text-align:center"" id=""liuyan_jiange""></div>"
Dim s_str
s_str=""
if rs.eof then
	s_str=s_str&"<DIV class=bai>"&vbcrlf
	s_str=s_str&"<DIV class=""t3_favor bcg bgg""><SPAN style=""PADDING-RIGHT: 10px; FLOAT: right"">"&ForMatDate(now(),55)&"</SPAN><SPAN style=""PADDING-LEFT: 10px;font-weight:bold""><CS2 />Admin</SPAN></DIV>"&vbcrlf
	s_str=s_str&"<DIV class=""b3 bcg mb12"">"&vbcrlf
	s_str=s_str&"<DIV class=p90>"&vbcrlf
	s_str=s_str&"<DIV class=""f14 wr"">欢迎您提供建议，请务发垃圾信息，谢谢配合！</DIV>"&vbcrlf
	s_str=s_str&"<div id=""Lg""></div>"&vbcrlf
	s_str=s_str&"</div>"&vbcrlf
	response.Write s_str
else
	count=ubound(rs.getrows,2)+1
	pagesize=5
	if (count mod pagesize)=0 then pagecount= count \ pagesize else pagecount= (count \ pagesize)+1
	if request("page")<>"" then page=int(request("page"))
	if page<=0 or page = "" then page=1
	if page>pagecount then page=pagecount
	rs.movefirst
	rs.move pagesize*(page-1)
'分页
	str=""
	if pagecount>1 Then
		if page>1 Then
			str=str&" <a href=# onclick=ff(1) class=page1>首页</a>"
			str=str&" <a href=# onclick=ff("&page-1&") class=page1>上一页</a>"
			if page<pagecount Then
				str=str&" <a href=# onclick=ff("&page+1&") class=page1>下一页</a>"
				str=str&" <a href=# onclick=ff("&pagecount&") class=page1>尾页</a>"
			else
				str=str&" 下一页"
				str=str&" 尾页"		
			end if
		else
			str=str&" 首页"
			str=str&" 上一页"
			str=str&" <a href=# onclick=ff("&page+1&") class=page1>下一页</a>"
			str=str&" <a href=# onclick=ff("&pagecount&") class=page1>尾页</a>"	
		end if
	end if
%>
<div align=center style=" font-size:14px;">共 <font color=red><b><%=count%></b></font> 条记录 每页显示<%=pagesize%>条记录  <%=str%>   <%=page%> / <%=pagecount%> 跳转到<input type="text" size="2" id="p" value="<%=page%>"/>页<input type="button" value="Go" onclick="ff($('p').value)"/></div><br />
<%	
		Dim i_i_a
		i_i_a=1
			Function IsValidUrl(str) 
			Dim regEx 
			Set regEx = New RegExp 
			regEx.Pattern = "(http(s)?://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?)" 
			regEx.IgnoreCase = True         ' 设置是否区分字符大小写。
			regEx.Global = True             ' 设置全局可用性。	
			Set Matches = regEx.Execute(str)
			
			For Each Match in Matches
				ReturnStr = Match.Value
				str=replace(str,ReturnStr,"<a href='"&ReturnStr&"' target=_blank>"&ReturnStr&"</a>")
			Next		
			IsValidUrl = str 
			End Function		
	for i=1 to pagesize
		if rs.eof then exit for

		
			if Request.Cookies(Sky_Admin_Cookies_1)("admin_u")<>"" Then
				s_u_str=" | <span onclick='modify("&rs(6)&")' style='cursor:pointer'>修改</span> | <span onclick='del("&rs(6)&",this)' style='cursor:pointer'>删除</span> | <span onclick='hf("&rs(6)&")' style='cursor:pointer'>回复</span>"
			else
				s_u_str=""
			End IF	
			response.Write "<a name="&i_i_a&"></a>"	&vbcrlf
			response.Write "<DIV class=bai>"&vbcrlf
			response.Write "<DIV class=""t3_favor bcg bgg""><SPAN style=""PADDING-RIGHT: 10px; FLOAT: right"">"&rs(3)&s_u_str&vbcrlf
			'1为普通会员，2可以添加修改和删除
			Dim s_u_str
	
			response.Write "</SPAN><SPAN style=""PADDING-LEFT: 10px;font-weight:bold""><CS2 />"&rs(0)&"</SPAN></DIV>"&vbcrlf
			response.Write "<DIV class=""b3 bcg mb12"">"&vbcrlf
			response.Write "<DIV class=p90>"&vbcrlf
			response.Write "<DIV class=""f14 wr""><CD>"&s_u_str_1&HTMLEncode(rs(1))&"</CD></DIV>"&vbcrlf
						
			IF rs(4)<>"" Then
				response.Write "<div id=""Lg""></div>"&vbcrlf
				response.Write "<table border=""0"" cellpadding=""0"" cellspacing=""0"">"&vbcrlf
				response.Write "<tr valign=""top"">"&vbcrlf
				response.Write "	<td class=""f14 redhf"">"&vbcrlf
				response.Write IsValidUrl(rs(5))&vbcrlf
				response.Write "	</td></tr></table>"&vbcrlf
				response.Write "<DIV class=gray align=right>回复者："&rs(4)&" "&rs(7)&"</DIV>"&vbcrlf
			End IF
			response.Write"</div></div></DIV>"	&vbcrlf
		i_i_a=i_i_a+1
		rs.movenext
	next
	'---------------------------------------
	'for i=1 to pagecount
	'pagelist=pagelist & " <a href=# onclick=f("&i&")>"&i&"</a>"
	'next
	'---------------------------------


'------------

%>
<div align=center style=" font-size:14px;">共 <font color=red><b><%=count%></b></font> 条记录  每页显示<%=pagesize%>条记录 <%=str%>   <span id="all_page_curpage"><%=page%></span> / <span id="all_page_numb"><%=pagecount%></span> 跳转到<input type="text" size="2" id="p" value="<%=page%>"/>页<input type="button" value="Go" onclick="ff($('p').value)"/></div>
<%end if%>


