⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guestbook.asp

📁 俄罗斯方块源码 俄罗斯方块源码 俄罗斯方块源码
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="top.asp"-->
<%
dim action
action=request("action")
if action="save" then
 
 '保存留言
 dim g_name,g_oicq,g_email,g_url,g_topic,g_content,g_hidden,g_comefrom,g_face,g_userface
 
 g_name=checkstr(trim(request.form("g_name")))
 g_oicq=checkstr(trim(request.form("g_oicq")))
 g_email=checkstr(trim(request.form("g_email")))
 g_url=checkstr(trim(request.form("g_url")))
 g_topic=checkstr(trim(request.form("g_topic")))
 g_content=checkstr(trim(request.form("g_content")))
 g_hidden=checkstr(trim(request.form("g_hidden")))
 g_comefrom=checkstr(trim(request.form("g_comefrom")))
 g_face=request("g_face")
 g_userface=request("g_userface")
 
 '检查数据
 if g_name="" or strlength(g_name)>20 then 
   call mb("对不起,请正确输入您的名字(1-10个汉字!)","",0)
 end if
 
 if g_email<>"" and not isemail(g_email) then
   call mb("请正确输入电子邮件!","",0)
 end if
 
 if g_topic="" or strlength(g_topic)>50 then
   call mb("留言主题不能为空或大于25个汉字!","",0)
 end if
 
 if g_content="" then
  call mb("请输入留言内容!","",0)
 end if
 
 if g_hidden="" then
  g_hidden=false
 end if
 
 if g_face="" then
   g_face="0"
 end if
 
 if g_userface="" then
   g_userface="face1.gif"
 end if
 
 '保存数据
 set rs=server.createobject("adodb.recordset")
 sql="select * from guestbook where id is null"
 rs.open sql,conn,1,3
 
 rs.addnew()
 rs("g_name")=g_name
 rs("g_oicq")=g_oicq
 rs("g_email")=g_email
 rs("g_url")=g_url
 rs("g_comefrom")=g_comefrom
 rs("g_topic")=g_topic
 rs("g_content")=g_content
 rs("g_hidden")=g_hidden
 rs("g_face")=g_face
 rs("g_userface")=g_userface
 rs.update
 
 rs.close
 set rs=nothing
 
 call mb("系统提示:留言成功!","guestbook.asp",1)
 response.end
end if
%>
 
<TABLE width=770 border=0 align="center" cellPadding=0 cellSpacing=0 class=border>
  <TR> 
    <TD width=190 vAlign=top bgcolor="#F7F7F7"><!--#include file="left.asp"--> </TD>
    <TD vAlign=top align=right width=1 background="images/bg_vline.gif"></TD>
    <TD width=570 align=left vAlign=top bgcolor="#FFFFFF"> 
      <TABLE align=center 
      background="images/line01.gif" 
      border=0 cellPadding=0 cellSpacing=0 height=24 width="100%">
        <TR> 
          <TD height=21 width="57%">&nbsp;<IMG height=12 
            src="images/A3.gif" width=12> 当前位置:<A 
            href="index.asp" title="联盟首页">闪闪之家</A> -&gt; 访客留言 -&gt; 签写留言</TD>
          <TD height=21 width="43%">&nbsp;</TD>
        </TR>
      </TABLE>
      <BR>
	 <%if action="add" then%>
      <form action="?action=save" method="post" name="writebook" id="writebook">
        <TABLE align=center border=0 borderColor=#000000 cellPadding=0 cellSpacing=0 width="99%">
          <TR> 
            <TD background="images/T_back.gif" width="18%"><IMG src="images/T_1.gif" width=90 height=24 border="0"></TD>
            <TD 
          background="images/T_back.gif" 
          width="77%"><font color="#993300">欢 迎 您 给 本 站 留 言             [<a href="guestbook.asp" >点这里查看留言</a>]</font></TD>
            <TD width="5%"><IMG height=24 
            src="images/T_2.gif" 
          width=29></TD>
          </TR>
        </TABLE>
        <table width="99%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
          <tr bgcolor="#FFFFFF">
            <td height="22" align="center">网友形像:</td>
            <td height="22"><select name="g_userface" size="1" class="input" id="g_userface" onchange="changeface();">
                <option value="face1.gif" selected>形像01</option>
                <option value="face2.gif">形像02</option>
                <option value="face3.gif">形像03</option>
                <option value="face4.gif">形像04</option>
                <option value="face5.gif">形像05</option>
                <option value="face6.gif">形像06</option>
                <option value="face7.gif">形像07</option>
                <option value="face8.gif">形像08</option>
                <option value="face9.gif">形像09</option>
                <option value="face10.gif">形像10</option>
              </select>
        <script language=javascript>
	  function changeface()
	   {
	   document.showface.src='images/userface/'+document.writebook.g_userface.value;
	   }
	    </script><img src="images/userface/face1.gif" width="50" height="50" name="showface"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td width="20%" height="22" align="center">您的大名:</td>
            <td width="80%" height="22"><input name="g_name" type="text" class="input" id="g_name" size="25" maxlength="10">
              *(1-10个汉字)</td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="22" align="center">O I C Q:</td>
            <td height="22"><input name="g_oicq" type="text" class="input" id="g_oicq" size="25"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="22" align="center">电子邮件:</td>
            <td height="22"><input name="g_email" type="text" class="input" id="g_email" size="25"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="22" align="center">个人主页:</td>
            <td height="22"><input name="g_url" type="text" class="input" id="g_url" value="http://" size="25"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="22" align="center">来  自:</td>
            <td height="22"><input name="g_comefrom" type="text" class="input" id="g_comefrom" size="25"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="22" align="center">留言主题:</td>
            <td height="22"><input name="g_topic" type="text" class="input" id="g_topic" value="<%=request("g_topic")%>" size="35" maxlength="25">
              *(1-25个汉字)</td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="22" align="center">表情图标: </td>
            <td height="22"><input name="g_face" type="radio" value="0" checked> 
              <img src="images/face/0.gif" width="15" height="15" border="0"> 
              <input type="radio" name="g_face" value="1"> <img src="images/face/1.gif" width="15" height="15" border="0"> 
              <input type="radio" name="g_face" value="2"> <img src="images/face/2.gif" width="15" height="15" border="0"> 
              <input type="radio" name="g_face" value="3"> <img src="images/face/3.gif" width="16" height="16" border="0"> 
              <input type="radio" name="g_face" value="4"> <img src="images/face/4.gif" width="15" height="15" border="0"> 
              <input type="radio" name="g_face" value="5"> <img src="images/face/5.gif" width="16" height="16" border="0"> 
              <input type="radio" name="g_face" value="6"> <img src="images/face/6.gif" width="15" height="15" border="0"> 
              <input type="radio" name="g_face" value="7"> <img src="images/face/7.gif" width="15" height="15" border="0"> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="22" align="center">留言内容:</td>
            <td height="22"><textarea name="g_content" cols="35" rows="10" id="g_content"><%=request("g_content")%></textarea>
              *</td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="22" align="center">是否隐藏:</td>
            <td height="22"><input name="g_hidden" type="radio" value="false" checked>
              正常   
              <input type="radio" name="g_hidden" value="true">
              隐藏 * 选择隐藏后,此留言只有站长才可以看到。</td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="22" align="center">&nbsp;</td>
            <td height="22"><input name="Submit2" type="submit" class="button" value=" 确 定 留 言 ">
                
              <input name="Submit3" type="reset" class="button" value=" 重 新 签 写 "></td>
          </tr>
        </table>
      </form>
      <%
else

'显示留言
response.expires=0

dim currentpage,maxperpage,totalpage,totalrecords,i
dim g_reply,g_replydate

currentpage=request("page")
if not isinteger(currentpage) then
  currentpage=1
else
  currentpage=clng(currentpage)
end if

maxperpage=10  '每页显示10条留言
totalpage=1
totalrecords=0
i=1

set rs=server.createobject("adodb.recordset")
sql="select * from guestbook order by id desc"
rs.open sql,conn,1,1

if not (rs.bof and rs.eof) then
  rs.pagesize=maxperpage
  rs.absolutepage=currentpage
  totalpage=rs.pagecount
  totalrecords=rs.recordcount
end if

%>
      <TABLE align=center border=0 borderColor=#000000 cellPadding=0 cellSpacing=0 width="99%">
        <TR> 
          <TD background="images/T_back.gif" width="18%"><IMG src="images/T_1.gif" width=90 height=24 border="0"></TD>
          <TD 
          background="images/T_back.gif" 
          width="77%"><font color="#993300">查 看 留 言             [<a href="?action=add" title="给站长留言您的建议或意见...">点这里签写留言</a>]</font></TD>
          <TD width="5%"><IMG height=24 src="images/T_2.gif" width=29></TD>
        </TR>
      </TABLE>
<%
 do until rs.eof or i>maxperpage
  g_content=rs("g_content")
  g_content=replace(g_content,chr(13),"<br>")
  g_content=replace(g_content," ","&nbsp;")
   
%>
      <table width="99%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
        <tr bgcolor="#FFFFFF"> 
          <td width="27%" valign="top" bgcolor="#F7F3F7">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="22" align="center">网友大名:<%=rs("g_name")%></td>
              </tr>
              <tr>
                <td height="97" align="center" valign="middle"><img src="images/userface/<%=rs("g_userface")%>" width="120" height="120"></td>
              </tr>
            </table>
          </td>
          <td width="73%" valign="top"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="1" class="border">
              <tr>
                <td height="22" bgcolor="#F7F3F7"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="85%"><b>主题:<%=rs("g_topic")%></b></td>
                      <td width="15%" align="center">第<font color=red><%=(maxperpage*(currentpage-1)+i)%></font>条</td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td height="22">
				<%
				response.write "<b><br>内容:</b>"
				if rs("g_hidden")=false then
                  response.write "<img src='images/face/"&rs("g_face")&".gif' border=0 align='absmiddle'>"&g_content
				else
                  response.write "<font color=red>此条留言为隐藏留言,请站长进入后台查看!</font>"
				end if
				
				response.write "<br><br>"
			   
				if rs("g_reply")<>"" then
				   g_reply=rs("g_reply")
                   g_reply=replace(g_reply,chr(13),"<br>")
                   g_reply=replace(g_reply," ","&nbsp;")
				  %>
                  <table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#9C9A9C">
                    <tr> 
                      <td bgcolor="#EBEBEB"> <br>
                        &nbsp;管理员回复于<font color=blue><%=rs("g_replydate")%></font>:<br>
                        ------------------------------------------------------ 
                        <br>
                        <br>
                        &nbsp;<%=g_reply%><br>
                        <br>
                      </td>
                    </tr>
                  </table> 
                  <br>
                  <%end if%>
                </td>
              </tr>
              <tr>
                <td height="22" bgcolor="#F7F3F7"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="47%"><img src="images/tim.gif" alt="签定时间" width="16" height="16" border="0" align="absmiddle"> 
                        <%=rs("g_dateandtime")%> </td>
                      <td width="53%" align="right"> 
                        <%if rs("g_oicq")<>"" then%>
                        <a href="http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<%=rs("g_oicq")%>" target="_blank"><img src="images/qq.gif" alt="<%=rs("g_name")%> 的OICQ是:<%=rs("g_oicq")%>" width="16" height="16" border="0" align="absmiddle"></a> 
                        <%
						end if
						
						if rs("g_url")<>"" and rs("g_url")<>"http://" then
						%>
                        <a href="<%=rs("g_url")%>" target="_blank"><img src="images/url.gif" alt="访问 <%=rs("g_name")%> 的主页..." width="16" height="16" border="0" align="absmiddle"></a> 
                        <%
						end if
						
						if rs("g_email")<>"" then
						%>
                        <a href="mailto:<%=rs("g_email")%>"><img src="images/email.gif" alt="给 <%=rs("g_name")%> 发电子邮件..." width="16" height="16" border="0" align="absmiddle"></a>
						<%
						end if'
					    %></td>
                    </tr>
                  </table></td>
              </tr>
            </table></td>
        </tr>
      </table>
      <%
 rs.movenext
 i=i+1
 loop
 rs.close
 set rs=nothing
 if totalrecords>0 then
  '显示留言分页
%>

      <table width="99%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
        <tr>
          <td height="22" background="images/line02.gif" bgcolor="#FFFFFF"> 
            <%call showpage("guestbook.asp",totalrecords,maxperpage,true,true,"条留言")%>
          </td>
        </tr>
      </table><br>
<%
   end if
end if
%> </TD>
  </TR>
</TABLE>
<!--#include file="bottom.asp"-->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -