<!--#include file=conn.asp-->
<!--#include file=config.asp-->
<!--#include file=const.asp-->
<!--#include file=char.asp-->
<%
 '=========================================================
' File: userfm.asp
' Version:3.0
' Date: 2005-10-7
' Script Written by xmrxw
'=========================================================
' Copyright (C) 2004,2005 Xmrxw.Com All rights reserved.
' Web: http://www.xmrxw.com,http://www.xmzxw.com
' Email: info@mssky.com,super@mssky.com
' QQ：10689579　Msn：zdlmicr@hotmail.com
'=========================================================
response.buffer=true
stats="会员速配"
call nav()
if not founduser then
	Errmsg=Errmsg+"<br>"+"<li>您还没有登陆，不能查看速配资料。"
	founderr=true
end if

if founderr then
	call head_var("","")
	call Mslove_error()
else
	call head_var("我的速配","userfm.asp")
call tumppages()'翻页处理
strFileName="userfm.asp?action="&action&""
Select Case Trim(Request("action"))
	Case "userset"
		Stats="设置速配条件"
		Call userset()
	Case "editset"
		Stats="修改速配条件"
		Call editset()
	Case "fmsave"
		Stats="保存速配"
		Call fmsave()
	Case "editsave"
		Stats="保存修改速配"
		Call editsave()
	case else	
		call main()
End Select
if founderr then call Mslove_error()
end if
call activeonline()
call footer()

sub main()
dim fmsex,fmage,fmhg,fmadd,fmnull,Fmincome,Fmhouses,sqls,min_byear,max_byear
	Set Rs=conn.Execute("Select Fmusersex,Fmuserage,Fmheight,Fmaddress,Fmincome,Fmhouses From [Ms_userfm] Where username='"&trim(membername)&"'")
	If Not (Rs.eof or Rs.bof) then
	fmsex=rs("Fmusersex")
	fmage=rs("Fmuserage")
	fmhg=rs("Fmheight")
	fmadd=rs("Fmaddress")
	Fmincome=rs("Fmincome")
	Fmhouses=rs("Fmhouses")
	fmnull=1
	else
	fmnull=0
	end if
	rs.close

''速配条件开始
	if fmsex<>"" then
	sqls=sqls& "and UserSex="&fmsex&" "
	end if
if fmage<>"" then
      min_byear=year(date)-split(fmage,"|||")(0)
      max_byear=year(date)-split(fmage,"|||")(1)
   if min_byear<>"" and max_byear<>"" then
      sqls=sqls& "and (year(Userbirthday) between "&min_byear&" and "&max_byear&") "
   end if
end if
	if fmhg<>"" then
	sqls=sqls& "and (Userheight between "&Cint(split(fmhg,"|||")(0))&" and "&Cint(split(fmhg,"|||")(1))&") "
	end if
	if fmadd<>"" then
	sqls=sqls& "and UserInfo like '%"&fmadd&"%' "
	end if
	if Fmincome<>"" then
	sqls=sqls& "and Userfriends like '%"&Fmincome&"%' "
	end if
	if Fmhouses<>"" then
	sqls=sqls& "and Userfriends like '%"&Fmhouses&"%' "
	end if
	%>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <tr align="left"> 
    <th height="28" colspan="3" align="center"  class=tablebody1>我的速配</th>
  </tr>
  <tr align="center"> 
    <td height="31" colspan="3" align="left"  class=tablebody1>您是 
      <%if myvip>1 then
	response.Write("<font color=red>VIP会员</font>")
	else
	response.Write("普通会员")
	end if%>
      ，目前的速配条件如下： 
      <%if fmnull=1 then%> <font color="#0000FF"> 
      <%if fmsex=1 then
	  response.Write("男")
	  else
	  response.Write("女")
	  end if
	  response.Write("&nbsp;"&split(fmage,"|||")(0)&"-"&split(fmage,"|||")(1)&"岁")
	  response.Write("&nbsp;"&split(fmhg,"|||")(0)&"-"&split(fmhg,"|||")(1)&"CM")
	  response.Write("&nbsp;"&Fmincome&"元/月")
	  response.Write("&nbsp;"&Fmhouses&"")
	  response.Write("&nbsp;所在地："&split(fmadd,"|||")(0)&"&nbsp;"&split(fmadd,"|||")(1)&"")
	  %>
      </font> &nbsp;<a href=userfm.asp?action=editset>&gt;&gt;修改速配条件</a> <%else
	  response.Write("<a href=userfm.asp?action=userset>设置配置条件</a>")
	  end if%> </td>
  </tr>
  <tr align="center"> 
    <td width="17%" height="28"  class=tablebody2><strong>会员照片</strong></td>
    <td width="63%"  class=tablebody2><strong>会员基本资料</strong></td>
    <td width="20%"  class=tablebody2><strong>速配操作</strong></td>
  </tr>
  <%dim trbgcolor,fmusername
  set rs=server.createobject("adodb.recordset")
sql="select UserName,UserVip,UserSex,UserBirthday,Userfriends,UserInfo,UserPhoto,LastLogin,Userheight from Ms_user where userid>0 "&sqls&""
rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
call rspages()
do while not rs.eof and page_count<Cint(MaxPerPage)
if page_count mod 2=1 then
trbgcolor="tablebody2"
else
trbgcolor="tablebody1"
end if
fmusername=rs("Username")%>
  <tr align="center"> 
    <td height="102" align="center" class=<%=trbgcolor%>><IFrame src="visual_show2.asp?username=<%=fmusername%>&boardid=0&type=1&bgcolor=tablebody1" width="90" height="115" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="NO" allowtransparency="true"></iframe></td>
    <td align="left" class=<%=trbgcolor%>><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="50%" height="23"><b><a href=dispuser.asp?username=<%=fmusername%>><%=fmusername%></a></b>&nbsp;<%if rs("Uservip")>1 then
		 response.Write("<img src=Skins/Default/vip.gif>")
		 end if%></td>
          <td width="50%">收入：<%=split(rs("Userfriends"),"|||")(5)%> 元/月</td>
        </tr>
        <tr> 
          <td height="23">性别：<%if rs("Usersex")=1 then
		  response.Write("男")
		  else
		  response.Write("女")
		  end if%></td>
          <td>地址：<%=split(rs("UserInfo"),"|||")(4)%>&nbsp;<%=split(rs("UserInfo"),"|||")(5)%></td>
        </tr>
        <tr> 
          <td height="23">年龄：<%=datediff("yyyy",rs("Userbirthday"),Now())%> 岁</td>
          <td>住房：<%=split(rs("Userfriends"),"|||")(7)%></td>
        </tr>
        <tr> 
          <td height="23">身高：<%=rs("Userheight")%> CM</td>
          <td><font color="#FF0000">状态</font><font color="#FF0000">： 
            <%if datediff("h",rs("LastLogin"),Now())<24 then
		  response.Write("今天登录过")
		  else
		  response.Write("超过24小时未登录")
		  end if%>
            </font></td>
        </tr>
      </table></td>
    <td align="left" class=<%=trbgcolor%>><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="24%" height="20" align="center"><img src="Skins/Default/icon_001.gif" width="16" height="16"> 
          </td>
          <td width="76%" height="22"><a href="userbook.asp?action=add&classid=3&Touser=<%=fmusername%>">发送留言</a></td>
        </tr>
        <tr> 
          <td height="20" align="center"><img src="Skins/Default/icon_002.gif" width="16" height="16"> 
          </td>
          <td height="22"><a href="photolist.asp?action=userp&username=<%=fmusername%>">用户相册</a></td>
        </tr>
        <tr> 
          <td height="11" align="center"><img src="Skins/Default/icon_003.gif" width="16" height="16"> 
          </td>
          <td height="22"><a href="javascript:openScript('messanger.asp?action=new&touser=<%=htmlencode(fmusername)%>',500,400)">明送秋波</a></td>
        </tr>
        <tr> 
          <td height="11" align="center"><img src="Skins/Default/icon_005.gif" width="16" height="16"></td>
          <td height="22"><a href="friendlist.asp?action=addF&myFriend=<%=HTMLEncode(fmusername)%>">加入最爱</a></td>
        </tr>
      </table></td>
  </tr>
  <%page_count=page_count+1
	rs.movenext
	loop
	else
	response.Write("<tr align=""center""><td height=""23"" colspan=""3"" align=""center""  class=tablebody1>没有符合您的速配条件或者您没有设置配置条件！</td></tr>")
	end if
%>
  <tr align="center"> 
    <td height="23" colspan="3" align="left"  class=tablebody1><%if totalrec>0 then
		  	call showpage(strFileName)
		  end if%></td>
  </tr>
</table>
<%
rs.close
end sub

sub userset()''设置速配条件
if GroupSetting(200)=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>没有使用速配的权限，请与管理员联系。"
   	FoundErr=True
	exit sub
end if
%>
<script language="JavaScript" src="inc/Mymodify.js"></script>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
<form action="userfm.asp?action=fmsave" method=POST name="theForm">
  <tr align="left"> 
    <th height="28" colspan="2" align="center"  class=tablebody2>设置速配条件</th>
  </tr>
  <tr align="center"> 
    <td width="30%" height="11" align="right"  class=tablebody1>性　　别：</td>
    <td width="70%" align="left"  class=tablebody1><INPUT type=radio CHECKED value=1 name=Usersex> 
      <IMG  src=images/Male.gif align=absMiddle>男性 <INPUT type=radio value=0 name=Usersex> 
      <IMG  src=images/Female.gif align=absMiddle>女性</td>
  </tr>
  <tr align="center"> 
    <td height="29" align="right"  class=tablebody2>年　　龄：</td>
    <td height="29" align="left"  class=tablebody2> <select name="Minage">
        <option selected></option>
        <option value=0>0</option>
        <option value=15>15</option>
        <option value=20 >20</option>
        <option value=25>25</option>
        <option value=30>30</option>
        <option value=35>35</option>
        <option value=40>40</option>
        <option value=45>45</option>
        <option value=50>50</option>
        <option value=55>55</option>
        <option value=60>60</option>
        <option value=65>65</option>
        <option value=70>70</option>
      </select>
      - <select name="Maxage">
        <option selected></option>
        <option value=70>70</option>
        <option value=65>65</option>
        <option value=60>60</option>
        <option value=55>55</option>
        <option value=50>50</option>
        <option value=45>45</option>
        <option value=40>40</option>
        <option value=35>35</option>
        <option value=30>30</option>
        <option value=25>25</option>
        <option value=20>20</option>
        <option value=15>15</option>
        <option value=0>0</option>
      </select>
      岁</td>
  </tr>
  <tr align="center"> 
    <td height="23" align="right"  class=tablebody1>身　　高：</td>
    <td height="23" align="left"  class=tablebody1><select name=Minheight>
        <option selected></option>
        <option value=110>110</option>
        <option value=150>150</option>
        <option value=155>155</option>
        <option value=160>160</option>
        <option value=165>165</option>
        <option value=170>170</option>
        <option value=175>175</option>
        <option value=180>180</option>
        <option value=185>185</option>
        <option value=190>190</option>
        <option value=195>195</option>
        <option value=200>200</option>
      </select>
      到 
      <select name=Maxheight>
        <option selected></option>
        <option value=200>200</option>
        <option value=195>195</option>
        <option value=190>190</option>
        <option value=185>185</option>
        <option value=180>180</option>
        <option value=175>175</option>
        <option value=170>170</option>
        <option value=165>165</option>
        <option value=160>160</option>
        <option value=155>155</option>
        <option value=150>150</option>
        <option value=110>110</option>
      </select>
      CM</td>
  </tr>
  <tr align="center"> 
    <td height="11" align="right"  class=tablebody2>所在地区：</td>
    <td height="11" align="left"  class=tablebody2><input type=text name=province size=12> 
      <select name="selectp" onChange="selectcityarea('selectp','selectc','theForm');theForm.province.value=this.value;">
        <option value="0" selected>请选择..</option>
      </select></td>
  </tr>
  <tr align="center">
    <td height="11" align="right"  class=tablebody2>城　　市：</td>
    <td height="11" align="left"  class=tablebody2><input type=text name=city size=12> 
      <select name="selectc" onChange="theForm.city.value=this.value;">
        <option value="0" selected>请选择..</option>
      </select></td>
  </tr>
  <tr align="center"> 
    <td align="right"  class=tablebody1>收入水平：</td>
    <td align="left"  class=tablebody1><select name=income>
        <option value=不限制 selected>不限制</option>
        <option value=1000以下>1000以下</option>
        <option value=1000-2000>1000-2000</option>
        <option value=2000-3000>2000-3000</option>
        <option value=3000-4000>3000-4000</option>
        <option value=4000-5000>4000-5000</option>
        <option value=5000-6000>5000-6000</option>
        <option value=6000-7000>6000-7000</option>
        <option value=7000-10000>7000-10000</option>
        <option value=10000以上>10000以上</option>
      </select>
      元</td>
  </tr>
  <tr align="center"> 
    <td align="right"  class=tablebody2>住房情况：</td>
      <td align="left"  class=tablebody2> 
        <select name=houses>
          <option selected></option>
          <option value=自有房>自有房</option>
          <option value=与人合租>与人合租</option>
          <option value=独自租房>独自租房</option>
          <option value=与父母同住>与父母同住</option>
          <option value=住亲朋家>住亲朋家</option>
          <option value=住单位房>住单位房</option>
        </select></td>
  </tr>
  <tr align="center"> 
      <td height="24" colspan="2"  class=tablebody1> <input class=2 type=Submit value="设 置" name="Submit"> 
        &nbsp; <input class=2 type="reset" name="Submit2" value="清 除"></td>
  </tr>
  </form>
</table>
<%
end sub

sub fmsave()''保存速配
if Not ChkPost then'查检提交数据
	ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法，请不要从外部提交发言。"
   	FoundErr=True
	exit sub
end if
dim Minage,Maxage,Minheight,Maxheight,Userbyear,Userhei,address
Minage=trim(request("Minage"))
Maxage=trim(request("Maxage"))
Minheight=trim(request("Minheight"))
Maxheight=trim(request("Maxheight"))
   if Minage<Maxage then'判断年龄
      Userbyear=Minage&"|||"&Maxage
   else
      Userbyear=Maxage&"|||"&Minage
end if
if Minheight<Maxheight then
Userhei=Minheight&"|||"&Maxheight
else
Userhei=Maxheight&"|||"&Minheight
end if
address=request("province")&"|||"&request("city")
if Chkvalue(1,GroupSetting(201),Cint(GroupSetting(202)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的金币不够请确认。"
	founderr=true
end if
if Chkvalue(2,GroupSetting(203),Cint(GroupSetting(204)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的魅力值不够请确认。"
	founderr=true
end if
if Chkvalue(3,GroupSetting(205),Cint(GroupSetting(206)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的经验值不够请确认。"
	founderr=true
end if
if founderr=true then exit sub
set rs=server.createobject("adodb.recordset")''保存入库
sql="select * from [Ms_userfm] where Username='"&trim(membername)&"'"
rs.open sql,conn,1,3
if not (rs.eof and rs.bof) then
		errmsg=errmsg+"<br>"+"<li>对不起，数据库中已经有您的速配记录，请不要重复提交！"
		founderr=true
		exit sub
else
rs.addnew
rs("Username")=trim(MemberName)
rs("Fmusersex")=request("Usersex")
rs("Fmuserage")=Userbyear
rs("Fmheight")=Userhei
rs("Fmaddress")=address
rs("Fmincome")=request("income")
rs("Fmhouses")=request("houses")
rs.update
rs.close
sucmsg=sucmsg+"<br>"+"<li><b>恭喜您，您已成功设置速配记录。</b>"
call Mslove_suc()
end if
end sub

sub editset()''修改速配条件
dim fmsex,fmage,fmhg,fmadd,fmnull,Fmincome,Fmhouses
	Set Rs=conn.Execute("Select Fmusersex,Fmuserage,Fmheight,Fmaddress,Fmincome,Fmhouses From [Ms_userfm] Where username='"&trim(membername)&"'")
	If Not (Rs.eof or Rs.bof) then
	fmsex=rs("Fmusersex")
	fmage=rs("Fmuserage")
	fmhg=rs("Fmheight")
	fmadd=rs("Fmaddress")
	Fmincome=rs("Fmincome")
	Fmhouses=rs("Fmhouses")
	fmnull=1
	else
	fmnull=0
	end if
	rs.close
%>
<script language="JavaScript" src="inc/Mymodify.js"></script>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <form action="userfm.asp?action=editsave" method=POST name="theForm">
    <tr align="left"> 
      <th height="28" colspan="2" align="center"  class=tablebody2>设置速配条件</th>
    </tr>
    <tr align="center"> 
      <td width="30%" height="11" align="right"  class=tablebody1>性　　别：</td>
      <td width="70%" align="left"  class=tablebody1><INPUT type=radio <%if fmsex=1 then%>CHECKED<%end if%> value=1 name=Usersex> 
        <IMG  src=images/Male.gif align=absMiddle>男性 
        <INPUT type=radio value=0 name=Usersex <%if fmsex=0 then%>CHECKED<%end if%> > <IMG  src=images/Female.gif align=absMiddle>女性</td>
    </tr>
    <tr align="center"> 
      <td height="29" align="right"  class=tablebody2>年　　龄：</td>
      <td height="29" align="left"  class=tablebody2> <select name="Minage">
          <option value=<%=split(fmage,"|||")(0)%> selected><%=split(fmage,"|||")(0)%></option>
          <option value=0>0</option>
          <option value=15>15</option>
          <option value=20 >20</option>
          <option value=25>25</option>
          <option value=30>30</option>
          <option value=35>35</option>
          <option value=40>40</option>
          <option value=45>45</option>
          <option value=50>50</option>
          <option value=55>55</option>
          <option value=60>60</option>
          <option value=65>65</option>
          <option value=70>70</option>
        </select>
        - 
        <select name="Maxage">
          <option value=<%=split(fmage,"|||")(1)%> selected><%=split(fmage,"|||")(1)%></option>
          <option value=70>70</option>
          <option value=65>65</option>
          <option value=60>60</option>
          <option value=55>55</option>
          <option value=50>50</option>
          <option value=45>45</option>
          <option value=40>40</option>
          <option value=35>35</option>
          <option value=30>30</option>
          <option value=25>25</option>
          <option value=20>20</option>
          <option value=15>15</option>
          <option value=0>0</option>
        </select>
        岁</td>
    </tr>
    <tr align="center"> 
      <td height="23" align="right"  class=tablebody1>身　　高：</td>
      <td height="23" align="left"  class=tablebody1><select name=Minheight>
          <option value=<%=split(fmhg,"|||")(0)%> selected><%=split(fmhg,"|||")(0)%></option>
          <option value=110>110</option>
          <option value=150>150</option>
          <option value=155>155</option>
          <option value=160>160</option>
          <option value=165>165</option>
          <option value=170>170</option>
          <option value=175>175</option>
          <option value=180>180</option>
          <option value=185>185</option>
          <option value=190>190</option>
          <option value=195>195</option>
          <option value=200>200</option>
        </select>
        到 
        <select name=Maxheight>
          <option value=<%=split(fmhg,"|||")(1)%> selected><%=split(fmhg,"|||")(1)%></option>
          <option value=200>200</option>
          <option value=195>195</option>
          <option value=190>190</option>
          <option value=185>185</option>
          <option value=180>180</option>
          <option value=175>175</option>
          <option value=170>170</option>
          <option value=165>165</option>
          <option value=160>160</option>
          <option value=155>155</option>
          <option value=150>150</option>
          <option value=110>110</option>
        </select>
        CM</td>
    </tr>
    <tr align="center"> 
      <td height="11" align="right"  class=tablebody2>所在地区：</td>
      <td height="11" align="left"  class=tablebody2><input type=text name=province size=12 value=<%=split(fmadd,"|||")(0)%>> 
        <select name="selectp" onChange="selectcityarea('selectp','selectc','theForm');theForm.province.value=this.value;">
          <option value="0" selected>请选择..</option>
        </select></td>
    </tr>
    <tr align="center"> 
      <td height="11" align="right"  class=tablebody2>城　　市：</td>
      <td height="11" align="left"  class=tablebody2><input type=text name=city size=12 value=<%=split(fmadd,"|||")(1)%>> 
        <select name="selectc" onChange="theForm.city.value=this.value;">
          <option value="0" selected>请选择..</option>
        </select></td>
    </tr>
    <tr align="center"> 
      <td align="right"  class=tablebody1>收入水平：</td>
      <td align="left"  class=tablebody1><select name=income>
	  <option value=<%=Fmincome%> selected><%=Fmincome%></option>
          <option value=不限制>不限制</option>
          <option value=1000以下>1000以下</option>
          <option value=1000-2000>1000-2000</option>
          <option value=2000-3000>2000-3000</option>
          <option value=3000-4000>3000-4000</option>
          <option value=4000-5000>4000-5000</option>
          <option value=5000-6000>5000-6000</option>
          <option value=6000-7000>6000-7000</option>
          <option value=7000-10000>7000-10000</option>
          <option value=10000以上>10000以上</option>
        </select>
        元</td>
    </tr>
    <tr align="center"> 
      <td align="right"  class=tablebody2>住房情况：</td>
      <td align="left"  class=tablebody2> <select name=houses>
          <option value=<%=Fmhouses%> selected><%=Fmhouses%></option>
          <option value=自有房>自有房</option>
          <option value=与人合租>与人合租</option>
          <option value=独自租房>独自租房</option>
          <option value=与父母同住>与父母同住</option>
          <option value=住亲朋家>住亲朋家</option>
          <option value=住单位房>住单位房</option>
        </select></td>
    </tr>
    <tr align="center"> 
      <td height="24" colspan="2"  class=tablebody1> <input name="Submit" type=Submit class=2 id="Submit" value="修 改"> 
        &nbsp; <input class=2 type="reset" name="Submit22" value="清 除"></td>
    </tr>
  </form>
</table>
<%end sub

sub editsave()''保存修改速配
dim Minage,Maxage,Minheight,Maxheight,Userbyear,Userhei,address
Minage=trim(request("Minage"))
Maxage=trim(request("Maxage"))
Minheight=trim(request("Minheight"))
Maxheight=trim(request("Maxheight"))
   if Minage<Maxage then'判断年龄
      Userbyear=Minage&"|||"&Maxage
   else
      Userbyear=Maxage&"|||"&Minage
end if
if Minheight<Maxheight then
Userhei=Minheight&"|||"&Maxheight
else
Userhei=Maxheight&"|||"&Minheight
end if
address=request("province")&"|||"&request("city")
set rs=server.createobject("adodb.recordset")''保存入库
sql="select * from [Ms_userfm] where Username='"&trim(membername)&"'"
rs.open sql,conn,1,3
if not (rs.eof and rs.bof) then
rs("Fmusersex")=request("Usersex")
rs("Fmuserage")=Userbyear
rs("Fmheight")=Userhei
rs("Fmaddress")=address
rs("Fmincome")=request("income")
rs("Fmhouses")=request("houses")
rs.update
rs.close
sucmsg=sucmsg+"<br>"+"<li><b>恭喜您，您已成功修改速配记录。</b>"
call Mslove_suc()
else
errmsg=errmsg+"<br>"+"<li>对不起，数据库中没有您的速配记录！"
founderr=true
end if
end sub%>
<script>
first("selectp","selectc","theForm",0,0);
</script>
</body>
</html> 