<!--#INCLUDE FILE="setup.asp" -->
<!--#include file="checkuser.asp"-->
<!--#INCLUDE FILE="theme.asp" -->
<!--#include file="include/ubbcode.asp"-->
<%locat="查询个人资料"
Call top(1,1)
Dim username,sql,rs

if membername="" Then
  	ErrMsg=ErrMsg+"<br>"+"<li>您还没有<a href=login.asp>登录</a>，只有登陆用户才有权查看用户资料！"
	Call Error("Information",ErrMsg)
Else
	Call main()
End if

Set rs=Nothing

Sub main()
Dim tmpsql,tmprs,bisShowDetail

username=replace(trim(Request("name")),"'","")

if username="" or len(username)>12 Then
   	ErrMsg=Errmsg+"<br>"+"<li>没有操作请求，你试图进行非法操作！"
	founderr=true
End if

if founderr Then 
	Call Error("Critical",ErrMsg)
	Exit Sub
End if

sql="Select * from student where userid='"&UserName&"'"
Set rs=Conn.Execute(sql)
if rs.eof and rs.bof Then
	ErrMsg=Errmsg+"<br>"+"<li>您查询的名字不存在"
	founderr=True
End if

if founderr Then 
	Call Error("Critical",ErrMsg)
	Exit Sub
End if


if sysadmin Then
	bisShowDetail=True
Else
	tmpsql="Select classid from joinclass where userid='"&username&"' and classid in (Select classid from joinclass where userid='"&membername&"' and isauditing=False)"

	Set tmprs=Conn.Execute(tmpsql)
	if not tmprs.eof and Request("action")="showdetail" Then
			bisShowDetail=True
	End if
End if

Set tmprs=Nothing

if bisShowDetail=True Then
	Call showdetail()
Else
	Call showmain()
End if

End Sub



Sub showmain()
%><BR><BR>
     
<table cellpadding=5 cellspacing=1 border=0 width=100% Class=TableBorder>
<tr> 
<th align=center height=22 colspan="2"><b>[<%=htmlencode(username)%>]的个人资料</b>(登陆同学录<font color=#cc0000><%=rs("visitcount")%></font>次)</th>

<tr Class=LightTableBody> 
<td width="30%" align="right" height="22">性别：</td>
<td width="70%" height="22"><%if rs("sex")=True Then   
    Response.write("青春女孩")
Else   
   Response.write("阳光男孩")   
End if   
%></td>
</tr>
<tr Class=LightTableBody> 
<td width="30%" align="right" height="22">目前积分：</td>
<td width="70%" height="22"><%=rs("point")%></td>
</tr>
<tr Class=LightTableBody> 
<td width="30%" align="right" height="22">E_Mail：</td>
<td width="70%" height="22"> 
<%if not sysadmin and rs("isemailshow")=False Then
Response.write "保密"
Else
Response.write "<a href=""mailto:"&rs("email")&""">"&htmlencode(rs("email"))&"</a>"
End if%>
</td>
</tr>
<tr Class=LightTableBody> 
<td width="30%" align="right" height="22">OICQ：</td>
<td width="70%" height="22"> 
<%if not sysadmin and rs("isoicqshow")=False Then
Response.write "保密"
ElseIf rs("oicq")<>"" Then
Response.write rs("oicq")
End if%>
</td>
</tr>
<tr Class=LightTableBody> 
<td width="30%" align="right" height="22">主 页：</td>
<td width="70%" height="22"> 
<%if not sysadmin and rs("ishomepageshow")=False Then
Response.write "保密"
ElseIf rs("homepage")<>"" and rs("homepage")<>"http://" Then
Response.write "<a href="""&rs("homepage")&""" target=_blank>"&htmlencode(rs("homepage"))&"</a>" 
End if%>
</td>
</tr>
<tr Class=LightTableBody> 
<td width="30%" align="right" height="22">MSN：</td>
<td width="70%" height="22"> 
<%if not sysadmin and rs("ismsnshow")=False Then
Response.write "保密"
ElseIf rs("msn")<>"" Then
Response.write htmlencode(rs("msn"))
End if%>
</td>
</tr>

<tr Class=LightTableBody> 
<td width="30%" align="right" height="22">人生格言：</td>
<td width="70%" height="22"> 
<%if rs("maxim")<>"" Then%>
<%=ubbcode(rs("maxim"))%> 
<%End if%>
</td>
</tr>
<tr Class=LightTableBody> 
<td width="30%" align="right" height="22">所在班级：</font></td>
<td width="70%" height="22"><%Call classlist(username)%></td>
</tr>
<tr Class=LightTableBody> 
<td width="30%" align="right" height="22">最后登陆时间：</font></td>
<td width="70%" height="22"><%=rs("lastlogin")%></td>
</tr>
<tr Class=DarkTableBody> 
<td align=center height=22 colspan="2"> <b><a href="usersms.asp?action=new&touser=<%=username%>">给他留言</a>&nbsp;|<a href="Friendlist.asp?Action=addF&myFriend=<%=username%>">&nbsp;加为好友</a></b></td>
</tr>
</table>
<%
End Sub


Sub showdetail()
%><BR><BR>
    <table cellpadding=0 cellspacing=0 border=0 width=700 Class=TableBorder align=center>
        <tr>
            <td>
                
<table cellpadding=5 cellspacing=1 border=0 width=100%>
  <tr>
    <th width="100%" colspan="5">
      <p align="center"><b>[<%=rs("realname")%>]的详细个人资料</b></th>
  </tr>
  <tr>
    <td width="48%" colspan="2" bgcolor="#ffffff">
      <p align="left">&nbsp;<img src=images/2.gif>:::<B>基本资料</B>:::</td>
    <td width="4%" rowspan="15" Class=DarkTableBody>　</td>
    <td width="48%" colspan="2" bgcolor="#ffffff">
      <p align="left">&nbsp;<IMG SRC="IMAGES/2.gif" WIDTH="60" HEIGHT="9" BORDER=0 ALT="">:::<b>联系方法</b>:::</td>
  </tr>
  <tr>
    <td width="16%" align="right" Class=LightTableBody>用户名：</td>
    <td width="32%" Class=LightTableBody><%=htmlencode(username)%></td>
    <td width="12%" nowrap align="right" Class=LightTableBody>Email：</td>
    <td width="32%" Class=LightTableBody>
<a href="mailto:<%=rs("email")%>"><%=htmlencode(rs("email"))%></a> 
	　</td>

  </tr>
  <tr>
    <td width="16%" align="right" Class=DarkTableBody>性别：</td>
    <td width="32%" Class=DarkTableBody>
<%if rs("sex")=True Then   
    Response.write("青春女孩")
Else   
   Response.write("阳光男孩")   
End if   
%>
	　</td>
	    <td width="12%" align="right" Class=DarkTableBody>QQ：</td>
    <td width="32%" Class=DarkTableBody>
<%if rs("oicq")<>"" Then%>
<%=rs("oicq")%> 
<%End if%>
	</td>

  </tr>
  <tr>
    <td width="16%" align="right" Class=LightTableBody>生日：</td>
    <td width="32%" Class=LightTableBody><%=rs("birthday")%>　</td>
     <td width="12%" align="right" Class=LightTableBody>MSN：</td>
    <td width="32%" Class=LightTableBody><%=htmlencode(rs("msn"))%></td>
 </tr>
  <tr>
    <td width="16%" align="right" Class=DarkTableBody>星座：</td>
    <td width="32%" Class=DarkTableBody><%Response.write constellation(rs("birthday"),true)%></td>
      <td width="12%" align="right" Class=DarkTableBody>电话：</td>
    <td width="32%" Class=DarkTableBody><%=rs("telephone")%>　</td>
</tr>
  <tr>
    <td width="16%" nowrap align="right" Class=LightTableBody>个人主页：</td>
    <td width="32%" nowrap Class=LightTableBody>
<%if rs("homepage")<>"" Then%>
<a href="<%=rs("homepage")%>"
    target="_blank"><%=htmlencode(rs("homepage"))%></a> 
<%End if%>
	</td>
      <td width="12%" align="right" Class=LightTableBody>手机：</td>
    <td width="32%" Class=LightTableBody><%=rs("mobilephone")%>　</td>

  </tr>
  <tr>
    <td width="48%" colspan="2" bgcolor="#ffffff">
      <p align="left">&nbsp;<IMG SRC="IMAGES/2.gif" WIDTH="60" HEIGHT="9" BORDER=0 ALT="">:::<b>活动情况</b>:::</td>
    <td width="12%" align="right" Class=DarkTableBody>邮编：</td>
    <td width="32%" Class=DarkTableBody><%=rs("zipcode")%>　</td>
  </tr>
  <tr>
    <td width="16%" align="right" Class=LightTableBody>目前积分：</td>
    <td width="32%" Class=LightTableBody><%=rs("point")%></td>
    <td width="12%" align="right"  Class=LightTableBody>通讯地址：</td>
    <td width="32%" Class=LightTableBody>
<%=htmlencode(rs("address"))%></a> 

	　</td>

  </tr>
  <tr>
    <td width="16%" align="right" Class=DarkTableBody>当前状态：</td>
    <td width="32%" Class=DarkTableBody><%'
	
	Set ors=Conn.Execute("Select logintime from online where userid='"&username&"'")
	if ors.eof and ors.bof Then
	Response.write "离线"
	Else
	onlinetime=datediff("n",ors(0),now())
	if onlinetime=0 Then onlinetime=datediff("s",ors(0),now())&"秒"	Else onlinetime=onlinetime&"分钟"
	Response.write "在线["&onlinetime&"]"
	End if
		%>　</td>
<td width="12%" nowrap align="right"  Class=DarkTableBody>工作单位：</td>
    <td width="32%" Class=DarkTableBody>
<%=htmlencode(rs("workshop"))%></a> 

	　</td>
  </tr>
  <tr>
    <td width="16%" align="right" Class=LightTableBody>所在班级：</td>
    <td width="32%" Class=LightTableBody><%Call classlist(username)%></td>
	<td width="48%" colspan="2" bgcolor=#ffffff>
      <p align="left">&nbsp;<IMG SRC="IMAGES/2.gif" WIDTH="60" HEIGHT="9" BORDER=0 ALT="">:::<b>个人说明</b>:::</td>

  </tr>
  <tr>
    <td width="16%" align="right" Class=DarkTableBody>登陆次数：</td>
    <td width="32%" Class=DarkTableBody><%=rs("visitcount")%>次</td>
	    <td width="16%" rowspan="3" valign="top" Class=DarkTableBody>
      <p align="center">肖像：
<%if rs("imageid")<>0 Then%>
<img src="face/image<%=rs("imageid")%>.gif">
<%End if%>
</td>
    <td width="32%" rowspan="3" valign="top" Class=DarkTableBody>
人生格言：<BR>
<%if rs("maxim")<>"" Then%>
<%=ubbcode(rs("maxim"))%> 
<%End if%></td>

  </tr>
  <tr>
    <td width="16%" align="right" Class=LightTableBody>注册日期：</td>
    <td width="32%" Class=LightTableBody><%=rs("regdate")%></td>
  </tr>
  <tr>
    <td width="16%" align="right" Class=DarkTableBody>最后登陆：</td>
    <td width="32%" Class=DarkTableBody><%=rs("lastlogin")%></td>
  </tr>
  <tr>
    <td width="100%" colspan="5" bgcolor="#ffffff">
      <p align="center"><b>:::相关操作:::&nbsp;&nbsp;{&nbsp;</b><a href="UserSMS.asp?Action=new&touser=<%=username%>"><img src=images/message1.gif border=0 hspace=1>发送讯息</a>&nbsp;&nbsp;<a href="Friendlist.asp?Action=addF&myFriend=<%=username%>" target=_blank><img src=images/add.gif border=0 hspace=1>加为好友</a><b>&nbsp;}</b></td>
  </tr>
</table>
</td></tr></table>

<%
End Sub

Sub classlist(byval username) 
	tmpsql="Select C.classid,C.classname from class C inner join joinclass J on C.classid=J.classid "&_
	"where J.userid='"&username&"' and J.isauditing=False order by C.classname"
	Set tmprs=Conn.Execute(tmpsql)
	if tmprs.eof Then
		Response.write "尚未加入任何班级"
	Else
		Response.write "<select name=classlist onchange=""if(this.selectedIndex!=0&&this.selectedIndex!=1)"&_
				"{window.open('BrowseClass.asp?ClassID='+options[this.selectedIndex].value);this.selectedIndex=0;}"">"
		Response.write "<option value=0>浏览所注册班级</option>"
		Response.write "<option value=1>--------------</option>"
		do until tmprs.eof
			Response.write 	"<option value="&tmprs(0)&">"&htmlencode(tmprs(1))&"</option>"
			tmprs.movenext
		loop		
	End if
End Sub 


%>
<!--#include file="include/constellation.asp"-->

<%Call footer%>
