📄 friend_user.asp
字号:
<!--#include file="User_conn.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用户管理中心</title>
<link href="Images/css.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
Dim UserHS
Set UserHS = New Art_User
Private CurrentPage,totalPut
Private MaxPerPage,SQL,tablebody,strErr,action,boxName,smscount,smstype,readaction,turl
Private ArticleStatus,ComeUrl,TotalPages
MaxPerPage =50
ComeUrl=Request.ServerVariables("HTTP_REFERER")
IF Cbool(UserHS.UserLoginChecked)=false then
Response.Write "<script>top.location.href ='login.asp' ;</script>"
Response.end
End If
%>
<table width="98%" height=20 border=0 align="center" cellPadding=2 cellSpacing=1 borderColor=#111111 class="table" id=AutoNumber3 style="BORDER-COLLAPSE: collapse">
<tr>
<td height=20 class="bg_tr"><B><SPAN style="FONT-SIZE: 10.5pt">好友管理</SPAN></B></td>
<td width=583 height=20 align=right class="bg_tr">·<a href="?ListType=1">好友</a>[<a href="?Action=add&flag=1">添加</a>]</a> ·<a href="?ListType=2">陌生人</a>[<a href="?Action=add&flag=2">添加</a>] ·<a href="?ListType=3">黑名单</a>[<a href="?Action=add&flag=3">添加</a>]</td>
</tr>
</table>
<%
action=Trim(request("action"))
CurrentPage=Trim(request("page"))
if Isnumeric(CurrentPage) then
CurrentPage=Clng(CurrentPage)
else
CurrentPage=1
end if
select case action
case "add"
Call AddFriend()
case "edit"
Call AddFriend()
case "addsave"
call addsave()
case "del"
call Del()
case "info"
call info()
case "addF"
call addF()
case "saveF"
call saveF()
case "删除"
call DelFriend()
case "清空好友"
call AllDelFriend()
case else
call info()
end select
%>
</TD>
</TR>
</TABLE>
<%
'删除好友
Sub Del()
conn.execute("delete from Art_Friend where id=" & ChkNumeric(s("id")))
response.redirect request.servervariables("http_referer")
end sub
'添加好友
Sub AddFriend()
dim flag,username,realname,phone,mobile,qq,msn,email,note
dim id:id=ChkNumeric(s("id"))
if s("action")="edit" then
dim rs:set rs=server.createobject("adodb.recordset")
rs.open "select * from Art_Friend where id=" & id,conn,1,1
if rs.eof and rs.bof then
rs.close:set rs=nothing
call Alert("参数传递出错!",""):exit sub
else
username=rs("friend")
flag=rs("flag")
realname=rs("realname")
phone=rs("phone")
mobile=rs("mobile")
qq=rs("qq")
msn=rs("msn")
email=rs("email")
note=rs("note")
end if
rs.close:set rs=nothing
else
flag=s("flag")
end if%>
<script>
function checkform()
{
if (document.myform.username.value=='')
{
alert('请输入好友的用户名!');
document.myform.username.focus();
return false;
}
return true;
}
</script>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" class="table">
<form action="?action=addsave" method="post" name="myform" onSubmit="return(checkform())">
<tr height="23" class="bg_tr">
<td width="25%" height="25" align="center">添加好友</td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="1" width="100%">
<tr class='tdbg'>
<td width="344"><b>用户名</b><br>
登录会员中心的用户名,必须填写。</td>
<td width="607"><input type="text" class="textbox" name="username" value="<%=username%>" size=20 style="width:150"> <font color=red>*</font></td>
</tr>
<tr class='tdbg'>
<td><b>类 型</b><br>加入黑名单以后,就不会受到这个用户的短信骚扰了。</td>
<td><select name="flag" style="width:150">
<option value="1" <%if flag="1" then response.write " selected"%>>好朋友</option>
<option value="2" <%if flag="2" then response.write " selected"%>>陌生人</option>
<option value="3" <%if flag="3" then response.write " selected"%>>黑名单</option>
</select></td>
</tr>
<tr class='tdbg'>
<td><b>真实姓名</b><br>你好友的姓名,可选填。</td>
<td><input type="text" class="textbox" value="<%=realname%>" name="realname" size=20 style="width:150"></td>
</tr>
<tr class='tdbg'>
<td><b>电子邮箱</b><br>好友电子邮箱号码,可选填。</td>
<td><input type="text" class="textbox" value="<%=email%>" name="email" size=20 style="width:150"></td>
</tr>
<tr class='tdbg'>
<td><b>备注信息</b><br/>必须小于255个字符</td>
<td><textarea class="textbox" name="note" cols=50 rows=5><%=note%></textarea></td>
</tr>
<tr class='tdbg'>
<td height="30" colspan=2 align="center">
<input type="hidden" name="id" value="<%=id%>">
<input type="submit" class="ACT_btn" value=" OK,保存 ">
<input type="button" class="ACT_btn" value=" 取 消 " onClick="javascript:history.back()"></td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<%
End Sub
'保存
sub addsave()
dim flag:flag=ChkNumeric(s("flag"))
dim username:username=RSQL(s("username"))
dim realname:realname=RSQL(s("realname"))
dim phone:phone=RSQL(s("phone"))
dim mobile:mobile=RSQL(s("mobile"))
dim qq:qq=RSQL(s("qq"))
dim msn:msn=RSQL(s("msn"))
dim email:email=RSQL(s("email"))
dim note:note=s("note")
if username="" then call Alert("用户名必须填写",""):exit sub
if username=UserHS.username then call Alert("不能将自己加为好友!",""):exit sub
if len(note)>255 then call Alert("备注信息必须小于255个字符!",""):exit sub
dim rs:set rs=server.createobject("adodb.recordset")
rs.open "select username from Art_User where username='" & username & "'",conn,1,1
if rs.eof and rs.bof then
rs.close:set rs=nothing
call alert("对不起,你输入的用户名不存在!","")
exit sub
end if
rs.close
rs.open "select * from Art_Friend where friend='" & username & "'",conn,1,3
if rs.eof then
rs.addnew
end if
rs("username")=UserHS.username
rs("friend")=username
rs("addtime")=now
rs("realname")=realname
rs("phone")=phone
rs("mobile")=mobile
rs("qq")=qq
rs("msn")=msn
rs("email")=email
rs("note")=note
rs("flag")=flag
rs.update
if ChkNumeric(s("id"))<>0 then
response.write "<script>alert('好友资料修改成功!');location.href='?';</script>"
else
response.write "<script>if (confirm('好友添加成功,继续添加吗?')){location.href='?action=add&flag=" & flag & "';}else{location.href='Friend_User.asp';}</script>"
end if
end sub
sub info()
%>
<script>
function viewnote(obj)
{
if (eval("document.all."+obj+".style.display=='none'"))
eval("document.all."+obj+".style.display='';")
else
eval("document.all."+obj+".style.display='none';")
}
</script>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" class="table">
<form action="Friend_User.asp" method=post name=inbox>
<tr height="23" class="bg_tr">
<td width="5%" align="center">选择</td>
<td width="18%" align="center">类 型</td>
<td width="16%" height="25" align="center">用户名</td>
<td width="18%" align="center">真实姓名</td>
<td width="21%" align="center">操 作</td>
<td width="22%" align="center">备 注</td>
</tr>
<% dim param
if ChkNumeric(s("listtype"))<>0 then param=param & " and flag=" & ChkNumeric(s("listtype"))
set rs=server.createobject("adodb.recordset")
sql="select F.id,f.friend,f.flag,f.note,f.email,U.UserID,f.Email,f.RealName from Art_Friend F inner join Art_User U on F.Friend=U.UserName where F.Username='"&UserHS.UserName&"' " & param & " order by F.addtime desc"
rs.open sql,Conn,1,1
if rs.eof and rs.bof then
%>
<tr>
<td height="26" colspan=6 align=center valign=middle class="td_bg">
<% select case s("listtype")
case "2"
response.write "你没有添加陌生人。"
case "3"
response.write "你没有添加黑名单。"
case else
response.write "你没有添加好朋友。"
end select
%>
</td>
</tr>
<%else
do while not rs.eof
%>
<tr class="td_bg" onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align=center><input type=checkbox name=id value=<%=rs(0)%>></td>
<td align=center>
<%
select case rs(2)
case 2
response.write "陌生人"
case 3
response.write "黑名单"
case else
response.write "好朋友"
end select
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -