guestbook.asp

来自「本系统是一套开源WEB的网站管理系统」· ASP 代码 · 共 436 行 · 第 1/2 页

ASP
436
字号
				<a href=guestbook.asp?action=maosin_pass&ispass=yes&gb_id=<%=gb_id%> title="通过审核"><img src="images/guestbook/passed.gif" border="0" align="absmiddle"></a>
			<%elseif gb_pass=1 then%>
				<a href=guestbook.asp?action=maosin_pass&ispass=no&gb_id=<%=gb_id%> title="取消审核"><img src="images/guestbook/clearpass.gif" border="0" align="absmiddle"></a>
			<%end if
		 end if
		  if session(userVar)=userVal or userSign=3 or (session(adminVar)=adminVal) then
		  if user_id=ms_userID or userSign=3 then
		%>
		<a href=guestbook.asp?action=maosin_editgb&gb_id=<%=gb_id%> title="编辑留言"><img src="images/guestbook/edit.gif" border="0" align="absmiddle"></a>
		<a href=guestbook.asp?action=maosin_delgb&gb_id=<%=gb_id%> title="删除留言"><img src="images/guestbook/del.gif" border="0" align="absmiddle"></a></td></tr>
		<%end if
		end if%>
	<%'end if
end if%>
</table>
<%
gbrs.MoveNext
line=line+1		
Loop
if gbrs.recordcount>n then
response.write("<div class=""page"">"&nextpage&"</div>")
end if
gbrs.close
Set gbrs=Nothing
End Sub
'======================
'功  能:发表留言
'过程名:writegb()
'======================
Sub writegb()
if guestbookOpen=0 then
	if session(adminVar)<>adminVal then
		showmsg "<font color=""#ff0000"">系统返回以下信息:</font><br>对不起,留言系统暂时关闭。","系统信息"
		exit sub
	end if
elseif guestbookOpen=2 then
	dim strMsg
	if session(adminVar)<>adminVal then
		if session(userVar)<>userVal then
			strMsg="<font color=""#ff0000"">对不起,此留言功能需要[注册会员]才能使用</font><br>如果您已经注册了,登录再留言。<br>如果您还不是本站会员,请赶快注册吧!"
			showLogonCode strMsg 
			exit sub
		end if
	end if
end if
If Request.form("gb")<>"" Then
	if Request.form("gb_qqh")="" then
		gb_qqh=0
	else
		gb_qqh=1
	end if
gb_username=trim(Request.form("gb_username"))
gb_title=trim(chkFormStr(filterHtml(Request.form("gb_title"))))
gb_content=htmlencode(Request.form("content"))
gb_qq=trim(Request.form("gb_qq"))
gb_from=chkFormStr(trim(Request.form("gb_from")))
gb_email=chkFormStr(Request.form("gb_email"))
gb_home=chkFormStr(Request.form("gb_home"))
topic=chkFormStr(Request.form("topic"))
gb_face=trim(chkFormStr(Request.form("gb_face")))
from_ip=getIp()
dim errormsg
if chkIsAvaStr(gb_username)=false then
	showmsg "<font color=""#ff0000"">系统返回信息:</font><br><br>用户名含有非法字符!","出错信息"
	exit sub
end if
if trim(gb_username)="" then
errormsg=errormsg&"<li>请填上您的姓名!</li>"
end if
if trim(gb_title)="" then
	errormsg=errormsg&"<li>请填写留言标题!</li>"
elseif strLength(trim(gb_title))>40 then
	errormsg=errormsg&"<li>留言标题最多不能大于<font color=""#ff0000"">40</font>个字符</li>"
end if
if trim(gb_content)="" or len(trim(gb_content))<8then
errormsg=errormsg&"<li>留言内容不能为空或小于8个字符,请返回重填!</li>"
end if
if errormsg<>"" then
showmsg errormsg,"出错信息"
exit sub
end if
errormsg=""
if gb_qq<>"" then
	if len(trim(gb_qq))>11 or  not isNumeric(gb_qq) then
	errormsg=errormsg&"<li>您填写的QQ号格式不正确或者位数不对,请返回重填!</li>"
	end if
end if
if gb_email<>"" then
	if IsValidEmail(gb_email)=false then
	errormsg=errormsg&"<li>电子邮件填写不正确,请返回重填!</li>"
	end if
end if
if gb_home<>"" then
	if Lcase(left(gb_home,7))<>"http://" then
	errormsg=errormsg&"<li>主页地址填写不正确,请返回重填!</li>"
	end if
end if
if ms_submit=0 then
	if chkIsOut=false then
		showmsg "<font color=""#ff0000"">茂盛系统返回如下信息:</font><br><br>对不起,本站不允许从外部提交数据","系统出错信息"
		exit sub
	end if
end if
if errormsg<>"" then
showmsg errormsg,"出错信息"
exit sub
end if
	dim pass,msgStr
	if guestbookPass=0 then
		pass=1
		msgStr="<li>留言已提交成功,我们会尽快的给您[回复],感谢您的参与</li>"
	elseif guestbookPass=1 then
		pass=0
		msgStr="<li>留言已提交成功,我们会尽快 [回复审核] 的,感谢您的参与</li>"
	elseif guestbookPass=2 then
		if session(userVar)=userVal or session(adminVar)=adminVal then
			pass=1
			msgStr="<li>留言已提交成功,我们会尽快的给您[回复],感谢您的参与</li>"
		else
			pass=0
			msgStr="<li>留言已提交成功,我们会尽快 [回复审核] 的,感谢您的参与</li>"
		end if
	else
		pass=0
		msgStr="<li>留言已提交成功,我们会尽快 [回复审核] 的,感谢您的参与</li>"
	end if
	gb_username=chkFormStr(gb_username)
	upsql="insert into ms_gb(user_id,user_type,gb_username,gb_title,gb_content,gb_qq,gb_ip,gb_from,gb_email,gb_home,gb_date,gb_face,gb_qqh,pass)"
	upsql=upsql&" values("&ms_userID&","&userSign&",'"&gb_username&"','"&topic&gb_title&"','"&gb_content&"','"
	upsql=upsql&gb_qq&"','"&from_ip&"','"&gb_from&"','"&gb_email&"','"&gb_home
	upsql=upsql&"',#"&NOW()&"#,'"&trim(gb_face)&"',"&gb_qqh&","&pass&")"
	conn.Execute(upsql)
	showmsg msgStr&"<br><li>直接 [<a href=""guestbook.asp"">返回留言</a>] 首页</li><li><span id=seNum>3</span><a href=javascript:showtime></a>秒钟后系统将自动留言首页......</b></li><meta http-equiv=refresh content=3;url=guestbook.asp><SCRIPT>valignbottom()</SCRIPT><script>function showtime(secs){seNum.innerText=secs;if(--secs>0)setTimeout('showtime('+secs+')',1000);}showtime(3);</script>","提交成功信息"
	exit sub
End If
%>
<table width="100%" border="0" cellpadding="3" cellspacing="1" class="tableBC">
  <form name="myform" method="post" action="" onKeyDown="javascript:if(event.keyCode==13 && event.ctrlKey){checkgb(this);}" onSubmit="return checkgb(this)">
    <tr valign="middle"> 
      <td height="25" colspan="3" class="tdT">&gt;&gt; 留言者个人信息</td>
    </tr>
    <tr class="tdBC"> 
      <td width="100" height="25" align="right" valign="middle"><font color="#ff0000">*</font>您的姓名:</td>
      <td width="330" valign="middle"> <input name="gb_username" type="text" id="gb_username" class="wenbenkang" size="20" <%if ms_userName<>"" then%>value="<%=ms_userName%>" readonly <%end if%> maxlength="12"> 
        最多10个字符</td>
      <td width="*" rowspan="4" align="center" valign="middle"><img src="images/face/1.gif" name="imageface" width="75" height="75" id="imageface" onClick="javascript:window.open('face.htm')" alt="点击查看全部头像"></td>
    </tr>
    <tr class="tdBC"> 
      <td height="25" align="right" valign="middle">您的 QQ:</td>
      <td valign="middle"> <input name="gb_qq" type="text" id="gb_qq" size="20" class="wenbenkang" maxlength="12">
        最多12个字符</td>
    </tr>
    <tr class="tdBC"> 
      <td height="25" align="right" valign="middle">电子邮箱:</td>
      <td valign="middle"> <input name="gb_email" type="text" id="gb_email" size="20" class="wenbenkang" maxlength="40">
        最多40个字符</td>
    </tr>
    <tr class="tdBC"> 
      <td height="25" align="right" valign="middle">个人主页:</td>
      <td valign="middle"> <input name="gb_home" type="text" id="gb_home" size="20" class="wenbenkang" maxlength="50"> 
        &nbsp; 要包含<button style="padding:1px;background-color:#f8f8f8;border:1px outset #c2c2c2;cursor:hand;" onClick="gb_home.value='http://'">http://</button></td>
    </tr>
    <tr class="tdBC"> 
      <td height="25" align="right" valign="middle">来自那里:</td>
      <td valign="middle"> <input name="gb_from" type="text" id="gb_from" size="20" class="wenbenkang" maxlength="20">
        最多20个字符</td>
      <td align="left" valign="middle">→<a href="face.htm">全部头像</a>: 
        <select name="gb_face" id="gb_face" onChange="changeimage();">
					  <script language="JavaScript">
					  for(var i=1;i<126;i++){
					  window.document.write("<option value="+i+" >头像"+i+"</option>");
					  }
					  </script>
					  </select></td>
    </tr>
    <tr valign="middle"> 
      <td height="25" colspan="3" class="tdT">&gt;&gt; 留言信息</td>
    </tr>
    <tr class="tdBC"> 
      <td height="25" align="right" valign="middle"><font color="#ff0000">*</font>留言主题:</td>
      <td colspan="2" valign="middle"> <input name="gb_title" type="text" size="30" class="wenbenkang">
        话题: <select name="topic">
          <option value="[留言]" selected>[留言]</option>
          <option value="[建议]">[建议]</option>
          <option value="[链接]">[链接]</option>
          <option value="[报错]">[报错]</option>
          <option value="[讨论]">[讨论]</option>
          <option value="[其它]">[其它]</option>
        </select> 最多50个字符</td>
    </tr>
    <tr class="tdBC"> 
      <td align="right" valign="top"><font color="#ff0000">*</font>留言内容:<br>支持UBB&nbsp;</td>
      <td colspan="2" valign="top"><%=showUBB(1,0)%>
	   <textarea name="content" cols="78" rows="10" id="content" class="textkang" onkeydown="contentlen(this)" onkeyup="contentlen(this)" title="按[Ctrl+Enter]直接发送"></textarea></td>
    </tr>
    <tr class="tdBC" align="center" valign="middle"> 
      <td height="25" colspan="3"><input name="gb_qqh" type="checkbox" id="gb_qqh" value="1"> 
        <label for="gb_qqh">悄悄话</label>(<font color="#ff0000">管理员可见!</font>)&nbsp;</span style="color:#888888;">[最多字数: 
        <input type="text" value="300" id="maxlen" size="2" style="border-width:0;background:transparent;" disabled>
        个字符&nbsp;已用字数: <input type="text" value="0" id="useing" size="2" style="border-width:0;background:transparent;" disabled>
        个字符&nbsp;剩余字数: <input type="text" value="300" id="yis" size="2" style="border-width:0;background:transparent;" disabled>
        个字符]</span></td>
    </tr>
    <tr align="center" valign="middle"> 
      <td height="25" colspan="3" class="tdT"><input name="gb" type="submit" id="gb" class="but1" onMouseOver="this.className='but2'" onMouseOut="this.className='but1'" value="签写留言"> 
        &nbsp;&nbsp; <input type="reset" name="Submit2" value="清除重写"  class="but1"onMouseOver="this.className='but2'" onMouseOut="this.className='but1'"></td>
    </tr>
  </form>
</table>
<%
End Sub
'========================================================
'MaoSin CMS 1.1      Power by maosin.com
'Email: maosin@163.com , maosin@maosin.com
'Web: http://www.maosin.com  http://www.maosin.net
'Copyright (C) 2006 maosin.com All Rights Reserved.
'========================================================
%>

⌨️ 快捷键说明

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