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

📄 user_friend.asp

📁 本系统是一套开源WEB的网站管理系统
💻 ASP
字号:
<!--#include file="user_popedom.asp"-->
<%
'==============================================================
'程序名称:茂盛网站管理系统(Maoin CSM)
'当前版本:Maosin CMS Version 1.1   Powered by maosin.com
'程序作者:阿茂(李胜茂)
'网站地址:www.maosin.com   www.maosin.net
'      QQ:57861417  
'电子邮箱:maosin@163.com  maosin@maosin.com
'--------------------------------------------------------------
'Copyright (C) 2006 maosin.com All Rights Reserved.
'免费版本请在程序首页保留(Powered by:Maosin CMS)版权链接信息;
'您可以对此版本进行修改,美化,但请保留此ASP文件内的版权信息;
'茂盛设计网保留此软件的法律追究权利
'==============================================================
Sub friendlist()
If Request.form("addfriendok")<>"" Then
	if ms_submit=0 then
		if chkIsOut=false then
			showmsg "<font color=""#ff0000"">茂 盛系统返回提示信息:</font><br><br>对不起,本站不允许从外部提交数据","系统出错信息"
			exit sub
		end if
	end if
	friendname=trim(Request.form("friendname"))
	if lcase(userInfo(1))=lcase(friendname) then
		showmsg "对不起,不能把 <font color='#ff0000'>自己</font> 添加为好友!","操作出错信息"
		exit sub
	end if
	if friendname="" then
		showmsg "请您填上你要添加的好友!","操作出错信息"
		exit sub
	elseif chkIsAvaStr(friendname)=false then
		showmsg "名字中含有非法字符","操作出错信息"
		exit sub
	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 conn.execute("select count(user_name) from ms_user where user_name='"&friendname&"'")(0)=0 then
		showmsg "您添加的 <font color='#ff0000'>"&friendname&"</font> 不存在!","系统返回信息"
		exit sub
	end if
	if conn.execute("select count(friend_id) from ms_user_friend where user_name='"&userInfo(1)&"' and user_friend='"&lcase(friendname)&"'")(0)<>0 then
		showmsg "您添加的好友已经存在啦!","系统返回信息"
		exit sub
	end if
	conn.execute("insert into ms_user_friend(user_name,user_friend,addDate) values('"&userinfo(1)&"','"&lcase(friendname)&"',#"&now&"#)")
	showmsg "恭喜恭喜,您已成功把"&friendname&"添加为好友啦!","系统返回信息"
	exit sub
Elseif request.form("deleteSelect")<>"" then
		friend_count=request.form("user_friend").count
		dim user_friend
		for i=1 to friend_count
			user_friend=user_friend&"'"&replace(replace(request.form("user_friend")(i),"'",""),"""","")&"',"
		next
		sql="delete from ms_user_friend  where user_friend in ("&user_friend&")"
		message="您已经删除了"&friend_count&"个好友!"
		if friend_count<>0 then
			conn.execute(sql)
			response.write("<script>alert('"&message&"');window.location.href='http://maosin.com/user_center.asp?action=friendlist';</script>")
			exit sub
		else
			response.write("<script>alert('您没有选择任何操作');window.history.go(-1);</script>")
			exit sub
		end if
End if
sql="select * from ms_user where user_name in (select user_friend from ms_user_friend where user_name='"&userinfo(1)&"')"
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.Open sql,connstr,1,1
n=20'每页显示记录数
url="user_center.asp?action=friendlist&"
nextpage=pagetitle(rs,n,url,"位好友")
%>
<br/>
	  <table width="100%" border="0" cellpadding="1" cellspacing="1" class="tableBC">
	  	<tr><td colspan="11" height="22" class="tdT">我的好友</td></tr>
        <tr valign="middle" align="center" class="intdT"> 
		  <td width="*" height="22" valign="middle">用户名</td>
		  <td width="60" valign="middle">类型</td>
		  <td width="35" valign="middle">性别</td>
		  <td width="35" valign="middle">邮箱</td>
		  <td width="35" valign="middle">QQ</td>
		  <td width="35" valign="middle">主页</td>
		  <td width="40" valign="middle">发短信</td>
		  <td width="35" valign="middle">状态</td>
		  <td width="35" valign="middle">登录</td>
		  <td width="120" valign="middle">注册时间</td>
		  <td width="35" valign="middle">选定</td>
        </tr>
		<form name="smsform" method="post" action="user_center.asp?action=friendlist">
		<%
	if (not rs.eof) and (not rs.bof) then
		lineNo=1
	temp_str=""
	dim userlist(10)
	Do While Not rs.Eof And lineNo<=rs.pagesize
	  userlist(0)=rs("user_name")
	  if cint(rs("user_type"))=1 then
		userlist(1)="注册会员"
	  elseif cint(rs("user_type"))=2 then
		userlist(1)="VIP会员"
	  elseif cint(rs("user_type"))=3 then
		userlist(1)="管理员"
	  else
		userlist(1)="游客"
	  end if
	  userlist(2)=rs("sex")
	  if rs("email")="" then
		userlist(3)="没有"
	  else
		userlist(3)="<a href=""mailto:"&rs("email")&""" target=""_blank""><img src=""images/email.gif"" border=""0"" align=""absmiddle"" title=""给 "&userlist(0)&" 发封邮件""></a>"
	  end if
	  if rs("qq")="" then
		userlist(4)="没有"
	  else
		userlist(4)="<img src=""images/user/qq.gif"" title="""&userlist(0)&"的QQ:"&rs("qq")&""" align=""absmiddle"">"
	  end if
	  if rs("homepage")="" then
		userlist(5)="没有"
	  else
		userlist(5)="<a href="""&rs("homepage")&"""><img src=""images/user/url.gif"" title=""去 "&userlist(0)&" 的主页看看"" border=""0"" align=""absmiddle""></a>"
	  end if
	  if rs("islock")=0 then
	  	userList(6)="正常"
	  elseif rs("islock")=1 then
	  	userList(6)="锁定"
	  end if
	  userlist(7)=rs("logon_num")
	  userlist(8)=rs("reg_date")
	  userlist(9)="<a href=user_center.asp?action=user_view&userName="&rs("user_name")&" title=""查看 "&rs("user_name")&" 详细信息"">"&rs("user_name")&"</a>"
	  temp_str=temp_str&"<tr class=""tdBC"" align=""center""><td height=""22"" valign=""middle"">"&userlist(9)&"</td><td valign=""middle"">"&userlist(1)&"</td><td valign=""middle"">"&userlist(2)&"</td><td valign=""middle"">"&userlist(3)&"</td><td valign=""middle"">"&userlist(4)&"</td><td valign=""middle"">"&userlist(5)&"</td><td valign=""middle""><a href=""user_center.asp?action=sms&operation=sendmessage&friendname="&userlist(0)&""" title=""给 "&userlist(0)&" 发短信""><img src=""images/sms/msg.gif"" border=""0"" align=""absmiddle""></a></td><td valign=""middle"">"&userlist(6)&"</td><td valign=""middle"">"&userlist(7)&"</td><td valign=""middle"">"&userlist(8)&"</td><td><input type=""checkbox"" name=""user_friend"" value="""&userlist(0)&"""></td></tr>"
		rs.MoveNext
		lineNo=lineNo+1
	Loop
	response.write(temp_str)
else%>
		<tr valign="middle" class="tdBC"><td height="30" colspan="11" align="center"><font color="#ff0000">您还没有添加好友,快点添加吧!</font></td></tr>
<%end if
	if rs.RecordCount>n then
	%>
	<tr class="tdBC" valign="middle" align="center"><td colspan="9"><%=nextpage%></td></tr>
	<%end if%>
	<tr><td colspan="11" height="25" class="tdBC" valign="middle" align="right">
	共有<font class="font" color="#ff0000"><%=rs.recordCount%></font>位好友&nbsp;&nbsp;
	<input type="checkbox" name="selectAll" onClick="selectedAll(this.form)" id="ckeckall"><label for="ckeckall">选择所有</label>&nbsp;
	<input type="submit" class="other_button" name="deleteSelect" value="删除所选">&nbsp;
	<input type="button" class="other_button" name="deleclear" onClick="showAddfriend()"  value="添加好友">
	</td></tr></form>
      </table>
	 <script type="text/javascript">
	 function selectedAll(obj){
	 for(var i=0;i<obj.elements.length-3;i++){
		obj.elements(i).checked=obj.selectAll.checked;
		}
	 }
	 function showAddfriend(){
	 if(document.all.addfriend.style.display=="none"){
	 	document.all.addfriend.style.display="block";	
		}
	 else{
	 	document.all.addfriend.style.display="none";
		}
	 }
	 </script>
<br>
<!--------------------添加好友------------------------------->
<table id="addfriend" width="100%" border="0" cellpadding="0" cellspacing="1" class="tableBC" style="display:none;">
  <tr> 
    <td height="26" colspan="2" align="center" bgcolor="#eeeeee" valign="middle" class="tdT" style="font-size:12px;text-align:center;">添加我的好友</td>
  </tr>
  <form action="user_center.asp?action=friendlist" method="post" name="addform">
  <tr class="tdBC"> 
    <td width="100" height="40" valign="middle" align="right">好友用户名:</td>
    <td valign="middle" style="padding:5px;">
      <input class="wenbenkang" name="friendname" type="text" size="40"></td>
  </tr>
  <tr> 
    <td height="25" colspan="2" align="center" class="tdT"> 
      <input type="submit" name="addfriendok" value="保存">
      <input type="reset" name="Submit2" value="清空"></td>
  </tr></form>
</table>
<%
rs.close
set rs=nothing
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -