📄 sms.asp
字号:
<!--#include file="up.asp"--><!--#include file="inc/ubbcode.asp"--><!--#include file="inc/page.asp"-->
<link rel="stylesheet" type="text/css" href="skin/<%=Cssstyleid%>/bbs.css">
<%
if isnull(lguserid) or lguserid="" then Response.Redirect"login.asp"
dim action,toname,bad,b
action=request.querystring("action")
select case action
case""
conn.execute("update sms set new=false where touserid="&lguserid&"")
%><SCRIPT src=inc/menu.js></script>
<script>messages = new Array()
messages[0]=" <font color=red>>珍惜每一点空间,麻烦你及时删除无用的留言信息。谢谢!</font>"
messages[1]=" <font color=red>每删除一封信件,可获积分 1 点。</font>"</script>
<div class=sms>
<div class=smstitle>个人留言板</div>
<div class=smsbody>
<div class=smstools><a href=sms.asp?action=write>>>发送留言</a> <a href=sms.asp?action=delall onclick="{if(confirm('确定清除你的留言板中所有的留言吗?')){return true;}return false;}"> >>清空留言板</a></div>
<div id=content class=smsad></div><SCRIPT>jspaper()</SCRIPT>
</div>
</div>
<%dim sql,pagesetup,usern,userinfo,topicuserid,sms,smsuserid
dim wzcount,wzrep,wzpagecount,wzpage,pagestr,urlstr
id=false
urlstr="action="
sql="select*from sms where touserid="&lguserid&" order by id desc"
wzrep=5
set rs = server.createobject("adodb.recordset")
rs.Open sql,conn,1
if rs.eof or rs.bof then
response.write"<div class=norecord>暂无记录</div>"
else
wzcount=rs.recordcount
wzpagecount = abs(int(-abs(wzcount/wzrep)))
wzpage = clng(request.querystring("page"))
if len(wzpage) = 0 or wzpage = 0 then wzpage = 1
rs.absoluteposition=rs.absoluteposition+((abs(wzpage)-1)*wzrep)
pagestr="每页<font color=red>"&wzrep&"</font>条 共<font color=red>"&wzpagecount&"</font>页 ["&pagination(wzpagecount,urlstr)&"] "
response.write"<div class=smspagestr>"&pagestr&"</div>"
for i = 0 to wzrep-1
if rs.eof then exit for
smsuserid=rs("fromuserid")
sms=rs("content")
sms=split(sms,"|")
set usern=conn.execute("select top 1 name,userinfo from [user] where userid="&smsuserid&"")
userinfo=usern("userinfo")
userinfo=split(userinfo,"|")
%>
<div class=smsmes>
<div class=smsmesleft>
<p style="margin: 5"><span class=smsmesusername><%=checktitle(usern("name"))%></span></p><p style="margin: 5"><%response.write"<img src="&checktitle(userinfo(5))&" width="&checktitle(userinfo(6))&" height="&checktitle(userinfo(7))&" border=0>"%></p>
</div>
<div class=smsmesright>
<div class=smsmestools>
留言时间:<span class=smsmestime><%=checktitle(sms(1))%></span>
<a href=userinfo.asp?userid=<%=smsuserid%>>信息</a>
<a href=sms.asp?action=write&toname=<%=checktitle(usern("name"))%>>留言</a>
<a href=sms.asp?action=del&id=<%=rs("id")%>>删除</a>
</div>
<div class=smsmesbody>
<%=ubb(sms(0))%>
</div>
</div>
</div>
<%
set usern=nothing
rs.movenext
next
end if
rs.Close
set rs=nothing
response.write"<div class=smspagestr>"&pagestr&"</div>"
%>
<%case"write"
toname=replace(request.querystring("toname"),"'","")
%>
<div class=sendsmstitle>发送留言</div>
<div class=sendsmsbody>
<form method="POST" action="sms.asp?action=savesms" name="topicform">
<table border="0" cellpadding="0" style="border-collapse: collapse" width="100%">
<tr>
<td width="20%">
<p style="line-height: 120%; margin: 4"><b>留言对象:</b></td>
<td width="70%">
<p style="line-height: 120%; margin: 4">
<input type="text" name="toname" size="37" value="<%=checktitle(toname)%>" onkeydown="if(event.keyCode==13)return false;"></td>
</tr>
<tr>
<td valign="top">
<p style="line-height: 150%; margin: 5"><b>留言内容:</b><br>
<input type="radio" name="usereditor" value="html" onclick="checkeditor('html')" checked>使用Html编辑器<br>
<input type="radio" name="usereditor" value="ubb" onclick="checkeditor('ubb')">使用UBB编辑器<br>
</td>
<td valign="top">
<textarea name="content" cols="40" rows="2" style="display:none"></textarea>
<p style="line-height: 150%; margin: 5">
<SCRIPT src="Editor/Ubb/UbbEditor.js"></SCRIPT>
<script type="text/javascript" src="Editor/Html/htmlEditor.js"></script>
<script>
function preview()
{
if(htmlsubmit()){
document.form1.topic.value=document.topicform.toname.value;
document.form1.content.value=document.topicform.content.value;
var popupWin = window.open('paper.asp?action=preview', 'showgg', 'width=500,height=400,resizable=1,scrollbars=yes,menubar=no,status=yes');
document.form1.submit()
}
}
function checkeditor(editor)
{
if(editor=="html")
{
document.getElementById("ubbeditordiv").style.display = 'none';
document.getElementById("htmltoolbar").style.display = 'block';
EDITFORM_DOCUMENT.body.innerHTML = document.getElementById("CodeForm").value;
document.getElementById("editTextarea").style.display = 'none';
document.getElementById("editIframe").style.display = 'block';
HtmlDisableToolbar(false);
}
else if(editor=="ubb")
{
document.getElementById("ubbeditordiv").style.display = 'block';
document.getElementById("htmltoolbar").style.display = 'none';
document.getElementById("CodeForm").value = HtmlHtmlToXhtml(EDITFORM_DOCUMENT.body.innerHTML);
document.getElementById("editIframe").style.display = 'none';
document.getElementById("editTextarea").style.display = 'block';
HtmlDisableToolbar(true);
}
}
var ubbedit=new UbbEditor("CodeForm",100,14,"default values","editor/ubb/images/");
ubbedit.showeditor();
</script>
<script type="text/javascript">
var editor = new htmlEditor("editor");
editor.hiddenName = "content";
editor.width = "100%";
editor.height = "300px";
editor.imagePath="editor/html/images/";
editor.iconPath = 'editor/html/images/face/';
editor.show();
var strlength;
//提交表单
function submitform(){
if(htmlsubmit()==true)document.topicform.submit();
}
//检测表单
function htmlsubmit() {
if(document.getElementsByName("usereditor").item(0).checked==true){
var content = editor.data();
}
else if(document.getElementsByName("usereditor").item(1).checked==true){
checkeditor("html");
var content = editor.data();
checkeditor("ubb");
}
strlength=document.getElementsByName("content").item(0).value.length;
if (strlength>25600||strlength<5){
alert("您输入的留言内容长度为"+strlength+",长度必须大于5且小于25600,请修正之后再继续。");
return false;
}
else if(document.getElementsByName("toname").item(0).value==""){
alert("留言对象不能为空为空。");
document.getElementById("toname").style.backgroundColor="#FFEEEE";
return false;
}
else{
return true;
}
}
</script>
</td>
</tr>
<tr>
<td width="200">
</td>
<td height="30">
<input class=submit type=button value=OK_!发表 name="B1" onclick="submitform()">
<input class=submit type=button value="预 览!" onclick="preview()" name="B3"> <input class=submit type=reset value=NO_!重写 name=B2> [ 按 Ctrl+Enter 直接发送 ]</td>
</tr>
</table>
</form>
</div>
<form name=form1 action=paper.asp?action=preview method=post target=showgg>
<input type=hidden name=topic value=""><input type=hidden name=content value="">
</form>
<%case"savesms"
dim content,cansend,touserid,content2,mymark,contentok
cansend=true
function checkbad(str)
if isnull(str) then exit function
bad=split(application(prefix&"badcontent"), "|")
for b=0 to ubound(bad)
str=Replace(str,bad(b),string(len(bad(b)),"*"))
next
checkbad=str
end function
toname=Replace(Request.Form("toname"),"'","")
content=checkbad(left(Request.Form("content"),15000))
content=replace(content,"|","│")
content=replace(content,"'","''")
contentok=Replace(content," ","")
contentok=Replace(content," ","")
if toname="" or contentok="" then
cansend=false
mes="·请填写完整留言对象和留言内容。<br>"
else
if lcase(toname)=lcase(lgname) then
cansend=false
mes="·不能给自己留言。<br>"
else
if checkname(toname)=false then
cansend=false
mes="·论坛不存在 "&checktitle(toname)&" 这个用户。<br>"
else
''''''限制1分钟只能留一次言
if session("mailtime")+1/1440>now() then
cansend=false
mes="·论坛目前限定一分钟只能留一次言。<br>"
else
session("mailtime")=now
'''''''''''''''结束
set rs=conn.execute("select top 1 userid from [user] where name='"&toname&"'")
if rs.eof then
cansend=false
mes="·论坛不存在 "&checktitle(toname)&" 这个用户。<br>"
else
touserid=rs("userid")
end if
set rs=nothing
end if'添加
end if
end if
end if
mymark=conn.execute("select top 1 mark from [user] where userid="&lguserid&"")("mark")
if mymark<5 then
cansend=false
mes=mes&"·你的论坛积分为 <b>"&mymark&"</b> ,不足够发送留言。<br>"
end if
if cansend=false then
tl=" 发 送 失 败"
mes="<b>对不起!留言发送失败,可能存在以下问题。</b><br>"&mes&"·<a href='javascript:history.go(-1)'><img src="&styleid&"/re.gif align=absmiddle border=0> 返回重新填写</a>"
elseif cansend=true then
content2=content&"|"&now()+timeset/24
conn.execute("insert into sms(fromuserid,touserid,content) values("&lguserid&","&touserid&",'"&content2&"')")
conn.execute("update [user] set mark=mark-5 where userid="&lguserid&"")
tl=" 发 送 成 功"
mes="已经成功的给 "&checktitle(toname)&" 留言。<br>论坛收取了你 <b>5</b> 点积分。"
end if
call sendinfo(tl,mes)
%>
<%case"del"
if conn.execute("select top 1 id from sms where id="&id&" and touserid="&lguserid&"").eof then
tl=" 删 除 失 败"
mes="你的留言板不存在你所要删除的留言。"
else
conn.execute("delete*from sms where id="&id&" and touserid="&lguserid&"")
conn.execute("update [user] set mark=mark+1 where userid="&lguserid&"")
tl=" 删 除 成 功"
mes="已经删除了选中的留言。"
end if
call sendinfo(tl,mes)
%><%case"delall"
dim delnum,addmark
delnum=conn.execute("select count(id) from sms where touserid="&lguserid&"")(0)
addmark=1*int(delnum)
conn.execute("update [user] set mark=mark+"&int(addmark)&" where userid="&lguserid&"")
conn.execute("delete*from sms where touserid="&lguserid&"")
tl=" 清 空 成 功"
mes="已经成功的清空留言板。你获得了 <b>"&addmark&"</b> 点积分。"
call sendinfo(tl,mes)%><%end select
call down
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -