www.gusucode.com > 栽豆迷你博客 MiniBlog 3.0 正式版源码程序 > Home.asp
<!--#include file="include/conn.asp" --> <!--#include file="include/char.asp" --> <!--#include file="include/const.asp" --> <!--#include file="include/function.asp" --> <% Dim StrHtml,model,id,content,sqlstr,AllPage,Page,MaxPage,StrHreF,jj,m,fromusername,tousername,addtime,myrs,friends,infors,userfriends,userfriend,i,ors model=Replace(Request.QueryString("m"),"'","''") m=Replace(CheckStr(Request.QueryString("m")),"'","''") id=Replace(ValidInteger(Request.QueryString("id")),"'","''") content=Replace(Caluoob.ChkBadWords(RemoveHTML(CheckStr(Request.Form("content")))),"'","''") StrHtml=Caluoob.Loadskins("user_table.txt") Select Case model Case "edit" Set myrs = Caluoob.Execute("Select id,userid,content from [cb_ing] where id="&id&"") If myrs.eof or myrs.bof then Caluoob.ShowErr("没有此主题!") If myrs(1)<>Caluoob.udata(0,0) then Caluoob.ShowErr("您无权限编辑该主题!") StrHtml=Replace(StrHtml,"$table_content",Caluoob.Loadskins("user_home.txt")) StrHtml=Replace(StrHtml,"$action","?m=editsave&id="&id&"") StrHtml=Replace(StrHtml,"$Content",myrs(2)) StrHtml=Replace(StrHtml,"$table_hostname",Caluoob.SystemName) StrHtml=Replace(StrHtml,"$table_mying",abouting()) set myrs=nothing Case "editsave" Set myrs = Caluoob.Execute("Select content from [cb_ing] where id="&id&"") Caluoob.Execute("Update [cb_ing] Set content='"&content&"' Where id="&id&"") myrs.close:set myrs=nothing Response.Redirect "home.asp?m=archive" Case "addsave" Caluoob.Execute("Insert Into [cb_ing] (userid,content) Values("&Caluoob.UserID&",'"&content&"')") Caluoob.Execute("update [cb_user] Set favcount=favcount+1 Where id="&Caluoob.UserID&"") Caluoob.Execute("update [cb_system] set allfav=allfav+1 where id=1") Call Caluoob.UserData Application(CachesName&"loadSystem")=False Response.Redirect "home.asp" Case "del" Caluoob.LogString Caluoob.Execute("delete From [cb_ing] Where id="&id) Caluoob.Execute("update [cb_user] Set favcount=favcount-1 Where id="&Caluoob.UserID&"") Caluoob.Execute("update [cb_system] set allfav=allfav-1") Application(CachesName&"loadSystem")=False Caluoob.UserData() Response.Redirect "home.asp" Case "archive" StrHtml=Replace(StrHtml,"$table_content",Caluoob.Loadskins("user_archive.txt")) StrHtml=Replace(StrHtml,"$table_hostname",Caluoob.SystemName) StrHtml=Replace(StrHtml,"$table_mying",archives()) StrHtml=Replace(StrHtml,"$action","?m=addsave") StrHtml=Replace(StrHtml,"$Content","") Case "receive" StrHtml=Replace(StrHtml,"$table_content",Caluoob.Loadskins("user_receive.txt")) StrHtml=Replace(StrHtml,"$table_hostname",Caluoob.SystemName) StrHtml=Replace(StrHtml,"$table_mying",receives()) StrHtml=Replace(StrHtml,"$action","?m=addsave") StrHtml=Replace(StrHtml,"$Content","") Case "replies" StrHtml=Replace(StrHtml,"$table_content",Caluoob.Loadskins("user_archive.txt")) StrHtml=Replace(StrHtml,"$table_hostname",Caluoob.SystemName) StrHtml=Replace(StrHtml,"$table_mying",MyIngs()) StrHtml=Replace(StrHtml,"$action","?m=addsave") StrHtml=Replace(StrHtml,"$Content","") Case "friends" StrHtml=Replace(StrHtml,"$table_content",Caluoob.Loadskins("user_friends.txt")) StrHtml=Replace(StrHtml,"$table_hostname",Caluoob.SystemName) StrHtml=Replace(StrHtml,"$table_mying",myfriends()) StrHtml=Replace(StrHtml,"$action","?m=addsave") StrHtml=Replace(StrHtml,"$Content","") Case Else StrHtml=Replace(StrHtml,"$table_content",Caluoob.Loadskins("user_home.txt")) StrHtml=Replace(StrHtml,"$table_hostname",Caluoob.SystemName) StrHtml=Replace(StrHtml,"$table_mying",abouting()) StrHtml=Replace(StrHtml,"$action","?m=addsave") StrHtml=Replace(StrHtml,"$Content","") End Select Caluoob.Herder Caluoob.SystemName&" | 我的首页" StrHtml=Replace(StrHtml,"$table_other_content",Caluoob.Loadskins("user_info.txt")) StrHtml=Replace(StrHtml,"$table_userid",Caluoob.udata(0,0)) StrHtml=Replace(StrHtml,"$table_synames",Caluoob.SystemName) StrHtml=Replace(StrHtml,"$table_ttnames",Caluoob.NickName) StrHtml=Replace(StrHtml,"$table_domainname",Caluoob.DomainName) StrHtml=Replace(StrHtml,"$table_friendsnum",Caluoob.udata(10,0)) StrHtml=Replace(StrHtml,"$table_favcount",Caluoob.udata(7,0)) StrHtml=Replace(StrHtml,"$table_album",Caluoob.udata(11,0)) Response.Write StrHtml Caluoob.Footer Response.Flush() '给用户的回复 Function receives() page=Replace(ValidInteger(Request.QueryString("p")),"'","''") StrHreF="?" if m<>"" then StrHreF=StrHreF&"m="&Server.URLEncode(m)&"&" end if StrHreF=StrHreF&"p=" If page="" then page=1 MaxPage=15 If Not IsObject(Conn) Then ConnectionDatabase Caluoob.SqlQueryNum=Caluoob.SqlQueryNum+1 Set myrs=Server.CreateObject("ADODB.recordset") sqlstr="select cb_reing.*,cb_user.id,cb_user.userface,cb_user.nicknames from [cb_reing] inner join [cb_user] on cb_reing.fromuserid=cb_user.id where touserid="&Caluoob.UserID&" order by cb_reing.id desc" myrs.Open sqlstr,conn,1,1 receives="<ol class=wa>" if myrs.Eof or myrs.bof then receives=receives&"暂时没有给你的回复!</div>" else AllPage=myrs.RecordCount myrs.MoveFirst myrs.Move (Page-1)*MaxPage For jj=1 to MaxPage receives=receives&"<li><a href=hi.asp?u="&myrs("cb_user.id")&" class=avatar><img src=face/"&myrs("userface")&"></a><a href=hi.asp?u="&myrs("cb_user.id")&" class=author>"&myrs("nicknames")&"</a> <span class=content>"&myrs("content")&"</span> <span class=stamp><span class=time>"&myrs("addtime")&"</span> <span class=method>" if myrs("IsMethod")=0 then receives=receives&"通过网页" elseif myrs("IsMethod")=1 then receives=receives&"通过WAP" end if receives=receives&"</span></span> <span class=op><a href=statuses.asp?id="&myrs("ingid")&" class=reply target=_blank>查看</a></span></li>" myrs.movenext If myrs.EOF Then Exit For next receives=receives&"</ol></div>" receives=receives&SubClassPage(Page,MaxPage,AllPage,StrHreF) myrs.close set myrs=nothing end if End Function '用户自己的信息 Function archives() page=Replace(ValidInteger(Request.QueryString("p")),"'","''") StrHreF="?" if m<>"" then StrHreF=StrHreF&"m="&Server.URLEncode(m)&"&" end if StrHreF=StrHreF&"p=" If page="" then page=1 MaxPage=15 If Not IsObject(Conn) Then ConnectionDatabase Caluoob.SqlQueryNum=Caluoob.SqlQueryNum+1 Set myrs=Server.CreateObject("ADODB.recordset") sqlstr="select cb_ing.*,cb_user.id,cb_user.userface,cb_user.nicknames from [cb_ing] inner join [cb_user] on cb_ing.userid=cb_user.id where cb_user.id="&Caluoob.UserID&" order by cb_ing.id desc" myrs.Open sqlstr,conn,1,1 archives="<ol class=wa>" if myrs.Eof or myrs.bof then archives=archives&"还没有任何信息!</div>" else AllPage=myrs.RecordCount myrs.MoveFirst myrs.Move (Page-1)*MaxPage For jj=1 to MaxPage archives=archives&"<li><a href=hi.asp?u="&myrs("cb_user.id")&" class=avatar><img src=face/"&myrs("userface")&"></a><a href=hi.asp?u="&myrs("cb_user.id")&" class=author>"&myrs("nicknames")&"</a> <span class=content>"&myrs("content")&"</span> <span class=stamp><span class=time>"&myrs("addtime")&"</span> <span class=method>" if myrs("IsMethod")=0 then archives=archives&"通过网页" elseif myrs("IsMethod")=1 then archives=archives&"通过WAP" end if archives=archives&"</span></span> <span class=op><a href=statuses.asp?id="&myrs("cb_ing.id")&" class=reply target=_blank>"&myrs("ReNum")&"回复</a> <a href=home.asp?m=edit&id="&myrs("cb_ing.id")&">编辑</a> <a href=?m=del&id="&myrs("cb_ing.id")&" class=post_act>删除</a></span></li>" myrs.movenext If myrs.EOF Then Exit For next archives=archives&"</ol></div>" archives=archives&SubClassPage(Page,MaxPage,AllPage,StrHreF) myrs.close set myrs=nothing end if End Function '用户的好友 Function myfriends() userfriends=caluoob.udata(12,0) myfriends="<ol class=wa>" if userfriends<>"" then userfriend=split(userfriends,"{$}") for i = 0 to ubound(userfriend)-1 Set ors=Caluoob.Execute("select id,nicknames,userface from cb_user where id="&userfriend(i)&"") myfriends=myfriends&"<li><a href=hi.asp?u="&ors("id")&" class=avatar><img src=face/"&ors("userface")&"></a><a href=hi.asp?u="&ors("id")&" class=author>"&ors("nicknames")&"</a><br><a href=do.asp?m=delfriend&in="&ors("id")&">删除好友</a> <a href=msg.asp>发送私信</a></li>" next myfriends=myfriends&"</ol></div>" ors.close set ors = nothing else myfriends=myfriends&"暂无好友</div>" end if End Function '用户和好友共同信息 Function abouting() page=Replace(ValidInteger(Request.QueryString("p")),"'","''") StrHreF="?" StrHreF=StrHreF&"p=" If page="" then page=1 MaxPage=15 If Not IsObject(Conn) Then ConnectionDatabase Caluoob.SqlQueryNum=Caluoob.SqlQueryNum+1 Set myrs=Server.CreateObject("ADODB.recordset") sqlstr="select cb_ing.*,cb_user.id,cb_user.userface,cb_user.friends,cb_user.nicknames from [cb_ing] inner join [cb_user] on cb_ing.userid=cb_user.id where userid="&Caluoob.UserID&"" if Caluoob.udata(12,0)<>"" then sqlstr=sqlstr&" or userid in ("&replace(Caluoob.udata(12,0),"{$}",",")&")" sqlstr=sqlstr&" order by cb_ing.id desc" myrs.Open sqlstr,conn,1,1 abouting="<ol class=wa>" if myrs.Eof or myrs.bof then abouting=abouting&"还没有任何信息!</div>" else AllPage=myrs.RecordCount myrs.MoveFirst myrs.Move (Page-1)*MaxPage For jj=1 to MaxPage abouting=abouting&"<li><a href=hi.asp?u="&myrs("cb_user.id")&" class=avatar><img src=face/"&myrs("userface")&"></a><a href=hi.asp?u="&myrs("cb_user.id")&" class=author>"&myrs("nicknames")&"</a> <span class=content>"&myrs("content")&"</span> <span class=stamp><span class=time>"&myrs("addtime")&"</span> <span class=method>" if myrs("IsMethod")=0 then abouting=abouting&"通过网页" elseif myrs("IsMethod")=1 then abouting=abouting&"通过WAP" end if abouting=abouting&"</span></span> <span class=op><a href=statuses.asp?id="&myrs("cb_ing.id")&" class=reply target=_blank>"&myrs("ReNum")&"回复</a></span></li>" myrs.movenext If myrs.EOF Then Exit For next abouting=abouting&"</ol></div>" abouting=abouting&SubClassPage(Page,MaxPage,AllPage,StrHreF) myrs.close set myrs=nothing end if End Function %>