<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../inc/function.asp"-->
<%
If Request("action")=1 then  
  Call Cw_yzm()'验证码
  Call cw_yz(60)'注册间隔60S
  Set re=Server.CreateObject("adodb.recordset")
  eql="select * from cw_user where email='"&trim(request("email"))&"'"
  re.open eql,conn,1,1
  if re.Recordcount>0 then
     Response.Write("<script>alert('此邮箱己被其他用户绑定，请更换一个！'); history.back();</script>")
	 Response.End()
  end if
  re.Close
  set re=Nothing
  email=Trim(Request.Form("email"))
  user=Trim(Request("user"))
  e_rnd=Cw_rnd(20)
  Set rs=Server.CreateObject("adodb.recordset")
  sql="select * from cw_user where [user]='"&trim(request("user"))&"'"
  rs.open sql,conn,1,3
  If not rs.eof then
     Response.Write("<script>alert('此用户名己经存在，请更换一个！'); history.back();</script>")
	 Response.End()
  Else
     rs.addnew
	 rs("user")=user
	 rs("pass")=md5(Trim(request("pass")))
	 rs("adddate")=now()
	 rs("type")=request("type")
	 rs("email")=email
	 rs("repass")=e_rnd
	 rs.Update
     id=rs("id")
	 rs.close
	 set rs=nothing
	 Session("user")=user
	 Session("userid")=id
	 Session("utype")=request("type")
	 If isjmail=1 then	   
	   e_tit=cf_name&"邮箱验证"
	   e_con="亲爱的<b>"&user&"</b>您己成功注册"&cf_name&"的会员，为了您的帐户安全及密码遗忘找回密码等，请点击以下链接对您的E-mail邮箱进行验证：<a href='"&cf_host&cf_root&"user/cw_email.asp?key="&e_rnd&"&act=2' target='_blank'>"&cf_host&cf_root&"user/Cw_pass.asp?key="&e_rnd&"&act=2</a>."   
	   jm=Cw_jmail(cf_smtp,cf_email,cf_name,cf_jmailUser,cf_jmailPass,e_email,e_tit,e_con)
	   Select Case jm
	     Case 0
	       Response.Write("<script>alert('恭喜您，注册成功！\n为了您的帐号安全！\n请进入邮箱激活你的邮箱！');location.href='index.asp';</script>")
	     Case 1
	       Response.Write("<script>alert('恭喜您，注册成功！');location.href='index.asp';</script>")
	     Case 2
	       Response.Write("<script>alert('恭喜您，注册成功！');location.href='index.asp';</script>")
	   End Select
	 Else
	   Response.Write("<script>alert('恭喜您，注册成功！');location.href='index.asp';</script>")
	 End If	 
  End if
  Response.End()
End if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用户注册 - <%=cf_name%></title>
<link rel="stylesheet" type="text/css" href="images/style.css" />
<script type="text/javascript" src="images/us.js"></script>
</head>

<body>
<!--#include file="top.asp"-->
<div class="reg">
   <div class="reg_left">
      <form action="" method="post" onsubmit="return check_reg(this)">
      <div class="reg_box"><span>用户帐号：</span><input name="user" type="text" id="user" tabindex="1" value="6-12位用户名" maxlength="20" onfocus="this.className='login_input2';if(this.value=='6-12位用户名'){this.value=''};" onblur="this.className='login_input';if(this.value==''){this.value='6-12位用户名'};" class="login_input" /><label id="f_user"></label></div>
	  
	  <div class="reg_box"><span>用户密码：</span><input name="pass" type="password" id="pass" tabindex="3" value="" maxlength="20" onfocus="this.className='login_input2';" onblur="this.className='login_input';" class="login_input" /><label id="f_pass"></label></div>
	  
	  <div class="reg_box"><span>确认密码：</span><input name="pass2" type="password" id="pass2" tabindex="3" value="" maxlength="20" onfocus="this.className='login_input2';" onblur="this.className='login_input';" class="login_input" /><label id="f_pass2"></label></div>
	  
	  <div class="reg_box"><span>用户类型：</span><input name="type" type="radio" value="0" checked="checked" />
	    个人<input type="radio" name="type" value="1" />
	    商家<input type="radio" name="type" value="2" />
	    中介
	  </div>
	  
	  <div class="reg_box"><span>联系邮箱：</span><input name="email" type="text" id="email" tabindex="5" value="example@163.com" maxlength="20" onfocus="this.className='login_input2';if(this.value=='example@163.com'){this.value=''};" onblur="this.className='login_input';if(this.value==''){this.value='example@163.com'};" class="login_input" /><label id="f_email"></label></div>
	  
	  <div class="reg_box2"><span>验 证 码：</span><input name="yzm" type="text" id="yzm" tabindex="7" value="" maxlength="5"  onfocus="this.className='login_input4';" onblur="this.className='login_input3';" class="login_input3" />&nbsp;&nbsp;<img src="../inc/code.asp" width="80" height="25" alt="看不清单击刷新" onclick="this.src='../inc/code.asp?' + Math.random();" style="cursor:pointer" align="absmiddle"/><input name="action" type="hidden" id="action" value="1" />
	    <label id="f_yzm"></label></div>
	  <div class="login_box"><input type="submit" name="sub" value="同意以下协议，提交注册" class="reg_btn" /></div>
	  </form>
	  <div class="reg_line">
	    <input name="checkbox" type="checkbox" value="checkbox" checked="checked" />
     <a href="" target="_blank">《<%=cf_name%>会员注册协议》</a></div>
   </div>
   <div class="reg_right">      
      <div class="login_bg">
	       <p><b>己有自己的帐户？</b><br />注册成为<%=cf_name%>的会员，免费发布招聘、求职、<br />房产、二手、等信息，免费加入企业黄页、电话黄页等。<br />己注册用户请点击下面登录！<br /><a href="login.asp"><img src="images/login_s.png" /></a></p>
	  </div>
   </div>
   <div class="clear"></div>
</div>
</body>
</html>
