<%
	sex=Request("sex")
	'byear=Request("byear")
	'bmonth=Request("bmonth")
	'bday=Request("bday")
	martial=Request("martial")
	relation=Request("relation")
	'//////////////////////
	work_province=Request("work_province")
   work_city=Request("work_city")
   '///////////////////////
	'place=Request("place")
	'city=Request("city")
	job=Request("job")
	jobtitle=Request("jobtitle")
	'constellation=Request("constellation")
	blood=Request("blood")
	income=Request("income")
	house=Request("house")
	edu=Request("edu")
	'///////////////////////
	if Request("height_s")<>"" then
	height_s=cint(Request("height_s"))
	end if
	if Request("height_e")<>"" then
	height_e=cint(Request("height_e"))
	end if
'//////////
	if Request("weight_s")<>"" then
    weight_s=cint(Request("weight_s"))
    end if
    if Request("weight_e")<>"" then
	weight_e=cint(Request("weight_e"))
	end if
'///////////////////
    shape=Request("weight")
   smoking=Request("smoking")
   drinking=Request("drinking")
   dress=Request("dress")
'//////////////////////////
 favourite=""
   for i=1 to 24
		temp1="favor"&cstr(i)
		if  Request(cstr(temp1))=cstr(i) then
			favourite="1"&favourite
		else
			favourite="_"&favourite
		end if
   next
   '////////////
   f_sports=""
   for i=1 to 23
		temp1="sport"&cstr(i)
		if  Request(cstr(temp1))=cstr(i) then
			f_sports="1"&f_sports
		else
			f_sports="_"&f_sports
		end if
   next
   '////////////
   f_music=""
   for i=1 to 8
		temp1="music"&cstr(i)
		if  Request(cstr(temp1))=cstr(i) then
			f_music="1"&f_music
		else
			f_music="_"&f_music
		end if
   next
  
   '////////////


%>


<%	
	'//////////////////////////
dim sql
'sql="select * from user where user_name like '%'"
	sql="select user.* from user,user_info where user.user_name like '%' and user.user_name=user_info.user_name"
'sql="select user.* from user inner join user_info on user.user_name=user_info.username where user.user_name like '%'"
if sex<>"0" then
	sql=sql&" and sex='"&sex&"'"
end if

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 byear<>"0" then
'	sql=sql&" and byear='"&byear&"'"
'end if
'if bmonth<>"0" then
'	sql=sql&" and bmonth='"&bmonth&"'"
'end if
'if bday<>"0" then
'	sql=sql&" and bday='"&bday&"'"
'end if
if martial<>"0" then
	sql=sql&" and married='"&martial&"'"
end if

if relation<>"0" then
	sql=sql&" and relation='"&relation&"'"
end if
'//////////////////////////
if work_province<>"0" then
	sql=sql&" and work_province='"&work_province&"'"
end if
if work_city<>"" then
	sql=sql&" and work_city='"&work_city&"'"
end if
'//////////////////////////

'if place<>"0" then
'	sql=sql&" and province='"&place&"'"
'end if
'if city<>"" then
''	sql=sql&" and city='"&city&"'"
'end if
if job<>"0" then
	sql=sql&" and vocation='"&job&"'"
end if
if jobtitle<>"0" then
	sql=sql&" and employment='"&jobtitle&"'"
end if
'if constellation<>"0" then
'	sql=sql&" and constellation='"&constellation&"'"
'end if
if blood<>"0" then
	sql=sql&" and blood='"&blood&"'"
end if
if income<>"0" then
	sql=sql&" and salary='"&income&"'"
end if
if house<>"0" then
	sql=sql&" and house='"&house&"'"
end if

if edu<>"0" then
	sql=sql&" and education='"&edu&"'"
end if
'//////////////////////////////
if Request("height_e")<>"" and Request("height_s")<>"" then
if height_s>height_e then
	
height_s=Request("height_e")
height_e=Request("height_s")
end if
sql=sql&" and height>="& height_s

sql=sql&" and height<="& height_e
end if
'////////////////
if Request("weight_e")<>"" and Request("weight_s")<>"" then
if weight_s>weight_e then
	
weight_s=Request("weight_e")
weight_e=Request("weight_s")
end if
sql=sql&" and user_info.weight>="& weight_s

sql=sql&" and user_info.weight<="& weight_e
end if

'//////////////////////
if shape<>"0" then
	sql=sql&" and shape='"&shape&"'"
end if
'if smoking<>"0" then
'	sql=sql&" and smoking='"&smoking&"'"
'end if
'if drinking<>"0" then
'	sql=sql&" and drinking='"&drinking&"'"
'end if
if dress<>"0" then
	sql=sql&" and dress_up='"&dress&"'"
end if
'///////////////////////////////////
sql=sql&" and favourite like '"&favourite&"'"
sql=sql&" and f_sports like '"&f_sports&"'"
sql=sql&" and f_music like '"&f_music&"'"

sql=sql&" ORDER BY user.weight DESC , user.photo DESC"

session("sql")=sql
Response.Redirect "show_search.asp?move=1"

%><p><%=session("sql")%></p>
<!--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&"'"-->
