www.gusucode.com > 栽豆迷你博客 MiniBlog 3.0 正式版源码程序 > Do.asp
<!--#include file="include/conn.asp" --> <!--#include file="include/char.asp" --> <!--#include file="include/cb_main.asp" --> <!--#include file="include/function.asp" --> <% Dim id,myrs,model,myfreinds model=Replace(Request.QueryString("m"),"'","''") id=Replace(ValidInteger(Request("in")),"'","''") Select Case model Case "delfriend" Set myrs=Caluoob.Execute("Select friends from [cb_user] where id="&Caluoob.UserID&"") If Caluoob.Com=False then Caluoob.ShowErr("很遗憾,您没有权限操作。请登陆后使用该功能。") If id="" then Caluoob.ShowErr("很遗憾,您操作错误。") If Caluoob.Execute("Select id From [cb_user] where id="&id&"").eof Then Caluoob.ShowErr("没有此用户。") myfreinds = Replace(myrs(0),""&id&"{$}","") Caluoob.Execute("update [cb_user] set friends='"&myfreinds&"',friendsnum=friendsnum-1 where id="&Caluoob.UserID) Response.Redirect "home.asp?m=friends" Case Else Set myrs=Caluoob.Execute("Select friends from [cb_user] where id="&Caluoob.UserID&"") If Caluoob.Com=False then Caluoob.ShowErr("很遗憾,您没有权限操作。请登陆后使用该功能。") If id="" then Caluoob.ShowErr("很遗憾,您操作错误。") If instr(myrs(0),""&id&"{$}")>0 then Caluoob.ShowErr("此好友已经添加。") If id=Caluoob.UserID then Caluoob.ShowErr("你不能添加自己为好友。") If Caluoob.Execute("Select id From [cb_user] where id="&id&"").eof Then Caluoob.ShowErr("没有此用户。") If myrs(0) <>"" Then Caluoob.Execute("update [cb_user] set friends='"&myrs(0)&id&"{$}"&"',friendsnum=friendsnum+1 where id="&Caluoob.UserID) Else Caluoob.Execute("update [cb_user] set friends='"&id&"{$}"&"',friendsnum=friendsnum+1 where id="&Caluoob.UserID) End If Response.Redirect "hi.asp?u="&Caluoob.UserID End Select %>