<!--#include file="conn.asp"-->
<!-- #include file="inc/const.asp" -->
<!-- #include file="chkuser.asp" -->
<!--#include file="inc/char.asp"-->
<!--#include file="inc/theme.asp"-->
<!--#include file="md5.asp"-->
<!--#include file="inc/chkinput.asp"-->
<%
stats="修改资料"
dim sex
dim showre
dim password
dim quesion
dim answer
dim face,width,height
dim email
dim birthday
dim usercookies
if membername="" then
 response.redirect "../login.asp"
response.end
else
	if request("action")="updat" then
		if request("sex")="" then
			errmsg=errmsg+"<br>"+"<li>请选择您的性别。"
			founderr=true
		elseif request("sex")=0 or request("sex")=1 then
			sex=request("sex")
		else
			errmsg=errmsg+"<br>"+"<li>您输入的字符非法。"
			founderr=true
		end if
		
		if request("showRe")="" then
			errmsg=errmsg+"<br>"+"<li>请选择有回帖时是否提示您。"
			founderr=true
		elseif request("showRe")=0 or request("showRe")=1 then
			showRe=request("showRe")
		else
			errmsg=errmsg+"<br>"+"<li>您输入的字符非法。"
			founderr=true
		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"),picurl)>0 then
				face=request("face")
				width=80
				height=80
			else
				errmsg=errmsg+"<br>"+"<li>您选择了错误的头像。"
				founderr=true
			end if
		end if
		
		if request("oicq")<>"" then
			if not isnumeric(request("oicq")) or len(request("oicq"))>10 then
			errmsg=errmsg+"<br>"+"<li>Oicq号码只能是4-10位数字，您可以选择不输入。"
			founderr=true
			end if
		end if
		if request.Form("birthyear")="" or request.form("birthmonth")="" or request.form("birthday")="" then
		birthday=""
		else
		birthday=trim(Request.Form("birthyear"))&"-"&trim(Request.Form("birthmonth"))&"-"&trim(Request.Form("birthday"))
		end if
	else
		call nav()
		call headline(1)
		call userinfo()
	end if
end if

if founderr then
	call nav()
	call headline(1)
	call error()
else
	if request("action")="updat" then
		if founderr then

		else

			end if
		end if
	end if
end if
call endline()

sub userinfo()
	set rs=server.createobject("adodb.recordset")
	sql="Select * from [User] where username='"&trim(membername)&"'"
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		errmsg=errmsg+"<br>"+"<li>该用户名不存在。"
		founderr=true
	else
%>
<table border=0 cellpadding=6 cellspacing=1 width="<%=TableWidth%>" height=29 align=center bgcolor="<%=TableBackColor%>"><tr class=coolbg bgColor="<%=aTablebodyColor%>" align=center>
<td width=14% ><B><a href=usermanager.asp ><FONT COLOR=#000000>控制面板首页</font></a></B></td>
<td width=14% bgColor="<%=TablebodyColor%>"><a href=mymodify.asp?name=<%=membername%> ><B><FONT COLOR=#000000>基本资料修改</font></B></a></td>
<td width=14% ><a href=modifypsw.asp?name=<%=membername%>> <B><FONT COLOR=#000000> 用户密码修改</font></B></a></td>
<td width=14% > <a href=modifyadd.asp?name=<%=membername%>> <B><FONT COLOR=#000000>修改联系资料</font></B></a></td>
<td width=14% ><a href=favlist.asp><B><FONT COLOR=#000000>用户收藏管理</font></B></a></td>
<td width=14% ><a href=usersms1.asp><B><FONT COLOR=#000000>用户短信服务</font></B></a></td>
<td width=14% ><a href=friendlist1.asp><B><FONT COLOR=#000000>编辑好友列表</font></B></a></B>
</td></tr></table><br>
<%

%>
<form action="mymodify.asp?action=updat&username=<%=htmlencode(membername)%>" method=POST name="theForm">
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> bgcolor=<%=Tablebackcolor%> align=center>
        <tr>
            <td>
                <table cellpadding=3 cellspacing=1 border=0 width=100%>
    <tr class=coolbg align="center"> 
      <td colspan="2" width="100%" bgcolor=<%=Tabletitlecolor%> height=25><font color="<%=TablefontColor%>"><b><%=htmlencode(RS("username"))%>修改资料</b></font></td>
    </tr>
      <tr bgcolor=<%=Tablebodycolor%>>    
        <td width="40%"><font color="<%=TableContentColor%>"><B>性别</B>：<BR>请选择您的性别</font></td>   
        <td width="60%"><input type="radio" value="1"<%if rs("sex")=1 then%> checked <%end if%>name="Sex">酷哥
      <input type="radio" name="Sex"<%if rs("sex")=0 then%> checked <%end if%> value="0">靓妹</td>
</td>   
      </tr>   
            <tr bgcolor=<%=Tablebodycolor%>>    
        <td width="40%"><font color="<%=TableContentColor%>"><B>生日</B><BR>如不想填写，请全部留空</font></td>   
        <td width="60%"> <font color="<%=TableContentColor%>">   
				  <select name=birthyear   >
				  <option value=""></option>
				  <%for i=1901 to 2000%>
					<option value="<%=i%>" <%if not isnull(rs("birthday")) or rs("birthday")<>"" then%><%if cint(year(rs("birthday")))=cint(i) then response.write "selected"%><%end if%>><%=i%></option>
				  <%next%>
				  </select>
                    年 
				  <select name=birthmonth   >
				  <option value=""></option>
				  <%for i=1 to 12%>
					<option value="<%=i%>" <%if not isnull(rs("birthday")) or rs("birthday")<>"" then%><%if cint(month(rs("birthday")))=cint(i) then response.write "selected"%><%end if%>><%=i%></option>
				  <%next%>
				  </select>
                    月 
				  <select name=birthday   >
				  <option value=""></option>
				  <%for i=1 to 31%>
					<option value="<%=i%>" <%if not isnull(rs("birthday")) or rs("birthday")<>"" then%><%if cint(day(rs("birthday")))=cint(i) then response.write "selected"%><%end if%>><%=i%></option>
				  <%next%>
				  </select>
                    日</font>
        </td>   
      </tr>
<%if cint(TitleFlag)=1 then%>
<%if rs("userclass")>5 then%>
      <tr bgcolor=<%=Tablebodycolor%>> 
        <td width="40%"><font color="<%=TableContentColor%>"><B>头衔</B>：</font></td>   
        <td width="60%"> <input type="text" name="title"    value="<%if trim(rs("title"))<>"" then%><%=htmlencode(RS("title"))%><%end if%>" size=15 maxlength=13> </td>   
      </tr>   
<%end if%>
<%end if%>
      <tr bgcolor=<%=Tablebodycolor%>>    
        <td width="40%" valign=top><font color="<%=TableContentColor%>"><B>头像</B>：<BR>
您可以选择一个个性图片，当你发表时将显示在您的名字下方。<BR>
如果你填写了下面的自定义头像部分，那么你的头像以自定义的为准。否则，请你留空自定义头像的所有栏目！<BR>
<B>关于自定义头像</B>：<BR>
你也可以在这里给出你自定义头像的 URL 地址，头像的高度和宽度(像素)。 如果不想要自定义头像，请将相应栏目栏目全部留空！</font>
		</td>   
        <td width="60%">    <table border="0" cellpadding="0" cellspacing="1" width="98%" >
            <tr>
              <td width="*" ><font color="<%=TableContentColor%>">论坛头像选择 
<select name=face style="font-family:arial"    size=1 onChange="document.images['face'].src=options[selectedIndex].value; parent.document.forms[0].myface.value=options[selectedIndex].value"> 
<%
	Dim OldfaceStr,LenOldfaceStr,OldfaceNum 
	OldfaceStr = rs("face") 
	LenOldfaceStr = Len( OldfaceStr ) 
	if LenOldfaceStr = 14 then OldfaceNum = Left( Right(OldfaceStr,5),1 ) 
	if LenOldfaceStr = 15 then OldfaceNum = Left( Right(OldfaceStr,6),2 ) 
	if LenOldfaceStr = 16 then OldfaceNum = Left( Right(OldfaceStr,7),3 ) 
	OldfaceNum = Cint( OldfaceNum ) 
	for i=1 to regfacenum
	if OldfaceNum - i = 0 then
%> 
    
     <% else %> 
   <option value='<%=picurl%>Image<%=i%>.gif'><%=i%></option> 
<%
	end if 
	next
%> 
                </select><script>function New(para_URL){var URL=new String(para_URL);window.open(URL,'','resizable,scrollbars')}</script>             
&nbsp;&nbsp;  <input type=button    value='头像预览' name=Button onclick=openface()> <a href=allface.asp target=_blank>查看所有头像&gt;&gt;&gt;</a></td>
              <td width="180"  rowspan="2"  valign=top align=center>
<img id=face src="<%=rs("face")%>" width=<%=rs("width")%> height=<%=rs("height")%>>
</td>
            </tr>
            <tr>
              <td width="*" >
<% if uploadFlag then %> 
          <iframe name="ad" frameborder=0 width=300 height=40 scrolling=no src=reg_upload.asp></iframe> <br>
		<% end if %>
		
		  自定义头像地址：<input type="TEXT" name="myface"    size=30 maxlength=100 value=<%=rs("face")%>> <br>
	  宽&nbsp;&nbsp;&nbsp;&nbsp;度：<input type="TEXT" name="width"   size=3 maxlength=3 value=<%=rs("width")%>>20---120的整数<br>
	  高&nbsp;&nbsp;&nbsp;&nbsp;度：<input type="TEXT" name="height"   size=3 maxlength=3 value=<%=rs("height")%>>20---120的整数<br></font>
</td>
            </tr>
          </table>
        </td>   
      </tr>	 
      <tr bgcolor=<%=Tablebodycolor%>>    
        <td width="40%"><font color="<%=TableContentColor%>"><B>个人照片</B>：<BR>如果您有照片在网上，请输入网页地址。此项可选</font></td>   
        <td width="60%">    
          <input type="TEXT" name="userphoto"   value="<%if trim(rs("userphoto"))<>"" then%><%=htmlencode(rs("userphoto"))%><%end if%>" size=30 maxlength=100>   
        </td>   
      </tr>   
    <%if cint(GroupFlag)=1 then%>
      <tr bgcolor=<%=Tablebodycolor%>>    
        <td width="40%"><font color="<%=TableContentColor%>"><B>门派</B>：<BR>如果您有兴趣，可加入以下门派</font></td>   
        <td width="60%">    
<select name=groupname   >
<%
dim grs
set grs=conn.execute("select * from GroupName")
if grs.eof and grs.bof then
%>
<option value="无门无派">无门无派</option>
<%else%>
<%do while not grs.eof%>
<option value="<%=grs("Groupname")%>" <%if grs("groupname")=rs("usergroup") then response.write "selected"%>><%=grs("GroupName")%></option>
<%
	grs.movenext
	loop
%>
<%end if%>
</select>
<%set grs=nothing%>
        </td>   
      </tr>
<%end if%>
           <tr bgcolor=<%=Tablebodycolor%>>    
        <td width="40%"><font color="<%=TableContentColor%>"><B>有回帖时是否提示您</B>：<BR>当您的帖子有人回复后有信息通知您</font></td>   
        <td width="60%">    <font color="<%=TableContentColor%>">
			<input type="radio" name="showRe" value="1" <% if rs("showRe") then response.write "checked" %> >
			提示我
			<input type="radio" name="showRe" value="0" <% if not rs("showRe") then response.write "checked" %> >
			不提示</font>
        </td>   
      </tr>	  
      <tr bgcolor=<%=Tablebodycolor%>>    
        <td valign=top width="40%"><font color="<%=TableContentColor%>"><B>签名</B>：<BR>不能超过 300 个字符   
          <br>   
          文字将出现在您发表的文章的结尾处。</font></td>   
        <td width="60%">    
          <textarea name="Signature" rows=5 cols=60 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 bgcolor=<%=Tablebodycolor%>>    
        <td width="40%"><font color="<%=TableContentColor%>"><B>选择Cookie的保留时间</B>：</font></td>   
        <td width="60%">    
			<font color="<%=TableContentColor%>">
    <input type="radio" name="usercookies" value="1" <% if request.cookies("aspsky")("usercookies")=1 then response.write "checked" %> >
    <font color=red>1天</font>
    <input type="radio" name="usercookies" value="2" <% if request.cookies("aspsky")("usercookies")=2 then response.write "checked" %> >
    1个月
    <input type="radio" name="usercookies" value="3" <% if request.cookies("aspsky")("usercookies")=3 then response.write "checked" %>>
    1年
    <input type="radio" name="usercookies" value="0" <% if request.cookies("aspsky")("usercookies")=0 then response.write "checked" %>>
    不保留</font> </td>   
      </tr>
    <tr class=coolbg align="center"> 
      <td colspan="2" width="100%" bgcolor=<%=Tabletitlecolor%>>
            <input type=Submit value="更 新"   name="Submit"> &nbsp; <input type="reset" name="Submit2"   value="清 除">
      </td>
    </tr>  
    </table>   </td></tr></table> 
</form>   
</body>
</html> 
<%
	end if
	rs.close
	set rs=nothing
end sub

sub update()
		set rs=server.createobject("adodb.recordset")
	sql="Select * from [User] where username='"&trim(membername)&"'"
	rs.open sql,conn,1,3
	if rs.eof and rs.bof then
		errmsg=errmsg+"<br>"+"<li>该用户名不存在。"
		founderr=true
	else
		rs("face")=face
		rs("width")=width
		rs("height")=height
		rs("sex")=sex
		if request("Signature")<>"" then
		rs("sign")=trim(request("Signature"))
		end if
		if trim(request("userphoto"))="" then
        rs("userphoto")="pic/photo.gif"
		else
		rs("userphoto")=request("userphoto")
		end if
		rs("showRe")=showRe
		rs("UserGroup")=request("GroupName")
		if rs("userclass")>5 then
		if request("title")<>"" then
		rs("title")=htmlencode(request("title"))
		end if
		end if
		if birthday<>"" then
		rs("birthday")=birthday
		end if
		rs.Update
        	rs.close
			set rs=nothing
        	        usercookies=request("usercookies")
			select case usercookies
	                case 0
	                
  			Response.Cookies("aspsky")("usercookies") = usercookies
	                case 1
	                Response.Cookies("aspsky").Expires=Date+1
  			Response.Cookies("aspsky")("usercookies") = usercookies
	                case 2
	                Response.Cookies("aspsky").Expires=Date+31
  			Response.Cookies("aspsky")("usercookies") = usercookies
	                case 3
	                Response.Cookies("aspsky").Expires=Date+365
  			Response.Cookies("aspsky")("usercookies") = usercookies
	                end select			
			
			Response.Cookies("aspsky").path=cookiepath
	end if
end sub

sub success()
%>
<table cellpadding=0 cellspacing=0 border=0 width="<%=tablewidth%>" bgcolor=<%=Tablebackcolor%> align=center>
        <tr>
            <td>
                <table cellpadding=3 cellspacing=1 border=0 width=100%>
    <tr  class=coolbg align="center"> 
      <td width="100%" bgcolor=<%=Tabletitlecolor%>><font color="<%=TablefontColor%>">成功：修改资料</font></td>
    </tr>
    <tr> 
      <td width="100%" bgcolor=<%=Tablebodycolor%>><font color="<%=TableContentColor%>"><b>恭喜您，您的资料修改成功</b></font><br>
      </td>
    </tr>
    <tr align="center"> 
      <td width="100%" bgcolor=<%=Tabletitlecolor%>>
<a href="javascript:history.go(-1)"> << 返  回</a>
      </td>
    </tr>  
    </table>   </td></tr></table>
<%
end sub
	set rs=nothing 
	stats="修改个人资料"
%><!--#include file=footer.asp-->