<!-- #include file="share.asp" -->
<%
sub updateinfo
	dim rs
	dim sql
	sql="select * from userinfo where uid='"&request.form("uid")&"' and password='"&request.form("opassword")&"'"
	set rs=server.createobject("adodb.recordset")
	'opendb
	on error resume next
	rs.open sql, conn, 1,3
	if rs.eof then
		response.redirect "error.asp?emsg=这个用户不存在或密码错误。"
		response.end
	else
		rs("password")=request.form("password")
		rs("email")=request.form("email")
		rs("homepage")=request.form("homepage")
		rs("contact")=request.form("contact")
		rs("sign")=request.form("sign")
		rs.update
	end if
	rs.close
	checkerr
	set rs=nothing
	'closedb
	%>
	　　<%=request.form("uid")%>: 资料修改成功！&nbsp;&nbsp;&nbsp;&nbsp;<a href="showuser.asp?uid=<%=request.form("uid")%>"><img src="images/bbs_back.gif" border="0" align="absmiddle"></a>
	<%
end sub
%>
<HTML>
<!-- #include file="top.asp" -->
<HEAD>
<TITLE>3鸟设社[色彩连视版]媒体社区-修改资料</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<link rel="stylesheet" href="BLUE.CSS" type="text/css">
<style type="text/css">
<!--
.hand { cursor: hand }
-->
</style>
<script language="javascript">
function emailcheck(){
	var pos_at,pos_dot;
	var emailadd;
	var email=user.email.value;
	emailadd=email;

	if(emailadd!=""){
		pos_at=emailadd.indexOf('@',0);
		pos_dot=emailadd.indexOf('.',0);
		//	alert("pos_at="+pos_at+", pos_dot="+pos_dot);
		if(pos_dot>=emailadd.length-1)return false;
		//alert("len: "+emailadd.length);
		//alert("dot: "+pos_dot);
		if(pos_at<=0||pos_dot<=0)
		{return false;}
	}else{
		return false;
	}
	return true;
}
function checkform(){

	if(user.password.value==""){
		alert("blank new password.");
		user.password.focus();
		return false;
	}else if(user.opassword.value==""){
		alert("password current!");
		user.opassword.focus();
		return false;
	}else if(user.cpassword.value==""){
		alert("confirm new password.");
		user.cpassword.focus();
		return false;
	}else if(user.cpassword.value!=user.password.value){
		alert("confirm your new password!");
		user.password.focus();
		return false;
	}else if(user.email.value==""){
		alert("blank email address.");
		user.email.focus();
		return false;
	}else if(!emailcheck()){
		alert("Error email address!");
		user.email.focus();
		return false;
	}else{
		return true;
	}
	return false;
}
</script>
</HEAD>
<body bgcolor=#ffffff leftmargin="0" topmargin="0">
<table width="760" height="824" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="20" height="2"></td>
    <td width="719" height="2"></td>
    <td width="21" height="2"></td>
  </tr>
  <tr> 
    <td width="20" height="801" background="images/bg.gif"></td>
    <td width="719" height="801" valign="top"> <table width="712" border="0" cellspacing="0">
        <tr> 
          <td width="710" height="118"> <div align="center"><br>
              <br>
              <br>
              <br>
              <img src="images/rightstyle.gif"><a href="index.asp">返回首页</a> <img src="images/rightstyle.gif"><a href="userlist.asp">查看成员列表</a> 
              <img src="images/rightstyle.gif"><a href="javascript:history.back();">返回</a> 
            </div></td>
        </tr>
        <tr align="left" valign="top"> 
          <td> <%
				uid=request("uid")
				isok=request.form("isok")
				if uid="" then
					%> <p>[修改资料]未知成员ID, 无法继续。 
            <p> 
              <%
				else
					if isok="ok" then
						updateinfo
					else
						showinfo
					end if
				end if
			
				sub showinfo
					dim rs
					dim sql
					sql="select * from userinfo where uid='"&uid&"'"
					'opendb
					set rs=conn.execute(sql)
					if rs.eof then
						response.redirect "error.asp?emsg=这个用户不存在。"
						response.end
					else
				%>
            <p>&nbsp; 
            <form name="user" method="post" action="editinfo.asp" onsubmit="return(checkform());">
              <table width="100%" border="0" cellspacing="1" cellpadding="0">
                <tr> 
                  <td colspan="2" align="left" height="20"> <table width="80%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td width="242"><div align="right"><img src="images/frame_forum2.gif" align="absmiddle"></div></td>
                        <td width="331" height="20" align="left" valign="middle" background="images/frame_bg.gif"><font class="subtitle">修改个人资料</font></td>
                      </tr>
                    </table></td>
                </tr>
                <tr> 
                  <td width="37%" align="right" valign="middle">成员ID: </td>
                  <td width="63%" align="left" valign="middle"> <%=uid%> </td>
                </tr>
                <tr> 
                  <td width="37%" align="right" valign="middle">密码: </td>
                  <td width="63%" align="left" valign="middle"> <input type="password" name="opassword" size="15" maxlength="20"> 
                  </td>
                </tr>
                <tr> 
                  <td width="37%" align="right" valign="middle">新密码: </td>
                  <td width="63%" align="left" valign="middle"> <input type="password" name="password" size="15" maxlength="20" value="<%=rs("password")%>"> 
                  </td>
                </tr>
                <tr> 
                  <td width="37%" align="right" valign="middle">重复新密码: </td>
                  <td width="63%" align="left" valign="middle"> <input type="password" name="cpassword" size="15" maxlength="20" value="<%=rs("password")%>"> 
                  </td>
                </tr>
                <tr> 
                  <td width="37%" align="right" valign="middle">Email: </td>
                  <td width="63%" align="left" valign="middle"> <input type="text" name="email" size="20" maxlength="25" value="<%=rs("email")%>"> 
                  </td>
                </tr>
                <tr> 
                  <td width="37%" align="right" valign="middle">Homepage: </td>
                  <td width="63%" align="left" valign="middle"> <input type="text" name="homepage" size="20" maxlength="40" value="<%=rs("homepage")%>"> 
                  </td>
                </tr>
                <tr> 
                  <td width="37%" align="right" valign="top" height="33">Contact: 
                  </td>
                  <td width="63%" align="left" valign="top" height="33"> <textarea name="contact" cols="40" rows="4"><%=rs("contact")%></textarea> 
                  </td>
                </tr>
                <tr> 
                  <td width="37%" align="right" valign="top" height="42">Signature: 
                  </td>
                  <td width="63%" align="left" valign="top" height="42"> <textarea name="sign" cols="40" rows="5"><%=rs("sign")%></textarea> 
                    <br> <font color="#666666">Signature HTML Enabled</font></td>
                </tr>
                <tr> 
                  <td width="37%" align="right" valign="top" height="100">&nbsp;</td>
                  <td width="63%" align="left" valign="top" height="100"> <p><br>
                      <input type="hidden" name="uid" value="<%=uid%>">
                      <input type="hidden" name="isok" value="ok">
                      <input type="submit" name="Submit" value="Submit">
                      <input type="reset" name="resetform" value="Reset">
                    </p></td>
                </tr>
              </table>
            </form>
            <%
					end if
					rs.close
					set rs=nothing
					'closedb
				  end sub
			
				  %> </td>
        </tr>
        <tr> 
          <td><div align="center"></div></td>
        </tr>
      </table></td>
    <td width="21" height="801" background="images/bg.gif"></td>
  </tr>
  <tr> 
    <td height="2" colspan="3"><div align="center"> 
        <table width="758" border="0" align="center" cellspacing="0">
          <tr> 
            <td height="35" colspan="2" background="images/footbg.gif"> <div align="center">3鸟设社[v1.2色彩连视]T恤论论坛 
                www.3niao.com</div></td>
          </tr>
          <tr> 
            <td width="392" background="http://www.3niao.com/v2/down1/images/footgb1.gif">&nbsp;</td>
            <td width="362"><div align="right"><img src="http://www.3niao.com/v2/down1/images/foot.jpg"></div></td>
          </tr>
        </table>
      </div></td>
  </tr>
</table>
  </body>

</html>
