friend.asp

来自「一个不错的论坛原代码」· ASP 代码 · 共 579 行 · 第 1/2 页

ASP
579
字号
succmsg="<li>祝贺您,添加好友成功</li>"
call succ(succmsg)
end if


end sub

sub dellfriend()
u_friendname1=chktopic(request("u_username"))
if u_friendname1="" then errormsg=errormsg&"<li>您没有选择要删除的好友名称</li>"
if  errormsg<>"" then
call error(errormsg)
call bq()
response.end
else
u_friendname1=u_friendname1&","
sql="select u_friend from user where username='"&cpbusername&"'"
set rs=conn.execute(sql)
if not rs.eof then
u_friend=rs("u_friend")
u_friend=replace(u_friend,u_friendname1,"")
sql="update user set u_friend='"&u_friend&"' where username='"&cpbusername&"'"
conn.execute(sql)
succmsg="<li>用户<B>"&u_friendname1&"</b>已经从您的好友表中删除</li>"
call succ(succmsg)
else
errormsg=errormsg&"<li>参数错误,非法登陆</li>"
call error(errormsg)
end if
end if
end sub


sub dellallfriend()
u_friend=""
sql="update user set u_friend='"&u_friend&"' where username='"&cpbusername&"'"
conn.execute(sql)
succmsg="<li>您的好友表已经清空</li>"
call succ(succmsg)
end sub

sub badfriend()

%>


 <center>
                  
                  

      <table border=1 borderColor=<%=tdc2%> cellPadding=4 cellSpacing=1 width=<%=tdc3%> style="border-collapse: collapse" align=center>
 
        <tr> 
          <td height="21" width="100%" align="center"  <%=hColor%> class=tdc1 colspan="5" >
          <%=cpbusername%> 忽略列表</td>
        </tr>
<form action="?" method=post>
  <tr> 
          <td height="21" width="10%" align="center" <%=tColor%> class=tdc1>用户名</td>
          <td height="21" width="50%" align="center" <%=tColor%> class=tdc1>主页</td>
          <td height="21" width="20%" align="center" <%=tColor%> class=tdc1>邮件</td>
          <td height="21" width="15%" align="center" <%=tColor%> class=tdc1>发短信</td>
          <td height="21" width="15%" align="center" <%=tColor%> class=tdc1> 操作</td>
        </tr>
        
        <% sql="select u_badfriend from user where username='"&cpbusername&"'"
set rs=conn.execute(sql)
if not rs.eof then u_friend=rs("u_badfriend")

if not isnull(u_friend) and u_friend<>"" then
u_friendname=split(u_friend,",")

fmaxcount=ubound(u_friendname)

fpage=2'每个用户数
page=request("page")'
c=0
cmax=0
if page="" then page=1
if fmaxcount mod cint(fpage)=0 then
 fmaxpage=fmaxcount  \ cint(fpage)
 else
  fmaxpage=fmaxcount \ cint(fpage)+1
  end if
  
for i=0 to (ubound(u_friendname)-1)
sql="select email,home from user where username='"&u_friendname(i)&"'"
set rs=conn.execute(sql)
if not rs.eof then
u_home=rs("home")
u_email=rs("email")
else
u_home="该用户已经不存在,请删除"
u_email="该用户已经不存在,请删除"
end if
c=c+1
if cmax>=fpage then
exit for 
elseif c>(page-1)*fpage then
cmax=cmax+1%>

          <tr> 
            <td height="21" width="10%" align="center"  bgcolor=<%=tColor2%> class=tdc><a href="viewuser.asp?username=<%=u_friendname(i)%>" target=_blank><%=u_friendname(i)%></a></td>
            <td height="21" width="50%"  bgcolor=<%=tColor2%> class=tdc><a href="<%=u_home%>" target=_blank><%=u_home%></a></td>
            <td height="21" width="20%" align="center" bgcolor=<%=tColor2%> class=tdc1><a href="mailto:<%=u_email%>"><%=u_email%></a></td>
            <td height="21" width="15%" align="center"  bgcolor=<%=tColor2%> class=tdc><a href="pm.asp?mode=add&action=add&username=<%=u_friendname(i)%>">发送</a></td> 
         
   <td height="21" width="15%" align="center" bgcolor=<%=tColor2%> class=tdc1><INPUT type=radio value=<%=u_friendname(i)%> name=u_username></td> </tr>
   <%end if
   next%>
           <tr  align="left" height=23> 
            <td colspan="5" bgcolor=<%=tColor2%> class=tdc >
            
   <%
            if fmaxpage="" then maxpagecount=1
pagestart=page-5
pageend=page+5
if pagestart<1 then pagestart=1
if pageend>fmaxpage then pageend=fmaxpage
response.write(" [ ")
if fmaxpage > 6 then Response.Write ("<a href=?action=badfriend&page=1>1</a> ... ")
for i=pagestart to pageend
if i<>int(page) then
Response.Write (" <a href=?action=badfriend&page="&i&">" & i & "</a> ")
else
Response.Write ("<b>"&i&"</b> ")
end if
next
if fmaxpage > page +5 then Response.Write( " ... <a href=?action=badfriend&page="&fmaxpage&">"&fmaxpage&"</a>")
response.write(" ] ")
response.write("..页次:"&page&"/"&fmaxpage&"页   每页:"&fpage&" 用户数:"&fmaxcount&" </td> ")%>  


 </tr>

        <%  else%>

            <tr> 
          <td height="21" width="100%" align="center"  bgcolor=<%=tColor2%> class=tdc colspan="5" >
        您的忽略列表中没有忽略用户</td>
        </tr>
           <% end if%> 
  <tr> 
          <td height="21" width="100%" align="right"  bgcolor=<%=tColor2%> class=tdc colspan="5" >
       <input type=button name=action onclick="location.href='?action=addh'" value="添加忽略用户" class=bdtj>&nbsp;<input type=submit name=action onclick="{if(confirm('确定删除选定的纪录吗?')){this.document.inbox.submit();return true;}return false;}" value="删除忽略用户" class=bdtj>&nbsp;<input type=submit name=action onclick="{if(confirm('确定清除所有的纪录吗?')){this.document.inbox.submit();return true;}return false;}" value="清空忽略用户" class=bdtj></td>
        </tr>
</form>
      </table>

    </center>





<%end sub

sub addh()%>
<center>
                  
                  

      <table border=1 borderColor=<%=tdc2%> cellPadding=4 cellSpacing=1 width=<%=tdc3%> style="border-collapse: collapse" align=center>
 
        <tr> 
          <td height="21" width="100%" align="center"  <%=hColor%> class=tdc1 colspan="5" >
          添加忽略用户</td>
        </tr>
<form action="?action=add1" method=post>
 <tr> 
      <td align="right" width="25%" bgcolor=<%=tColor2%> class=tdc>忽略用户名称:</td>
      <td bgcolor=<%=tColor2%> class=tdc colspan="4"> 
        &nbsp;<input type="text" size="40" name="u_friendname"  class="bdtj" value="">&nbsp;(多位忽略用户请用逗号(,)分开,最多4位用户,您将会拒收忽略用户的短信)</td>
    </tr>
      <tr> 
      <td bgcolor=<%=tColor2%> class=tdc width="15%"> </td>
      <td bgcolor=<%=tColor2%> class=tdc colspan="4"> 
        &nbsp;<input type="submit" name="Submit" value="保存" class="bdtj" >
        <input type="button" value="返回" onClick="JavaScript:history.go(-1)" name="Button" class="bdtj">  

              </td>
    </tr>
    
</form>
      </table>

    </center>

<%
end sub
sub add1()
u_friendname1=chktopic(request("u_friendname"))
if u_friendname1="" then
errormsg=errormsg&"<li>您没有输入忽略用户名称</li>"
else
u_friendname=split(u_friendname1,",")
if ubound(u_friendname)>3 then errormsg=errormsg&"<li>您输入的忽略用户名称超过了4个,请减少重新输入</li>"
end if

if  errormsg<>"" then
call error(errormsg)
call bq()
response.end
end if

u_monyfriend=0
sql="select u_badfriend from user where username='"&cpbusername&"'"
set rs=conn.execute(sql)
if not rs.eof then
u_friend1=rs("u_badfriend")

if not isnull(u_friend1) then 
u_friend=split(u_friend1,",")
u_monyfriend=ubound(u_friend)
end if

else
errormsg=errormsg&"<li>参数错误,非法登陆</li>"
end if

for i=0 to ubound(u_friendname)
if cpbusername=u_friendname(i) then 
errormsg=errormsg&"<li>很抱歉,您不可以自己忽略自己</li>"
exit for
end if
if instr(u_friend1,u_friendname(i))>0 then
errormsg=errormsg&"<li>忽略用户<B>"&u_friendname(i)&"</b>已经在您的忽略用户表中</li>"
exit for
end if
if u_monyfriend+ubound(u_friendname)>=int(h_badfriend) then 
errormsg=errormsg&"<li>您的忽略用户表只能存在"&h_badfriend&"位忽略用户,现在已经有"&u_monyfriend&"位忽略用户</li>"
exit for
end if
sql="select username from user where username='"&u_friendname(i)&"'"
set rs=conn.execute(sql)
if rs.eof then 
errormsg=errormsg&"<li>用户<B>"&u_friendname(i)&"</b>不存在</li>"
exit for
end if
next

if  errormsg<>"" then
call error(errormsg)
call bq()
response.end
else
sql="update user set u_badfriend=u_badfriend&'"&u_friendname1&","&"' where username='"&cpbusername&"'"
conn.execute(sql)
succmsg="<li>祝贺您,忽略用户成功添加</li>"
call succ(succmsg)
end if


end sub

sub dellfriend1()
u_friendname1=chktopic(request("u_username"))
if u_friendname1="" then errormsg=errormsg&"<li>您没有选择要删除的忽略用户</li>"
if  errormsg<>"" then
call error(errormsg)
call bq()
response.end
else
u_friendname1=u_friendname1&","
sql="select u_badfriend from user where username='"&cpbusername&"'"
set rs=conn.execute(sql)
if not rs.eof then
u_friend=rs("u_badfriend")
u_friend=replace(u_friend,u_friendname1,"")
sql="update user set u_badfriend='"&u_friend&"' where username='"&cpbusername&"'"
conn.execute(sql)
succmsg="<li>用户<B>"&u_friendname1&"</b>已经从您的忽略用户表中删除"
call succ(succmsg)
else
errormsg=errormsg&"<li>参数错误,非法登陆</li>"
call error(errormsg)
end if
end if
end sub

sub dellallfriend1()
u_friend=""
sql="update user set u_badfriend='"&u_friend&"' where username='"&cpbusername&"'"
conn.execute(sql)
succmsg="<li>您的忽略用户表已经清空</li>"
call succ(succmsg)
end sub

end if%><!--#include file="bq.asp" -->

⌨️ 快捷键说明

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