?? infor.asp
字號:
<!--#include file="conn.asp"-->
<table width="660" height="200" align="center" cellspacing="0" bordercolor=#9cc2d8 >
<%
if session("user_name")="" then
user_name=request("name") '如果不是會員登錄,而是游客.取游客的名字
if user_name<>"" and request.form("content")<>"" then
'插入數據庫
Set rs1= Server.CreateObject("ADODB.RecordSet")
SQL="Select * From liuyan"
rs1.open sql,conn,3,3
rs1.addnew
rs1("liuyan_content")=request.form("content")
rs1("liuyan_time")=now()
rs1("liuyan_name")="游客"&user_name
rs1("liuyan_email")=request.form("email")
rs1.update
rs1.close
set rs1=nothing
Set rs= Server.CreateObject("ADODB.RecordSet")
SQL="Select * From liuyan where liuyan_name='游客"&user_name&"'order by liuyan_time desc"
rs.open sql,conn,3,3
'顯示內容
response.write "<tr><td align=top height='20' width='100%' bgcolor='#9cc2d8'>游客"&user_name&"留言:"
response.write formatdatetime(rs("liuyan_time"),vbGeneralDate)
response.write "<br>"&rs("liuyan_content")&"</td></tr>"
end if
else '是會員登錄,取會員的名字
user_name=session("user_name")
if request.form("content")<>"" then
Set rs1= Server.CreateObject("ADODB.RecordSet") '存入數據庫
SQL="Select * From liuyan"
rs1.open sql,conn,3,3
rs1.addnew
rs1("liuyan_content")=request.form("content")
rs1("liuyan_time")=now()
rs1("liuyan_name")=user_name
rs1("liuyan_email")=request.form("email")
rs1.update
rs1.close
set rs1=nothing
'end if
'顯示內容
Set rs= Server.CreateObject("ADODB.RecordSet")
SQL="Select * From liuyan where liuyan_name='"&user_name&"'order by liuyan_time asc"
'and liuyan_time>"&session("logtime")
rs.open sql,conn,3,3
i=0
do while not rs.eof
if formatdatetime(rs("liuyan_time"),vbShortDate)=formatdatetime(date(),vbShortDate) and formatdatetime(rs("liuyan_time"),vbLongTime)>formatdatetime(session("logtime"),vbLongTime) then
i=i+1
if (i mod 2<>0) then
response.write "<tr><td align=top height='20' width='100%' bgcolor='#3399cc'>"&user_name&"留言:"
%>
<%
response.write rs("liuyan_time")
response.write "<br>"&rs("liuyan_content")&"</td></tr>"
else
response.write "<tr><td align=top height='20' width='100%' bgcolor='#9cc2d8'>"&user_name&"留言:"
%>
<%
response.write rs("liuyan_time")
response.write "<br>"&rs("liuyan_content")&"</td></tr>"
end if
rs.movenext
else
rs.movenext
end if
loop
rs.close
end if
end if
%>
</table>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -