<!--#include file="conn.asp"-->
<%
dim logid,commentid,userid,messageid,action,user,sThisMonth,sMonth,teamid,albumid
dim rs,uf,sql
logid=Trim(Request("logid"))
commentid=Trim(Request("commentid"))
messageid=Trim(Request("messageid"))
userid=Trim(Request("userid"))
user=Trim(Request("user"))
action=Trim(Request("action"))
teamid=trim(request("teamid"))
albumid=trim(request("albumid"))
If logid<>"" And IsNumeric(logid) Then
	logid=Int(logid)
Else
	logid=""
End If
If commentid<>"" And IsNumeric(commentid) Then
	commentid=Int(commentid)
Else
	commentid=""
End If
If messageid<>"" And IsNumeric(messageid) Then
	messageid=Int(messageid)
Else
	messageid=""
End If
If userid<>"" And IsNumeric(userid) Then
	userid=Int(userid)
Else
	userid=""
End If
If teamid<>"" And IsNumeric(teamid) Then
	teamid=Int(teamid)
Else
	teamid=""
End If
If albumid<>"" And IsNumeric(albumid) Then
	albumid=Int(albumid)
Else
	albumid=""
End If
if not IsObject(conn) then link_database
if logid<>"" then
	if action="up" then
		sql="select top 1 logfile from oblog_log where logid<"&logid&" and userid="&userid&" order by logid desc"
	elseif action="down" then
		sql="select top 1 logfile from oblog_log where logid>"&logid&" and userid="&userid&" order by logid"
	else
		sql="select logfile from oblog_log where logid="&logid
	end if
	set rs=conn.execute(sql)
	if not rs.eof then
		dim logf,c
		if c<>"" then c="#"&c
		logf=rs(0)&c
		set rs=nothing
		if isobject(conn) then conn.close:set conn=Nothing
		If logf = "" Then response.Write("此日志为草稿，请登录用户草稿箱查看内容"):response.End
		response.Redirect(logf)
	else
		set rs=nothing
		response.Write("无此日志")
	end if
elseif userid<>"" then
	set rs=conn.execute("select user_dir,user_folder,user_domain,user_domainroot"&str_domain&" from oblog_user where userid="&Int(userid))
	if not rs.eof then
		if true_domain=1 then
			if rs("custom_domain")="" or isnull(rs("custom_domain")) then
				uf="http://"&rs("user_domain")&"."&rs("user_domainroot")&"/index."&f_ext
			else
				uf="http://"&rs("custom_domain")&"/index."&f_ext
			end if
		else
			uf=rs("user_dir")&"/"&rs("user_folder")&"/index."&f_ext
		end if
		set rs=nothing
		if isobject(conn) then conn.close:set conn=nothing
		response.Redirect(uf)
	else
		set rs=nothing
		response.Write("无此用户")
	end if
elseif messageid<>"" then
	set rs=conn.execute("select messagefile,user_dir,oblog_user.userid,user_folder,user_domain,user_domainroot"&str_domain&" from oblog_message,oblog_user where oblog_message.userid=oblog_user.userid and messageid="&Int(messageid))

	if not rs.eof then
		if true_domain=1 then
			if rs("custom_domain")="" or isnull(rs("custom_domain")) then
				uf="http://"&rs("user_domain")&"."&rs("user_domainroot")&"/message."&f_ext
			else
				uf="http://"&rs("custom_domain")&"/message."&f_ext
			end if
		else
			uf=rs("user_dir")&"/"&rs("user_folder")&"/message."&f_ext
		end if
		set rs=nothing
		if isobject(conn) then conn.close:set conn=nothing
		response.Redirect(uf)
	else
		set rs=nothing
		response.Write("无此留言")
	end if
Elseif albumid<>"" Then
	set rs=conn.execute("select user_dir,user_folder,user_domain,user_domainroot"&str_domain&" ,userid from oblog_user where userid="&Int(albumid))
	if not rs.eof then
		if true_domain=1 then
			if rs("custom_domain")="" or isnull(rs("custom_domain")) then
				uf="http://"&rs("user_domain")&"."&rs("user_domainroot")&"/cmd." & f_ext & "?uid=" & rs("userid") & "&do=album"
			else
				uf="http://"&rs("custom_domain")&"/cmd." & f_ext & "?uid=" & rs("userid") & "&do=album"
			end if
		else
			uf=rs("user_dir")&"/"&rs("user_folder")&"/cmd." & f_ext & "?uid=" & rs("userid") & "&do=album"
		end if
		set rs=nothing
		if isobject(conn) then conn.close:set conn=nothing
		response.Redirect(uf)
	else
		set rs=nothing
		response.Write("无此用户")
	end if
'按用户名访问	
elseif user<>"" Then
	user=Replace(user,"'","")
	user=Replace(user,"%","")
	user=Replace(user," ","")
	user=Replace(user,"--","")
	If user<>"" Then
		set rs=conn.execute("Select user_dir,user_folder From oblog_user where username='" & user & "'")
		if not rs.eof then
			uf=rs(0)&"/"&rs(1)&"/index."&f_ext
			set rs=nothing
			if isobject(conn) then conn.close:set conn=nothing
			response.Redirect(uf)
		else
			set rs=nothing
			response.Write("无此用户")
		end if
	Else
		response.Write("无此用户")
	End If
elseif teamid<>"" then
'	response.Redirect(blogdir&tdir&"/"&teamid&"/index.shtml")
end if
if isobject(conn) then conn.close:set conn=nothing
%>