www.gusucode.com > 栽豆迷你博客 MiniBlog 3.0 正式版源码程序 > Hi.asp

    <!--#include file="include/conn.asp" -->
<!--#include file="include/char.asp" -->
<!--#include file="include/cb_main.asp" -->
<!--#include file="include/function.asp" -->
<%
Dim StrHtml,model,fuser,myrs,sqlstr,AllPage,Page,MaxPage,StrHreF,jj,u,d,userfriends,ors,userfriend,i,fdata,rs
model=Replace(Request.QueryString("d"),"'","''")
u=Replace(CheckStr(Request.QueryString("u")),"'","''")
fuser=Replace(CheckStr(Request.QueryString("u")),"'","''")

Set Rs=Caluoob.Execute("Select top 1 nicknames,province,city,userface,blogurl,remarks,usersex,favcount,friends,album,friendsnum,id from [cb_user] where id="&fuser)
If Rs.eof or Rs.bof then Caluoob.ShowErr("没有此用户。")
fdata=Rs.GetRows(1)
Rs.close
set Rs=Nothing

StrHtml=Caluoob.Loadskins("user_table.txt")
Select Case model
Case "message"
	StrHtml=Replace(StrHtml,"$table_content",Caluoob.Loadskins("hi_message.txt"))
	StrHtml=Replace(StrHtml,"$table_abouting",abouting())

Case "comment"
	StrHtml=Replace(StrHtml,"$table_content",Caluoob.Loadskins("hi_comment.txt"))
	StrHtml=Replace(StrHtml,"$table_comment",comment())

Case Else
	StrHtml=Replace(StrHtml,"$table_content",Caluoob.Loadskins("hi.txt"))
	StrHtml=Replace(StrHtml,"$table_archives",archives())
End Select

Caluoob.Herder Caluoob.SystemName&" | "&fdata(0,0)&"的空间"
StrHtml=Replace(StrHtml,"$table_avatar",avatar())
StrHtml=Replace(StrHtml,"$table_other_content",Caluoob.Loadskins("hi_rinfo.txt"))
StrHtml=Replace(StrHtml,"$userid",fdata(11,0))
StrHtml=Replace(StrHtml,"$nicknames",fdata(0,0))
StrHtml=Replace(StrHtml,"$provincename",fdata(1,0))
StrHtml=Replace(StrHtml,"$province",CheckStr(server.URLEncode(fdata(1,0))))
StrHtml=Replace(StrHtml,"$cityname",fdata(2,0))
StrHtml=Replace(StrHtml,"$city",CheckStr(server.URLEncode(fdata(2,0))))
StrHtml=Replace(StrHtml,"$remarks",fdata(5,0))
If fdata(6,0)=0 then
	StrHtml=Replace(StrHtml,"$usersex","男")
Else
	StrHtml=Replace(StrHtml,"$usersex","女")
End if
StrHtml=Replace(StrHtml,"$favcount",fdata(7,0))
StrHtml=Replace(StrHtml,"$friends",friends())
StrHtml=Replace(StrHtml,"$album",fdata(9,0))
StrHtml=Replace(StrHtml,"$friendnum",fdata(10,0))
Response.Write StrHtml
Caluoob.Footer
Response.Flush()

'用户的好友
Function friends()
    userfriends=fdata(8,0)
    friends="<ul class=alist>"
    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)&"")
	   friends=friends&"<li><a href=hi.asp?u="&ors("id")&"><img src=face/"&ors("userface")&"><span>"&ors("nicknames")&"</span></a></li>"
	   next
	   ors.close
	   set ors = nothing
	else
	    friends=friends&"暂无好友"
	end if
	friends=friends&"</ul>"
End Function

'最新的一条信息
Function avatar()
	If Not IsObject(Conn) Then ConnectionDatabase
	Caluoob.SqlQueryNum=Caluoob.SqlQueryNum+1
	Set myrs=Server.CreateObject("ADODB.recordset")  
	sqlstr="select top 1 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="&fuser&" order by cb_ing.id desc"
	myrs.Open sqlstr,conn,1,1
	if myrs.Eof or myrs.bof then
	avatar="什么也没有!"
	else
	avatar="<div id=avatar><img src=face/"&myrs("userface")&"></div><div id=latest><h1>"&myrs("nicknames")&""
	if Caluoob.Com=true then
	    avatar=avatar&"<span class=actions><a href=do.asp?in="&fdata(11,0)&" class=post_act>加为好友</a> | <a href=msg.asp>发送私信</a></span>"
	else
	avatar=avatar&""
	end if
	avatar=avatar&"</h1><p class=current><span class=content>"&myrs("content")&"</span><span class=stamp><span class=time>"&myrs("addtime")&"</span> "
	if myrs("IsMethod")=0 then
	   avatar=avatar&"<span class=method>通过网页</span></span></p></div>"
	elseif myrs("IsMethod")=1 then
	   avatar=avatar&"<span class=method>通过WAP</span></span></p></div>"
	end if
	myrs.close
	set myrs=nothing
	end if
End Function

'用户的信息
Function archives()
    page=Replace(ValidInteger(Request.QueryString("p")),"'","''")
	StrHreF="?"
	if u<>"" then
	StrHreF=StrHreF&"u="&Server.URLEncode(u)&"&"
	end if
	StrHreF=StrHreF&"p="
	If page="" then page=1
	MaxPage=10
	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 from [cb_ing] inner join [cb_user] on cb_ing.userid=cb_user.id where cb_user.id="&fuser&" order by cb_ing.id desc"
	myrs.Open sqlstr,conn,1,1
	archives="<ol>"
	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><span class=content>"&myrs("content")&"</span> <span class=stamp><span class=time>"&myrs("addtime")&"</span> "
	if myrs("IsMethod")=0 then
	   archives=archives&"<span class=method>通过网页</span>"
	elseif myrs("IsMethod")=1 then
	   archives=archives&"<span class=method>通过WAP</span>"
	end if
	archives=archives&"</span> <span class=op><a href=statuses.asp?id="&myrs("cb_ing.id")&" class=reply title=回复该消息>"&myrs("ReNum")&"回复</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 abouting()
    page=Replace(ValidInteger(Request.QueryString("p")),"'","''")
	StrHreF="?"
	if u<>"" then
	StrHreF=StrHreF&"u="&Server.URLEncode(u)&"&d=message&"
	end if
	StrHreF=StrHreF&"p="
	If page="" then page=1
	MaxPage=10
	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 cb_user.id="&fuser&""
	if fdata(8,0)<>"" then sqlstr=sqlstr&" or userid in ("&replace(fdata(8,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

'给用户的回复
Function comment()
    page=Replace(ValidInteger(Request.QueryString("p")),"'","''")
	StrHreF="?"
	if u<>"" then
	StrHreF=StrHreF&"u="&Server.URLEncode(u)&"&d=comment&"
	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 from [cb_reing] inner join [cb_user] on cb_reing.fromuserid=cb_user.id where fromuserid="&fuser&" order by cb_reing.id desc"
	myrs.Open sqlstr,conn,1,1
	comment="<ol>"
	if myrs.Eof or myrs.bof then
	comment=comment&"还没有任何信息!</div>"
	else
	AllPage=myrs.RecordCount
	myrs.MoveFirst
	myrs.Move (Page-1)*MaxPage
	For jj=1 to MaxPage
	comment=comment&"<li><span class=content>"&myrs("content")&"</span> <span class=stamp><span class=time>"&myrs("addtime")&"</span> "
	if myrs("IsMethod")=0 then
	   comment=comment&"<span class=method>通过网页</span>"
	elseif myrs("IsMethod")=1 then
	   comment=comment&"<span class=method>通过WAP</span>"
	end if
	comment=comment&"</span></li>"
	myrs.movenext
	If myrs.EOF Then Exit For
	next
	comment=comment&"</ol></div>"
	comment=comment&SubClassPage(Page,MaxPage,AllPage,StrHreF)
	myrs.close
	set myrs=nothing
	end if
End Function
%>