<!-- #include file="top.asp" -->
<!-- #include file="share.asp" -->
<html>
<head>
<title>[xframe]注册论坛新用户</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.uid.value==""){
		alert("blank user's id.");
		user.uid.focus();
		return false;
	}else if(user.password.value==""){
		alert("blank password.");
		user.password.focus();
		return false;
	}else if(user.cpassword.value==""){
		alert("confirm password.");
		user.cpassword.focus();
		return false;
	}else if(user.cpassword.value!=user.password.value){
		alert("confirm your 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="534" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr bgcolor="#FFFFFF"> 
    <td width="20" height="10"></td>
      
    <td width="719" height="10"></td>
      
    <td width="21" height="10"></td>
    </tr>
    <tr>
        <td width="25" height="455" background="images/bg.gif"></td>
        
    <td width="719" height="455" valign="top"><table width="720" border="0" cellspacing="0">
        <tr> 
          <td><table width="100%" cellpadding="0" cellspacing="0" border="0">
              <tr> 
                <td align="left"> <div align="center"><br>
                    <br>
                    <img src="images/rightstyle.gif"><a href="index.asp">返回首页 
                    </a><img src="images/rightstyle.gif"><a href="userlist.asp">查看成员列表 
                    </a> 
                    <%
			if not session("blueuid")="" then
		%>
                    <img src="images/rightstyle.gif"><a href="editinfo.asp?uid=<%=session("blueuid")%>">修改个人资料 
                    </a> 
                    <%
			end if %>
                    <img src="images/rightstyle.gif"><a href="javascript:history.back();">返回</a> 
                  </div></td>
              </tr>
            </table></td>
        </tr>
        <tr> 
          <td><div align="center"><br>
              <br>
              <br>
             
              <%
				dim isok
				isok=request.form("isok")
				if isok="ok" then
					addnewuser
				else
					showform
				end if
				%>
            </div></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
        <td width="21" height="451" background="images/bg.gif"></td>
    </tr>
    <tr>
      <td height="12" colspan="3"><div align="center">
        <table width="760" 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>
  </center>
</div>

</body>

</html>
<%
'===================sub show form ===================
sub showform
	dim emsg
	emsg=request.form("emsg")
%>            <table width="80%" border="0" cellspacing="0" cellpadding="0" height="430">
              <tr align="left" valign="top"> 
                <td width="67%"> 
                  <form name="user" method="post" action="newuser.asp" onsubmit="return(checkform());">
				    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
						<TD width="45"><img src="images/frame_forum2.gif" align="absmiddle"></TD>
                        <td align="left" height="20" valign="middle" background="images/frame_bg.gif"><font class="subtitle">新成员注册</font></td>
                      </tr>
					 </table>
					 <table width="100%" border="0" cellspacing="1" cellpadding="0">
                      <tr> 
                        <td width="24%" align="right" valign="middle">成员id: </td>
                        <td width="76%" align="left" valign="middle"> 
                          <input type="text" name="uid" size="15" maxlength="20">
						  <font color="#ff9900"><%=emsg%></font>
                        </td>
                      </tr>
                      <tr> 
                        <td width="24%" align="right" valign="middle">密码: </td>
                        <td width="76%" align="left" valign="middle"> 
                          <input type="password" name="password" size="15" maxlength="20">
                        </td>
                      </tr>
                      <tr> 
                        <td width="24%" align="right" valign="middle">重复密码: </td>
                        <td width="76%" align="left" valign="middle"> 
                          <input type="password" name="cpassword" size="15" maxlength="20">
                        </td>
                      </tr>
                      <tr> 
                        <td width="24%" align="right" valign="middle">email: </td>
                        <td width="76%" align="left" valign="middle"> 
                          <input type="text" name="email" size="20" maxlength="25">
                        </td>
                      </tr>
                      <tr> 
                        <td width="24%" align="right" valign="middle">homepage: 
                        </td>
                        <td width="76%" align="left" valign="middle"> 
                          <input type="text" name="homepage" size="20" maxlength="40">
                        </td>
                      </tr>
                      <tr> 
                        <td width="24%" align="right" valign="top" height="33">contact: 
                        </td>
                        <td width="76%" align="left" valign="top" height="33"> 
                          <textarea name="contact" cols="40" rows="4"></textarea>
                        </td>
                      </tr>
                      <tr> 
                        <td width="24%" align="right" valign="top" height="42">signature: 
                        </td>
                        <td width="76%" align="left" valign="top" height="42"> 
                          <textarea name="sign" cols="40" rows="5"></textarea>
                          <br>
                          <font color="#666666">signature html enabled</font></td>
                      </tr>
                      <tr> 
                        <td width="24%" align="right" valign="top" height="60">&nbsp;</td>
                        <td width="76%" align="left" valign="top" height="60"> 
                          <p><br>
						    <input type="hidden" name="isok" value="ok">
                            <input type="submit" name="submit" value="submit">
                            <input type="reset" name="submit2" value="reset">
                          </p>
                        </td>
                      </tr>
                    </table>
				  </form>
                </td>
              </tr>
            </table>
<%
end sub
%><%
'=======================sub add a new user ================
sub addnewuser
	uid=request.form("uid")
	password=request.form("password")
	homepage=request.form("homepage")
	email=request.form("email")
	contact=request.form("contact")
	sign=request.form("sign")	'opendb
	on error resume next
	sql="select * from userinfo where uid='"&uid&"'"
	set rs=server.createobject("adodb.recordset")
	rs.open sql, conn, 1, 3
	if not rs.eof then
		%>
		<form name="em" method="post" action="newuser.asp">
		<table width="100%"><tr><td align="center" valign="top">
		用户名已经被选择了！
		<input type="hidden" name="isok" value="no">
		<input type="hidden" name="emsg" value="please choose another!">
		<p><input type="submit" name="submit" value="确认">
		</td></tr></table>
		</form>
		<%
	else
		rs.addnew
		rs("uid")=uid
		rs("password")=password
		rs("email")=email
		rs("homepage")=homepage
		rs("contact")=contact
		rs("sign")=sign
		rs.update
	checkerr
		%>
		<p>
		&nbsp;&nbsp;&nbsp;&nbsp;<%=uid%>, 注册成功！&nbsp;&nbsp;<a href="index.asp"><img src="images/bbs_back.gif" border="0" align="absmiddle"></a>
		<%
	end if
	rs.close
	set rs=nothing
	'closedb
end sub
%><% closedb %>