<%
session("sql")=""
if Request("flag")=1 then
user_name=Request("user_name")

session("sql")="select * from user where user_name='"&user_name&"'"
elseif Request("flag")=2 then
	nickname=Request("nickname")
	session("sql")="select * from user where nickname='"&nickname&"'"
	session("sql")=session("sql")&" ORDER BY user.weight DESC , user.photo DESC"
elseif Request("flag")=3 then
sql="select user.* from [user],user_info where user.user_name=user_info.user_name"
	graduated_school=Request("graduated_school")
	school_date=Request("school_date")
	if graduated_school<>"" then
		sql=sql&" and user_info.graduated_school like '%"&trim(graduated_school)&"%'"
	end if
	if school_date<>"0" then
		sql=sql&" and user_info.school_date like '"&school_date&"'"
	end if
	session("sql")=sql
	session("sql")=session("sql")&" ORDER BY user.weight DESC , user.photo DESC"
elseif Request("flag")=4 then
	session("sql")="select a.* from user a,user b where a.byear=b.byear and a.bmonth=b.bmonth and a.bday=b.bday and a.user_name<>b.user_name and b.user_name='"&Session("Current_user")&"'"
	session("sql")=session("sql")&" ORDER BY a.weight DESC , a.photo DESC"
elseif Request("flag")=5 then
	
	session("sql")="select a.* from user a,user b where a.constellation=b.constellation and a.user_name<>b.user_name and  b.user_name='"&Session("Current_user")&"'"
	session("sql")=session("sql")&" ORDER BY a.weight DESC , a.photo DESC"
elseif Request("flag")=6 then
	'sql="select a.* from user a,user b where  a.work_province=b.work_province and a.work_city=b.work_city and a.user_name<>b.user_name and  b.user_name='"&Session("Current_user")&"'"	
	sql="select * from user where user_name like '%'"
	if Request("age_s")<>"" and Request("age_e")<>"" then
		if Request("age_s")<Request("age_e") then
		min_byear=year(date)-Request("age_e")
		max_byear=year(date)-Request("age_s")
		else
		min_byear=year(date)-Request("age_s")
		max_byear=year(date)-Request("age_e")
		end if
		sql=sql&" and byear>'"&min_byear&"'"
		sql=sql&" and byear<'"&max_byear&"'"
	end if	
	if Request("sex")<>"0" then
	sql=sql&" and sex='"&Request("sex")&"'"
	end if
	if Request("work_province")<>"0" then
	sql=sql&" and work_province='"&Request("work_province")&"'"
	end if
	if Request("work_city")<>"" then
	sql=sql&" and work_city='"&Request("work_city")&"'"
	end if
	session("sql")=sql
	session("sql")=session("sql")&" ORDER BY weight DESC , photo DESC"	
end if




Response.Redirect "show_search.asp?move=1"

%>
<p><%=session("sql")%></p>
<p><%=Request("flag")%></p>