<!--#include file="bbstop.asp"-->
<%founderr=false
if membername="" then
  	errmsg=errmsg+"<br>"+"<li>您没有<a href=login.asp target=_blank>登录</a>。"
	founderr=true
else
	set rs=server.createobject("adodb.recordset")
	if request("action")="update" then
		if request("sex")="" then
			errmsg=errmsg+"<br>"+"<li>请选择您的性别。"
			founderr=true
		elseif request("sex")="女" or request("sex")="男" then
			sex=request("sex")
		else
			errmsg=errmsg+"<br>"+"<li>您输入的字符非法。"
			founderr=true
		end if
		if request("psw")="" then
		  	errmsg=errmsg+"<br>"+"<li>请输入您的密码。"
			founderr=true
		else
			password=request("psw")
		end if
		if request("myface")<>"" then
			if request("width")="" or request("height")="" then
				errmsg=errmsg+"<br>"+"<li>请输入图片的宽度和高度。"
				founderr=true
			elseif not isInteger(request("width")) or not isInteger(request("height")) then
				errmsg=errmsg+"<br>"+"<li>您输入的字符不合法。"
				founderr=true
			elseif request("width")<20 or request("width")>120 then
				errmsg=errmsg+"<br>"+"<li>您输入的图片宽度不符合标准。"
				founderr=true
			elseif request("height")<20 or request("height")>120 then
				errmsg=errmsg+"<br>"+"<li>您输入的图片高度不符合标准。"
				founderr=true
			else
				face=request("myface")
				width=request("width")
				height=request("height")
			end if
		else
			if request("face")="" then
				errmsg=errmsg+"<br>"+"<li>请选择您的个性头像。"
				founderr=true
			elseif Instr(request("face"),"faces/")>0 then
				face=request("face")
				width=100
				height=100
			else
				errmsg=errmsg+"<br>"+"<li>您选择了错误的头像。"
				founderr=true
			end if
		end if
		if IsValidEmail(request("Email"))=false then
   			errmsg=errmsg+"<br>"+"<li>您的Email有错误。"
   			founderr=true
		else
			Email=request("Email")
		end if
		if request("oicq")<>"" then
			if chkoicq(request("oicq"))=false then
			errmsg=errmsg+"<br>"+"<li>Oicq号码只能是4-10位数字，您可以选择不输入。"
			founderr=true
			end if
		end if
	else
		call userinfo()
	end if
end if
if founderr=true then
	call error()
else
	if request("action")="update" then
		if founderr=true then
		call error()
		else
		call update()
		call success()
		end if
	end if
end if
sub userinfo()
	sql="Select * from [huiyuan] where huiyuan='"&trim(membername)&"'"
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		errmsg=errmsg+"<br>"+"<li>该用户名不存在。"
		founderr=true
	else
%>
<table cellpadding=0 cellspacing=0 border=0 width=762 bgcolor=#efefef align=center class="pian">
<form name=theForm action="mymodify.asp?action=update&username=<%=htmlencode(membername)%>" method=POST>
<tr><td width="100%" align="center" height=25><font color=red>修改资料</font></td>
    </tr>
<tr><td align=center><table cellpadding=3 cellspacing=1 border=0 width=100%>
      <tr bgcolor=#ffffff> 
        <td width="296">** <font color=red>本帐号可以在会员社区、购物网站通行</font></td>
        <td width="449"> <%=htmlencode(RS("huiyuan"))%></td>   
      </tr>   
      <tr bgcolor=#ffffff>    
        <td width="296">性 别</td>   
        <td width="449"><input type="radio" value="男"<%if rs("xb")="男" then%> checked <%end if%>name="Sex">酷哥
      <input type="radio" name="Sex"<%if rs("xb")="女" then%> checked <%end if%> value="女">靓妹</td>
</td>   
      </tr>   
      <tr bgcolor=#ffffff>    
        <td width="296">密&nbsp;&nbsp;&nbsp;&nbsp;码*</td>   
        <td width="449">    
          <input type="text" name="psw" value="<%=htmlencode(RS("password"))%>" size=15 maxlength=13>   
        </td>   
      </tr>   
      <tr bgcolor=#ffffff>    
        <td width="296" align=center>*您选择的头像<br><img id=face src="<%=rs("face")%>" alt=个人形象代表></td>   
        <td width="449">    
                <select name=face size=1 onChange="document.images['face'].src=options[selectedIndex].value;">
<option value='faces/Image1.gif'>Image1</option><option value='faces/Image2.gif'>Image2</option>
<option value='faces/Image3.gif'>Image3</option><option value='faces/Image3.gif'>Image3</option>
<option value='faces/Image4.gif'>Image4</option><option value='faces/Image5.gif'>Image5</option>
<option value='faces/Image6.gif'>Image6</option><option value='faces/Image7.gif'>Image7</option>
<option value='faces/Image8.gif'>Image8</option><option value='faces/Image9.gif'>Image9</option>
<option value='faces/Image10.gif'>Image10</option><option value='faces/Image11.gif'>Image11</option>
<option value='faces/Image12.gif'>Image12</option><option value='faces/Image13.gif'>Image13</option>
<option value='faces/Image14.gif'>Image14</option><option value='faces/Image15.gif'>Image15</option>
<option value='faces/Image16.gif'>Image16</option><option value='faces/Image17.gif'>Image17</option>
<option value='faces/Image18.gif'>Image18</option><option value='faces/Image19.gif'>Image19</option>
<option value='faces/Image20.gif'>Image20</option><option value='faces/Image21.gif'>Image21</option>
<option value='faces/Image22.gif'>Image22</option><option value='faces/Image23.gif'>Image23</option>
<option value='faces/Image24.gif'>Image24</option><option value='faces/Image25.gif'>Image25</option>
<option value='faces/Image26.gif'>Image26</option><option value='faces/Image27.gif'>Image27</option>
<option value='faces/Image28.gif'>Image28</option><option value='faces/Image29.gif'>Image29</option>
<option value='faces/Image30.gif'>Image30</option><option value='faces/Image31.gif'>Image31</option>
<option value='faces/Image32.gif'>Image32</option><option value='faces/Image33.gif'>Image33</option>
<option value='faces/Image34.gif'>Image34</option><option value='faces/Image35.gif'>Image35</option>
<option value='faces/Image36.gif'>Image36</option><option value='faces/Image37.gif'>Image37</option>
<option value='faces/Image38.gif'>Image38</option><option value='faces/Image39.gif'>Image39</option>
<option value='faces/Image40.gif'>Image40</option><option value='faces/Image41.gif'>Image41</option>
<option value='faces/Image42.gif'>Image42</option><option value='faces/Image43.gif'>Image43</option>
<option value='faces/Image44.gif'>Image44</option><option value='faces/Image45.gif'>Image45</option>
<option value='faces/Image46.gif'>Image46</option><option value='faces/Image47.gif'>Image47</option>
<option value='faces/Image48.gif'>Image48</option>
                </select>  <font color=red>如选择论坛自有图像，请将下面的图片名称清空！</font>
        </td>   
      <TR bgcolor=#ffffff>
    <TD width="296" rowspan="3" valign=middle align=center>上传头像（图片不得大于<font color=#FF0000>30K</font>，高度宽度最大120像素）<br> 
      <font color=#0066FF">请务必输入您上传的头像的宽度和高度！</font><br>
      否则缺省都为100像素！<br></TD>
    <TD>图像位置：
      <input type="TEXT" name="myface" id="myface" value=<%=rs("face")%> size=40 maxlength=100></TD>
  </TR>
  <TR bgcolor=#ffffff>
    <TD><iframe name="ad" frameborder=0 width=100% height=20 scrolling=no src=upface.asp></iframe></TD>
  </TR>
  <TR bgcolor=#ffffff>
    <TD>	  宽&nbsp;&nbsp;&nbsp;&nbsp;度：<input type="TEXT" name="width" value=<%=rs("width")%> size=5 maxlength=3>20---120的整数<br>
	  高&nbsp;&nbsp;&nbsp;&nbsp;度：<input type="TEXT" name="height" size=5 value=<%=rs("height")%> maxlength=3>20---120的整数
    </TD></TR>
      <tr bgcolor=#ffffff>    
        <td width="296">Email地址*</td>   
        <td width="449">    
          <input type="TEXT" name="Email" size=30 maxlength=50 value="<%if trim(rs("mail"))<>"" then%><%=htmlencode(rs("mail"))%><%end if%>">   
        </td>   
      </tr>   
      <tr bgcolor=#ffffff>    
        <td width="296">主 页</td>   
        <td width="449">    
          <input type="TEXT" name="URL" value="<%if trim(rs("homepage"))<>"" then%><%=htmlencode(rs("homepage"))%><%end if%>" size=30 maxlength=100>   
        </td>   
      </tr>   
      <tr bgcolor=#ffffff>    
        <td width="296">OICQ号码</td>   
        <td width="449">    
          <input type="TEXT" name="OICQ" value="<%if rs("oicq")<>"" then%><%=htmlencode(rs("oicq"))%><%end if%>" size=30 maxlength=20>   
        </td>   
      </tr>   
      <tr bgcolor=#ffffff>    
        <td valign=top width="296">签&nbsp;&nbsp;&nbsp;&nbsp;名<br>   
          <br>   
          文字将出现在您发表的文章的结尾处。</td>   
        <td width="449">    
          <textarea name="Signature" rows=3 cols=25 wrap=PHYSICAL><%if rs("sign")<>"" then%>
<%
dim signtrue
signtrue=replace(rs("sign"),"<BR>",chr(13))
signtrue=replace(signtrue,"&nbsp;"," ")
%><%=signtrue%><%end if%></textarea>   
        </td>   
      </tr> 
    <tr align="center"> 
      <td colspan="2" width="100%">
            <input type=Submit value="更 新" name=Submit"> &nbsp; <input type="reset" name="Clear" value="清 除">
      </td>
    </tr>  
</table></td></tr></form></table> 
<%
	end if
	rs.close
end sub

sub update()
	sql="Select * from [huiyuan] where huiyuan='"&trim(membername)&"'"
	rs.open sql,conn,1,3
	if rs.eof and rs.bof then
		errmsg=errmsg+"<br>"+"<li>该用户名不存在。"
		founderr=true
	else
		rs("mail")=email
		rs("homepage")=request("url")
		rs("face")=face
		rs("width")=width
		rs("height")=height
		rs("xb")=sex
		rs("sign")=trim(request("Signature"))
		rs("oicq")=request("oicq")
		rs("password")=password
		rs.Update
        	rs.close
	end if
end sub

sub success()
%>
<table cellpadding=0 cellspacing=0 border=0 width=762 bgcolor=#efefef align=center class=pian>
        <tr>
            <td>
                <table cellpadding=3 cellspacing=1 border=0 width=100%>
    <tr align="center"> 
      <td width="100%" bgcolor=#ffffff>成功：修改资料</td>
    </tr>
    <tr> 
      <td width="100%" bgcolor=#ffffff><b>恭喜您，您的资料修改成功</b><br>
      </td>
    </tr>
    <tr align="center"> 
      <td width="100%" bgcolor=#ffffff>
<a href="javascript:history.go(-1)"> << 返回上一页</a>
      </td>
    </tr>  
</table></td></tr></table>
<%
end sub
set rs=nothing 
%>
<!--#include file="bbsend.asp"-->