📄 friend.asp
字号:
<!-- #include file="setup.asp" -->
<%
if Request.Cookies("username")="" then
error2("请登陆后才能使用此功能!")
end if
if instr(Request.Cookies("username")," ")>0 then:error2("<li>非法操作"):end if
sql="select userpass from user where username='"&Request.Cookies("username")&"'"
rs.Open sql,Conn
if Request.Cookies("userpass")<>rs("userpass") then
error2("密码错误!")
end if
rs.close
select case Request("menu")
case "add"
add
case "del"
del
case "post"
post
case "look"
look
case "addpost"
addpost
case ""
index
end select
sub add
if Request("username")="" then
error2("请输入您要添加的好友名字!")
end if
if Request("username")=Request.Cookies("username") then
error2("不能添加自己!")
end if
if conn.execute("Select count(id)from user where username='"&Request("username")&"'")(0)=0 then
error2("数据库不存在此用户的资料!")
end if
sql="select friend from user where username='"&Request.Cookies("username")&"'"
rs.Open sql,Conn,1,3
if instr(rs("friend"),"|"&Request("username")&"|")>0 then
error2("此好友已经添加!")
end if
rs("friend")=""&rs("friend")&""&Request("username")&"|"
rs.update
rs.close
succtitle="已经成功添加好友"
message="<li><a href=javascript:history.back()>返回上一页</a><li><a href=friend.asp>返回好友列表</a><li><a href=index.asp>返回论坛首页</a>"
succeed(""&message&"<meta http-equiv=refresh content=3;url=javascript:history.back()>")
end sub
sub del
sql="select friend from user where username='"&Request.Cookies("username")&"'"
rs.Open sql,Conn,1,3
rs("friend")=replace(rs("friend"),"|"&Request("username")&"|","|")
rs.update
rs.close
index
end sub
sub look
page=Request("page")
if page<1 then
disabled="disabled=true"
page=0
end if
count=conn.execute("Select count(id)from message where incept='"&Request.Cookies("username")&"'")(0)
sql="select author,content from message where incept='"&Request.Cookies("username")&"' order by time Desc"
rs.Open sql,Conn
if Count-page<2 then
disabled2="disabled=true"
end if
if rs.eof then
error2("您没有短讯息!")
end if
RS.Move page
sql="select username,userface,usermail from user where username='"&rs("author")&"'"
rs1.Open sql,Conn
%>
<HTML><META http-equiv=Content-Type content="text/html; charset=gb2312">
<link href=images/bbs.css rel=stylesheet>
<body topmargin=0>
<style>
.bt {BORDER-RIGHT: 1px; BORDER-TOP: 1px; FONT-SIZE: 9pt; BORDER-LEFT: 1px; BORDER-BOTTOM: 1px;}
</style><TITLE>查看消息</TITLE><body topmargin=0 bgcolor="C4D4E5"><TABLE WIDTH=300 BORDER=0 CELLPADDING=3 CELLSPACING=0 BGCOLOR=C4D4E5>
<TR ALIGN=center><TD><b><FONT COLOR=FFFFFF>查看消息</FONT></A></TD></TR></TABLE>
<TABLE WIDTH=300 BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD bgcolor="F8F8F8">
昵称:<input class=bt readOnly type="text" value="<%=rs1("username")%>" size="10"> Email:<input class=bt readOnly type="text" value="<%=rs1("usermail")%>" size="14">
</TD><TD align=right bgcolor="F8F8F8"><a target=_blank href=profile.asp?username=<%=rs1("username")%>><img border="0" src="images/face/<%=rs1("userface")%>.gif" width="32" height="32" alt=用户详细资料>
</TD></TR><TR><TD VALIGN=top ALIGN=right colspan="2" bgcolor="F8F8F8"><textarea name="content" readOnly cols="39" rows="5"><%=rs("content")%></textarea>
</TD></TR></TABLE>
<TABLE WIDTH=300 BORDER=0 CELLSPACING=0 CELLPADDING=0 height="30">
<tr ALIGN=center><TD bgcolor="C4D4E5"><input type="button" value="回复讯息" onclick=javascript:open('friend.asp?menu=post&incept=<%=rs1("username")%>','_top','width=320,height=170')>
</td><TD><input type="button" value="<<上一条" <%=disabled%> onclick=javascript:open('friend.asp?menu=look&page=<%=page-1%>','_top','')> </td><TD><input type="button" value="下一条>>" <%=disabled2%> onclick=javascript:open('friend.asp?menu=look&page=<%=page+1%>','_top','')>
</td>
</TR></TABLE>
</BODY></HTML>
<%
rs1.close
rs.close
end sub
sub post
if Request("incept")="" then
error2("对不起,您没有输入用户名称!")
end if
if Request("log")="1" then
log2="javascript:history.back()"
else
log2="javascript:open('friend.asp?menu=post&log=1&incept="&Request("incept")&"','_top','width=320,height=170');history.go(1)"
end if
sql="select username,userface,usermail from user where username='"&Request("incept")&"'"
rs.Open sql,Conn
if rs.eof then
error2"系统不存在该用户的资料"
end if
%>
<HTML><META http-equiv=Content-Type content="text/html; charset=gb2312">
<link href=images/bbs.css rel=stylesheet>
<body topmargin=0 bgcolor="C4D4E5">
<style>
.bt {BORDER-RIGHT: 1px; BORDER-TOP: 1px; FONT-SIZE: 9pt; BORDER-LEFT: 1px; BORDER-BOTTOM: 1px;}
</style><TITLE>发送消息</TITLE>
<SCRIPT>
var i=0;
function check(theForm) {
if(theForm.content.value == "" ) {
alert("不能发空讯息!");
return false;
}
if (theForm.content.value.lengtd > 255){
alert("对不起,您的讯息不能超过 255 个字节!");
return false;
}
i++;if (i>1) {document.form.submit1.disabled = true;}return true;
}
function presskey(eventobject){if(event.ctrlKey && window.event.keyCode==13){this.document.form.submit();}}
</SCRIPT>
<TABLE WIDTH=300 BORDER=0 CELLPADDING=3 CELLSPACING=0 BGCOLOR=C4D4E5>
<TR ALIGN=center><TD><b><FONT COLOR=FFFFFF>发送消息</FONT></A></TD></TR></TABLE>
<TABLE WIDTH=300 BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><form name=form action="friend.asp" method="post">
<input type="hidden" name="menu" value="addpost">
<input type="hidden" name="incept" value="<%=rs("username")%>">
<TD bgcolor="F8F8F8">
昵称:<input class=bt readOnly type="text" value="<%=rs("username")%>" size="10"> Email:<input class=bt readOnly type="text" value="<%=rs("usermail")%>" size="14">
</TD><TD align=right bgcolor="F8F8F8"><a target=_blank href=profile.asp?username=<%=rs("username")%>><img border="0" src="images/face/<%=rs("userface")%>.gif" width="32" height="32" alt=用户详细资料>
</TD></TR><TR><TD VALIGN=top ALIGN=right colspan="2" bgcolor="F8F8F8"><textarea name="content" cols="39" rows="5" onkeydown=presskey()></textarea>
</TD></TR></TABLE><TABLE WIDTH=300 BORDER=0 CELLSPACING=0 CELLPADDING=0 height="30">
<tr ALIGN=center><TD bgcolor="C4D4E5"><input type="button" value="聊天记录" onclick=<%=log2%>>
</td><TD><input type="reset" value="取消发送" OnClick="window.close();"> </td><TD><input name=submit1 type="submit" value="发送讯息" onclick="return check(this.form)"></td>
</TR></form>
</TABLE>
<%
rs.close
if Request("log")<>"" then
%>
<body onload=resizeTo(330,300)>
<textarea name="content" readOnly cols="40" rows="6"><%
sql="select * from message where (author='"&Request.Cookies("username")&"' and incept='"&Request("incept")&"') or (author='"&Request("incept")&"' and incept='"&Request.Cookies("username")&"') order by time Desc"
rs.Open sql,Conn
do while not rs.eof
%>
(<%=rs("time")%>) <%=rs("author")%>
<%=rs("content")%>
<%
rs.movenext
loop
rs.close
%></textarea>
<%
end if
%>
<body onload=resizeTo(330,206)>
<%
end sub
sub addpost
if instr(Request.ServerVariables("http_referer"),""&Request.ServerVariables("server_name")&"") = 0 then
error2("<li>来源错误")
end if
if Request("incept")=Request.Cookies("username") then
error2("不能给自己发送讯息!")
end if
rs.Open "message",Conn,1,3
rs.addnew
rs("author")=Request.Cookies("username")
rs("incept")=Request("incept")
rs("content")=server.htmlencode(Request("content"))
rs.update
rs.close
conn.execute("update [user] set newmessage=newmessage+1 where username='"&Request("incept")&"'")
%>
发送成功!<script>close();</script>
<%
end sub
sub index
top
%>
<SCRIPT>
function add(){
var id=prompt("请输入您要添加的好友名称!","");
if(id){
document.location='friend.asp?menu=add&username='+id+'';
}
}
</SCRIPT>
<form method="POST">
<input type=hidden name="menu" value="del">
<style>TABLE{BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:1px}TD{BORDER-RIGHT:0px;BORDER-TOP:0px}</style>
<title>控制面板</title>
<table width="750" align="center" border="0">
<tr>
<td vAlign="top" width="30%"><img src="images/logo.gif" border="0"></td>
<td vAlign="center" align="top"> <img src="images/closedfold.gif" border="0"> <a href="index.asp"><%=clubname%></a><br>
<img src="images/bar.gif" border="0"><img src="images/openfold.gif"> 控制面板</td>
</tr>
</table>
<br>
<TABLE align=center width="730" background=images/title_sub.gif>
<TBODY>
<TR>
<Td align="center"><b><font color="#000000"><a href="usercp.asp">
<font color="#000000">控制面板首页</font></a></TH> </font>
</b>
<TD align="center"><b><font color="#000000"><a href="editprofile.asp">
<font color="#000000">基本资料修改</TH> </font></a> </font>
</b>
<TD align="center"><b><font color="#000000">
<a href="editprofile.asp?menu=contact"><font color="#000000">联系资料修改</TH></font></a></font></b><TD align="center"><b><font color="#000000">
<a href="editprofile.asp?menu=pass"><font color="#000000">用户密码修改</TH> </font>
</a> </font>
</b>
<TD align="center"><b><font color="#000000"><a href="message.asp">
<font color="#000000">用户短信服务</TH> </font></a> </font>
</b>
<TD align="center"><b><font color="#000000"><a href="friend.asp">
<font color="#000000">编辑好友列表</TH> </font></a> </font>
</b>
<TD align="center"><b><font color="#000000"><a href="favorites.asp">
<font color="#000000">用户收藏管理</font></a></TH></font></b></TR></TBODY></TABLE>
<HR width="730" SIZE=1>
<table style="WIDTH: 730" cellSpacing=0 cellPadding=3 align=center border=1 borderColor=a4b6d7 >
<tr>
<td width="131" background=images/title_sub.gif align="center">
<font color="#000000">昵称 </font> </th>
<td width="158" background=images/title_sub.gif align="center">
<font color="#000000">邮件 </font> </th>
<td width="185" background=images/title_sub.gif align="center">
<font color="#000000">主页 </font> </th>
<td width="59" background=images/title_sub.gif align="center">
<font color="#000000">状态 </font> </th>
<td width="84" background=images/title_sub.gif align="center">
<font color="#000000">发短信 </font> </th>
<td width="50" background=images/title_sub.gif align="center">
<font color="#000000">操作 </font> </th>
</tr>
<%
sql="select friend,userface from user where username='"&Request.Cookies("username")&"'"
rs.Open sql,Conn
master=split(rs("friend"),"|")
for i = 1 to ubound(master)-1
sql="select * from user where username='"+master(i)+"'"
rs1.Open sql,Conn
'''''''''''''''''''
on error resume next '找不到好友资料时候忽略错误
if rs1("landtime")=empty then
response.write "<b>系统消息:</b><br><a href=friend.asp?menu=del&username="+master(i)+"><font color=red>"+master(i)+"的资料已经不存在,点击删除该用户的名单</font></a>"
end if
'''''''''''''''''''
if DateDiff("s",rs1("landtime"),Now())<1200 then
online="<img src=images/online1.gif alt=在线>"
else
online="<img src=images/offline1.gif alt=离线>"
end if
%>
<tr>
<td vAlign=center align=middle width="131"><a href=profile.asp?username=<%=rs1("username")%> target=_blank><%=rs1("username")%></a> </td>
<td align=middle width="158"><a href=mailto:<%=rs1("usermail")%>><%=rs1("usermail")%></a> </td>
<td width="185"><a href=<%=rs1("userhome")%> target=_blank><%=rs1("userhome")%></a> </td>
<td align=middle width="59"><%=online%> </td>
<td align=middle width="84"><a href=# onclick="javascript:open('friend.asp?menu=post&incept=<%=rs1("username")%>','','width=320,height=170')">发送</a></td>
<td align=middle width="50"><INPUT type=radio value=<%=rs1("username")%> name=username></td>
</tr>
<%
rs1.close
next
%>
<tr>
<td class="tablebody2" vAlign="center" align="right" colSpan="6" width="702">
<input onclick="javascript:add();" type="button" value="添加好友" name="action"> <input onclick="{if(confirm('确定删除选定的纪录吗?')){return true;}return false;}" type="submit" value="删除"></td>
</tr></form>
</table>
<%
rs.close
htmlend
end sub
responseend
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -