<!-- #Include File="Con_User.asp" -->
<!-- #Include File="../Include/Cls_UbbCode.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================
dim username,userid,userviewsql,tmp12,tmp22
username=trim(request.querystring("username"))
userid=trim(request.querystring("userid"))
if login_username=username or login_id=userid then
  call format_redirect("Index.asp")
End If
if username<>"" or userid="" then
	if not ChkName(username) then
  		call format_redirect("Index.asp")
	End If
  	userviewsql = "username='"&username&"'"
	sql="Select * From AsaiMHUserData where "&userviewsql&""
	set rs=cls.exec(sql,1)
	if rs.eof then
		Call Cls.Out_Msg("没有找到该用户名资料！\n\n点击关闭窗口……","javascript:window.close()")
		call format_redirect("Index.asp")
		response.End()
	end if
	rs.close 
Else
	if not Chkid(userid) then
  		call format_redirect("Index.asp")
	End If
	userviewsql = "id="&userid&""
	sql="Select * From AsaiMHUserData where "&userviewsql&""
	set rs=cls.exec(sql,1)
	if rs.eof then
		Call Cls.Out_Msg("没有找到该用户ID资料！\n\n点击关闭窗口……","javascript:window.close()")
		call format_redirect("Index.asp")
		response.End()
	end if
	rs.close 
End If
tit="浏览用户信息"

call DoWebHead(2,0)
'----------------------------左边 开始----------------------------
'----------------------------左边 结束----------------------------
'----------------------------中间 开始----------------------------
call user_view()
'----------------------------中间 结束----------------------------
call DoWebEnd()

sub user_view()
dim power,face,face_w,face_h,sex,nname,bbs_counter,tim,integral,emoney,whe,birthday,onlinetime,qq,email,msn,phone,address,remark,url,logininfo,user_power,last_tim,isopeninfo,strength,expression,Medal,Allemoney,Dayemoney,bbs_today_counter,bbs_del,bbs_isgood,ok_counter,ok_helpnum,ok_reply,onlinenum,online_num,user_id
if username<>""  then
  sql="select top 1 l_where from AsaiMHUserLogin where l_username='"&username&"'"
Else
  sql="select top 1 username from AsaiMHUserdata where id="&userid&"" 
  set rs=Cls.exec(sql,1)
	username=rs("username")
  rs.close
  sql="select top 1 l_where from AsaiMHUserLogin where l_username='"&username&"'"
End If
  set rs=Cls.exec(sql,1)
  if rs.eof then
    logininfo="<font class=Gys>该用户现在没有登陆，处于离线状态</font>"
  else
    logininfo="<font class=blue>当前位置："&rs(0)&"</font>"
  End If
  rs.close
sql="select top 1 onlinetime from AsaiMHUserdata where "&userviewsql&"" 
  set rs=Cls.exec(sql,1) 
  if not rs.eof then onlinenum=rs("onlinetime") 
  rs.close
sql="select count(id) from AsaiMHUserdata where onlinetime>"&onlinenum 
  set rs=Cls.exec(sql,1) 
  if not rs.eof then online_num=rs(0)+1 
  rs.close 
sql="select count(*) from AsaiMHBbsTopic where "&userviewsql&" and isgood>=1" 
  set rs=Cls.exec(sql,1) 
  bbs_isgood=rs(0) 
  rs.close
sql="Select * From AsaiMHNotes where "&userviewsql&" and year(tim)='"&year(DATEADD("D",0,date))&"' and month(tim)='"&month(DATEADD("D",0,date))&"' and day(tim)='"&day(DATEADD("D",0,date))&"'" 
  'set rs=Cls.exec(sql,1)
  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 "&userviewsql&"" 
  'set rs=Cls.exec(sql,1)
  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 '"&username&"','"&formatdatetime(formatdatetime(Cls.now_time,2))&"'"	
  Else
    sql="select count(*) from AsaiMHBbsData where "&userviewsql&" 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 "&userviewsql&""
  set rs=Cls.exec(sql,1)
  if rs.eof then
    rs.close
    call format_redirect("Index.asp")
  End If
  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
  user_id=rs("id")
  nname=rs("nname")
  Medal=rs("Medal")
  Dim tmp_usermedalgrade
    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
  isopeninfo=rs("isopen")
  qq=rs("qq")
  msn=Cls.code_html(rs("msn"),1,0)
  url=Cls.code_html(rs("url"),1,0)
  phone=Cls.code_html(rs("phone"),1,0)
  address=Cls.code_html(rs("address"),1,0)
  email=Cls.code_html(rs("email"),1,0)
  bbs_counter=rs("bbs_counter")
  bbs_del=rs("bbs_del")
  integral=rs("integral")
  emoney=rs("emoney")
  birthday=rs("birthday")
  last_tim=rs("last_tim")
  user_power=rs("power")
  strength=rs("strength")
  expression=rs("expression")
  ok_counter=rs("ok_counter")
  ok_helpnum=rs("ok_helpnum")
  ok_reply=rs("ok_reply")
	Cls.HtmlRcod "body",Cls.ReadTemplate ("user_View")
    Cls.HtmlRcod "username",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 "nname",nname
	Cls.HtmlRcod "user_power",user_power
	Cls.HtmlRcod "tim",Cls.time_type(rs("tim"),5)
	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 "last_tim",cls.time_type(rs("last_tim"),2)
	Cls.HtmlRcod "logininfo",logininfo
	Cls.HtmlRcod "birthday",Cls.time_type(rs("birthday"),5)
	Cls.HtmlRcod "onlinetime",Rank_Img(rs("onlinetime"),1)
	Cls.HtmlRcod "remark",Ubb.Ubbcode(rs("remark"))
	Cls.HtmlRcod "p45",n_isopeninfo(isopeninfo,qq,msn,url,phone,address,email)
	Cls.HtmlRcod "Bbs",Bbs()
	Cls.HtmlRcod "skin_img",img_skin("h_")
	Cls.HtmlRcod "dir_skin",Cls.web_skindir
	Cls.HtmlRcod "tit",tit
	Cls.HtmlRcod "onlinenum",online_num
	Cls.HtmlRcod "ok_counter",ok_counter
	Cls.HtmlRcod "ok_reply",ok_reply
	Cls.HtmlRcod "ok_helpnum",ok_helpnum
	Cls.HtmlRcod "bbs_isgood",bbs_isgood
	Cls.HtmlRcod "bbs_today_counter",bbs_today_counter
	Cls.HtmlRcod "bbs_del",bbs_del
	Cls.HtmlRcod "user_id",user_id
	Cls.HtmlRcod "user_medal",tmp_usermedalgrade
	Cls.HtmlRcod "dayemoney",Dayemoney
	Cls.HtmlRcod "allemoney",Allemoney
	Cls.OutPage
End Sub

Function n_isopeninfo(isopeninfo,qq,msn,url,phone,address,email)
dim sTmp,tmp2,tmp1
  sTmp="<tr class=tr><td class=td colspan=3>&nbsp;查看 "&username&" 的联系信息</td></tr>"
  if isopeninfo = false then tmp2="no"
  if isopeninfo = true then tmp2="yes"
  if tmp2="no" then
    sTmp=sTmp&"<tr class=tr><td s colspan=3 height=50 class=red>&nbsp;&nbsp;用户（"&username&"）没有开放详细的联系信息</td></tr>"
  else
    sTmp=sTmp&"<tr  class=tr>" & _
    vbcrlf&"<td>出生年月：</td>" & _
    vbcrlf&"<td colspan=2>"&Cls.time_type(rs("birthday"),5)&"</td>" & _
    vbcrlf&"</tr>" & _
    vbcrlf&"<tr  class=tr>" & _
    vbcrlf&"<td>用户QQ：</td>" & _
    vbcrlf&"<td colspan=2>"
    if not isnumeric(qq) or qq=0 then
      sTmp=sTmp&"<font class=Gys>没有</font>"
    else
      sTmp=sTmp&""&img_skin("qq")&"<a href='http://search.tencent.com/cgi-bin/friend/user_show_info?ln="&qq&"' target=_blank>"&qq&"</a>"
    end if
    sTmp=sTmp&"</td>" & _
    vbcrlf&"</tr>" & _
    vbcrlf&"<tr  class=tr>" & _
    vbcrlf&"<td>E-mail：</td>" & _
    vbcrlf&"<td colspan=2>"
    sTmp=sTmp&""&img_skin("email")&"<a href='mailto:"&email&"'>"&email&"</a>"
    sTmp=sTmp&"</td>" & _
    vbcrlf&"</tr>" & _
    vbcrlf&"<tr  class=tr>" & _
    vbcrlf&"<td>M S N：</td>" & _
    vbcrlf&"<td colspan=2>"
    if not isnumeric(msn) then
      sTmp=sTmp&"<font class=Gys>没有</font>"
    else
      sTmp=sTmp&""&img_skin("msn")&"<a href='mailto:"&msn&"' target=_blank>"&msn&"</a>"
    end if
    sTmp=sTmp&"</td>" & _
    vbcrlf&"</tr>" & _
    vbcrlf&"<tr  class=tr>" & _
    vbcrlf&"<td>个人主页：</td>" & _
    vbcrlf&"<td colspan=2>"&urls(url)&"</a>" & _
    vbcrlf&"</td>" & _
    vbcrlf&"</tr>" & _
    vbcrlf&"<tr  class=tr>" & _
    vbcrlf&"<td>联系电话：</td>" & _
    vbcrlf&"<td colspan=2>"
    if not isnumeric(phone) then
      sTmp=sTmp&"<font class=Gys>没有</font>"
    else
      sTmp=sTmp&""&img_skin("phone")&phone
    end if
    sTmp=sTmp&"</td>" & _
    vbcrlf&"</tr>" & _
    vbcrlf&"<tr class=tr>" & _
    vbcrlf&"<td>联系地址：</td>" & _
    vbcrlf&"<td colspan=2>"
    if not isnumeric(address) then
      sTmp=sTmp&"<font class=Gys>没有</font>"
    else
      sTmp=sTmp&address
    end if
    sTmp=sTmp&"</td>" & _
    vbcrlf&"</tr>"
  end if
  n_isopeninfo=sTmp
End Function

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='"&url&"' target=_blank>"&url&"</a>"
  End If
urls=sTmp
End Function

Function Bbs()
dim sTmp,topic
  rs.close
  sTmp="<table border=0 width='100%'>"
  sql="select top 10 id,bbs_id,topic,tim from AsaiMHBbsTopic where username='"&username&"' and bbs_id<>999999999 order by id desc"
  set rs=Cls.exec(sql,1)
  do while not rs.eof
    topic=rs("topic")
    sTmp=sTmp&"<tr><td>"&img_skin("h_")&"<a href='../Bbs/View.asp?fid="&rs("bbs_id")&"&id="&rs("id")&"' target=_blank title='"&Cls.code_html(topic,1,0)&"'>"&Cls.code_html(topic,1,30)&"</a>&nbsp;<font class=tims>"&Cls.time_type(rs("tim"),3)&"</font></td></tr>"
    rs.movenext
  loop
  rs.close
  sTmp=sTmp&"</table>"
  Bbs=sTmp
End Function
%>
