<!--#INCLUDE FILE="conn.asp" -->
<!--#include file="Class_Checkuser.asp"-->
<!--#INCLUDE FILE="Class_Top.asp" -->
<!--#include file="inc/validate.asp"-->

<%locat="同学查询"
Call top(1,1)
if Request("action")="search" Then
	Call find()
Else	
	Call inputname()
End if

Sub find()
dim realname

	realname=trim(Request.form("realname")) 

	if realname="" Then
		Errmsg=Errmsg+"<br>"+"<li>请输入了校友真实姓名。"
		founderr=True
	ElseIf not isChinese(realname) Then
		Errmsg=Errmsg+"<br>"+"<li>您的输入有误，姓名必须是汉字！"
		founderr=True
	End if

	if founderr=True Then
		Call Error("Information",Errmsg)
		Exit Sub
	End if

%>
<br>
<!--#INCLUDE FILE="inc/popup.inc" -->
    <table width=100% Class=TableBorder  cellspacing=0 border=0  align=center>
    	<tr>
	        <td>
        	
<table cellpadding=6 cellspacing=1 border=0 width=100% Class=TableBorder>
<tr Class=LightTableBody> 
<td colspan=6 valign=top align=left>&nbsp;<img src=images/find.gif>
<font face=宋体>同学<font color=brown><b><%=htmlencode(realname)%></b></font>查询结果：</td>
</tr>
<tr> 
<th width="24%" align=center>用户名</th>
<th width="30%" align=center>所在学校</th>
<th width="12%" align=center>QQ</th>
<th width="12%" align=center>主页</th>
<th width="12%" align=center>Email</th>
<th width="10%" align=center>短信息</th>
</tr>
<%
realname=replace(realname,"'","")
if not sysadmin and BoolVar(9) then
	sql="Select userid,realname,oicq,isoicqshow,homepage,ishomepageshow,email,isemailshow from student where realname like '%"&realname&"%' and locked<2"
else
	sql="Select userid,realname,oicq,isoicqshow,homepage,ishomepageshow,email,isemailshow from student where realname like '%"&realname&"%'"
end if

Set rs=conn.execute(sql)
if rs.eof Then
%>
<TR  Class=DarkTableBody>
	<TD colspan=6>对不起，没有您要找的同学:(</TD>
</TR>

<%Else%>
<script language="JavaScript" src="inc/jsfun.js"></script>
<%
do until rs.eof
name=htmlencode(rs(0))
%>
<tr Class=DarkTableBody>
<td nowrap>&nbsp;&nbsp;<a href="Class_Userinfo.asp?name=<%=name%>"  target=_blank  onmouseout="kill()" onMouseOver="popup('查看 <%=name%> 的个人信息','<%=LightTBColor%>')"><%=name%>（<%=rs(1)%>）</a></td>
<td nowrap>&nbsp;&nbsp;<%Call classlist(name)%></td>
<td align=center>
<%if rs(2)="" or isnull(rs(2)) Then
Response.Write "-"
ElseIf rs(3)=0 Then
Response.Write "<img src=images/passwd.gif onmouseout=kill() onmouseover=popup('我的QQ保密哦','"&LightTBColor&"')>"
Else
%>
<a href=http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<%=rs(2)%> target=_blank onMouseOut="kill()" onMouseOver="popup('查看<%=name%>的QQ[<%=rs(2)%>]资料','<%=LightTBColor%>')"><img src="images/oicq.gif" border=0 width=16 height=16 hspace=1></a>
<%End if%></td>
<td align=center>
<%if rs(4)="" or rs(4)="http://" or isnull(rs(4)) Then
Response.Write "-"
ElseIf rs(5)=0 Then
Response.Write "<img src=images/passwd.gif onmouseout=kill() onmouseover=popup('我的主页保密哦','"&LightTBColor&"')>"
Else
%>
<a href=<%=htmlencode(rs(4))%> target=_blank  onmouseout="kill()" onMouseOver="popup('访问<%=name%>的主页','<%=LightTBColor%>')"><img border=0 src=images/homepage.gif></a>
<%End if%></td>
<td align=center><%if rs(7)=0 Then 
Response.Write "<img src=images/passwd.gif onmouseout=kill() onmouseover=popup('我的Email保密哦','"&LightTBColor&"')>"
Else%>
<a href="mailto:<%=htmlencode(rs(6))%>" onMouseOut="kill()"  onmouseover="popup('给<%=name%>发电子邮件','<%=LightTBColor%>')"><img border=0 src=images/email1.gif hspace=1></a>
<%End if%></td>
<td align=center><a href="Class_UserSms.asp?action=new&touser=<%=htmlencode(rs(0))%>" target=_blank onMouseOut="kill()" onMouseOver="popup('给<%=name%>发短消息','<%=LightTBColor%>')"><img border=0 src=images/message.gif hspace=1></a></td>
</tr>
<%
rs.movenext
loop
	End if
	set rs=nothing
%>
</table></td></tr></table><BR>
<%
End Sub

Sub inputname()
%>
<br><br><form action="Class_Search.asp" method="post"> 
<input type=hidden name=action value=search>
<table cellpadding=0 cellspacing=0 border=0 width=750 Class=TableBorder align=center>
    <tr>    
        <td>
        <table cellpadding=6 cellspacing=1 border=0 width=100%>
    <tr>
    <td valign=middle colspan=2 align=center Class=DarkTableBody>
	<IMG SRC="images/find_c.gif" WIDTH="148" HEIGHT="33" BORDER=0 ALT="">
	</td></tr>
    <tr Class=LightTableBody>
    <td align=center>真实姓名：
      <INPUT name=realname type=text> &nbsp; </td></tr>
    <tr>
    <td Class=DarkTableBody valign=middle colspan=2 align=center><input type=submit name="submit" value="查询"></td></tr></table></td></tr></table>
</form>
<%

End Sub


Sub classlist(byval username) 
   	Set tmprs=conn.execute("Select classid,classname from class where classid "&_
	"in (Select classid from joinclass where userid='"&username&"' and isauditing=0)")
	if tmprs.eof Then
		Response.Write "尚未加入任何学校"
	Else
		Response.Write "<Select name=classlist onchange=""if(this.selectedIndex!=0&&this.selectedIndex!=1)"&_
				"{window.open('Class_index.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 



%>
<%Call footer%>
