<!-- #Include File="Con_User.asp" -->
<!-- #Include File="../Include/Cls_UbbCode.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

tit="用户中心（"&login_username&"）"
tit_fir=""

If action="loginipand" then 
	Call Cls.exec("update AsaiMHUserData set u_ip='"&Cls.ip_sys(0)&"' where username='"&login_username&"'",0) 
	Call format_redirect("Index.asp") 
End If 

If action="loginipdel" then 
	Call Cls.exec("update AsaiMHUserData set u_ip='' where username='"&login_username&"'",0) 
	Call format_redirect("Index.asp") 
End If

Call DoWebHead(2,0)
Call user_main()
Call DoWebEnd()

Sub user_main()
	Dim power,face,face_w,face_h,sex,nname,bbs_counter,tim,integral,emoney,whe,birthday,onlinetime,onlinenum,online_num,qq,email,msn,phone,address
	Dim remark,url,user_power,strength,expression,otim,u_ip,bbs_isgood,bbs_today_counter,bbs_del,Medal,Allemoney,Dayemoney,tmp_usermedalgrade
	Sql="select top 1 onlinetime from AsaiMHUserdata where id="&login_id 
	set rs=Cls.exec(sql,1) 
	if not rs.eof then 
	onlinetime=rs("onlinetime")  
	rs.close 
	else 
	rs.close 
	end if
	Sql="select count(id) from AsaiMHUserdata where onlinetime>"&onlinetime 
	set rs=Cls.exec(sql,1) 
	If not rs.eof then online_num=rs(0)+1 
	rs.close 
	Sql="select count(*) from AsaiMHBbsTopic where username='"&login_username&"' and isgood>=1" 
	set rs=Cls.exec(sql,1) 
	bbs_isgood=rs(0) 
	rs.close
	Sql="Select * From AsaiMHNotes where username='"&login_username&"' and year(tim)='"&year(DATEADD("D",0,date))&"' and month(tim)='"&month(DATEADD("D",0,date))&"' and day(tim)='"&day(DATEADD("D",0,date))&"'" 
	rs.open sql,conn,1,1 
	Dayemoney = 0 
	do while not rs.eof   
		Dayemoney = Dayemoney + rs("emoney") 
	rs.movenext 
	loop 
	rs.close 
	Sql="Select * From AsaiMHNotes where username='"&login_username&"'" 
	rs.open sql,conn,1,1 
	Allemoney = 0 
	do while not rs.eof   
		Allemoney = Allemoney + rs("emoney") 
	rs.movenext 
	loop 
	rs.close 
	If SqlType = 1 Then
		Sql="execute AsaiMHUserIndex '"&login_username&"','"&formatdatetime(formatdatetime(Cls.now_time,2))&"'"	
	Else
		Sql="select count(*) from AsaiMHBbsData where username='"&login_username&"' and bbs_id<>999999999 and tim>=#"&formatdatetime(formatdatetime(Cls.now_time,2))&"#"
	End If
	set rs=Cls.exec(sql,1) 
	bbs_today_counter=rs(0) 
	rs.close
	Sql="select top 1 * from AsaiMHUserData where id="&login_id
	set rs=Cls.exec(sql,1)
	sex=rs("sex")
	If sex=false then
		sex=""&img_skin("girl")&"&nbsp;"&Cls.Web_girl&""
	else
		sex=""&img_skin("boy")&"&nbsp;"&Cls.Web_Boy&""
	End If
	nname=rs("nname")
	Medal=rs("Medal")
	tmp_usermedalgrade=""
	If medal<>"" Then tmp_usermedalgrade=""&User_Medal_Grade(medal)&""
	If Cls.Is_Null(nname)="" then
		nname="<font class=Gys>没有</font>"
	else
		nname=""&Cls.code_html(nname,1,0)
	End If
	qq=rs("qq")
	If not isnumeric(qq) or qq=0 then
		qq="<font class=Gys>没有</font>"
	else
		qq=" "&img_skin("qq")&"<a href='http://"&qq&".qzone.qq.com' target=_blank>"&qq&"</a>"
	End If
	msn=Cls.code_html(rs("msn"),1,0)
	If Cls.Is_Null(msn)="" then
		msn="<font class=Gys>没有</font>"
	else
		msn=" "&img_skin("msn")&"<a href='mailto:"&msn&"' target=_blank>"&msn&"</a>"
	End If
	phone=Cls.code_html(rs("phone"),1,0)
	If Cls.Is_Null(phone)="" then
		phone="<font class=Gys>没有</font>"
	else
		phone=" "&img_skin("phone")&phone&""
	End If
	address=Cls.code_html(rs("address"),1,0)
	If Cls.Is_Null(address)="" then
		address="<font class=Gys>没有</font>"
	else
		address=address
	End If
	email=Cls.code_html(rs("email"),1,0)
	email=" "&img_skin("email")&"<a href='mailto:"&email&"'>"&email&"</a>"
	If rs("estate")=true then
		otim="<font class=blue>（过期时间： "&rs("otim")&"）</font>"
	else
		otim="&nbsp;&nbsp;[<a href='Emoney.asp?action=usercard'><font class=red>我要开通计时</font></a>]"
	End If
	If rs("u_ip")<>Cls.ip_sys(0) then   
		u_ip="<font class=red2>关闭状态</font>  [ <a href='?action=loginipand'><font class=blue>开启当前地址为限制ip</font> ]</a>" 
	else 
		u_ip="<font class=red2>开启</font>ip地址限制（<font class=red2>"&rs("u_ip")&"</font>）<a href='?action=loginipdel'><font class=blue>[取消限制]</font></a>" 
	End If
	bbs_counter=rs("bbs_counter")
	integral=rs("integral")
	emoney=rs("emoney")
	birthday=rs("birthday")
	user_power=rs("power")
	strength=rs("strength")
	expression=rs("expression")
	bbs_del=rs("bbs_del")
	Cls.HtmlRcod "body",Cls.ReadTemplate("main_user")
	Cls.HtmlRcod "login_username",login_username
	Cls.HtmlRcod "format_user_face",format_user_face(rs("face"),rs("face_w"),rs("face_h"))
	Cls.HtmlRcod "power",format_power(rs("power"),1)
	Cls.HtmlRcod "sex",sex
	Cls.HtmlRcod "otim",otim
	Cls.HtmlRcod "nname",nname
	Cls.HtmlRcod "tim",Cls.time_type(rs("tim"),2)
	Cls.HtmlRcod "bbs_counter",bbs_counter
	Cls.HtmlRcod "integral",integral
	Cls.HtmlRcod "emoney",emoney
	Cls.HtmlRcod "strength",strength
	Cls.HtmlRcod "expression",expression
	Cls.HtmlRcod "web_unit",Cls.web_unit
	Cls.HtmlRcod "whe",Cls.code_html(rs("whe"),1,0)
	Cls.HtmlRcod "birthday",Cls.time_type(rs("birthday"),5)
	Cls.HtmlRcod "onlinenum",online_num
	Cls.HtmlRcod "onlinetime",Rank_Img(rs("onlinetime"),1)
	Cls.HtmlRcod "qq",qq
	Cls.HtmlRcod "email",email
	Cls.HtmlRcod "msn",msn
	Cls.HtmlRcod "phone",phone
	Cls.HtmlRcod "address",address
	Cls.HtmlRcod "remark",Ubb.Ubbcode(rs("remark"))
	Cls.HtmlRcod "url",urls(url)
	Cls.HtmlRcod "Bbs",Bbs()
	Cls.HtmlRcod "skin_img",img_skin("h_")
	Cls.HtmlRcod "user_power",user_power
	Cls.HtmlRcod "dir_skin",Cls.web_skindir
	Cls.HtmlRcod "tit",Tit
	Cls.HtmlRcod "ok_counter",login_ok_counter
	Cls.HtmlRcod "ok_reply",login_ok_reply
	Cls.HtmlRcod "ok_helpnum",login_ok_helpnum
	Cls.HtmlRcod "u_ip",u_ip
	Cls.HtmlRcod "bbs_isgood",bbs_isgood
	Cls.HtmlRcod "bbs_today_counter",bbs_today_counter
	Cls.HtmlRcod "bbs_del",bbs_del
	Cls.HtmlRcod "user_medal",tmp_usermedalgrade
	Cls.HtmlRcod "login_id",login_id
	Cls.HtmlRcod "dayemoney",Dayemoney
	Cls.HtmlRcod "allemoney",Allemoney
	Cls.OutPage
End Sub

Function urls(url)
	dim sTmp
	url=Cls.code_html(rs("url"),1,0)
	If Cls.Is_Null(url)="" then
		sTmp="<font class=Gys>没有</font>"
	else
		dim urll
		Sql="select * from AsaiMHUserData where url like '%http://%' and username='"&login_username&"'"
		set rs=Cls.exec(sql,1)
		If rs.eof then
			urll="http://"
		else
			urll=""
		End If
		sTmp=sTmp&img_skin("url")&"<a href='"&urll&""&url&"' target=_blank>"&urll&""&url&"</a>"
	End If
	urls=sTmp
End Function

Function Bbs()
	dim sTmp,topic
	rs.close
	sTmp="<div class=dvac><div class=dvaco><ul>"
	Sql="select top 10 id,bbs_id,topic,tim from AsaiMHBbsTopic where userid="&login_id&" and bbs_id<>999999999 order by id desc"
	set rs=Cls.exec(sql,1)
	do while not rs.eof
		topic=rs("topic")
		sTmp=sTmp&"<li class=lla><span class=tims>"&Cls.time_type(rs("tim"),3)&"</span>"&img_skin("h_")&"<a href='"&Cls.Web_Dir&"Bbs/View.asp?fid="&rs("bbs_id")&"&id="&rs("id")&"' target=_blank title='"&Cls.code_html(topic,1,0)&"'>"&Cls.code_html(topic,1,100)&"</a>&nbsp;</li>"
	rs.movenext
	loop
	rs.close
	sTmp=sTmp&"</ul></div></div>"
	Bbs=sTmp
End Function
%>
