<?php
require("../e/class/connect.php");
require("../e/class/db_sql.php");
require("../e/member/class/user.php");
require("../e/member/class/member_registerfun.php");
session_start();
$appheaderimg=$_SESSION['apptype']=='qq'?'<img src="'.$_SESSION['headerimg'].'" alt="'.$_SESSION['nickname'].'" />':'';
$nickname=$_SESSION['nickname'];
$nickname=iconv('utf-8','gb2312',$nickname);
$apptype=$_SESSION['apptype'];
$openid=$_SESSION['openid'];
$tobind=(int)$_GET['tobind'];
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
eCheckCloseMods('member');//关闭模块
//关闭
if($public_r[register_ok])
{
	printerror("CloseRegister","history.go(-1)",1);
}
//验证时间段允许操作
eCheckTimeCloseDo('reg');
//验证IP
eCheckAccessDoIp('register');
$tobind=(int)$_GET['tobind'];

//已经登陆不能注册
if(getcvar('mluserid'))
{
	printerror2("已经登陆，请不要重复注册","history.go(-1)");
}
$groupid=1;


$groupid=$groupid?$groupid:eReturnMemberDefGroupid();
CheckMemberGroupCanReg($groupid);
$formid=GetMemberFormId($groupid);
if(empty($formid))
{
	printerror2('参数错误');
}
$ecmsfirstpost=1;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><?=$public_r[sitename]?>- 用户注册</title>
<link href="temp/css/base.css" type="text/css" rel="stylesheet" />
<script src="temp/css/jq171.js" type="text/javascript"></script>
<script src="temp/css/jqbase.js" type="text/javascript"></script>
<link href="temp/css/box.css" type="text/css" rel="stylesheet" />
<script src="temp/css/formValidator-4.0.1.js" type="text/javascript"></script>
<script src="temp/css/formValidatorRegex.js" type="text/javascript"></script>
<script language="javascript" src="temp/css/DateTimeMask.js" type="text/javascript"></script>
</head>
<body>
<div class="layout" id="sign-header">
  <div id="sign-logo"><a href="<?=$public_r[newsurl]?>"><img src="images/logo.png" alt="" /></a></div>
</div>
<!-- // sign-header end -->
<div class="layout" id="sign-content">
  <div class="ui-box ui-qire sign-focus" id="reg-box">
    <div class="ui-title fn-clear"><span>已有<?=$public_r[sitename]?>帐号？请<a href="login.php">直接登录 <?=$public_r[sitename]?></a></span>
      <h2>注册<?=$public_r[sitename]?>会员</h2> 
     </div>
    <div class="ui-cnt fn-clear">
      <form id="setfrom" action="/e/member/doaction.php?enews=register" method="post">
    <input type="hidden" name="enews" value="register" /><input name="groupid" type="hidden" id="groupid" value="<?=$groupid?>" /><input name="tobind" type="hidden" id="tobind" value="<?=$tobind?>" /><input name="ecmsfrom" type="hidden" id="ecmsfrom" value="/user/" />
      <div class="ui-form" id="sign-primary" >
          <div class="ui-form-item fn-clear" >
            <label class="ui-label w100">&nbsp;</label>
            <p class="qire-notice">友情提示：注册成功后，使用用户名就可以登录哦！</p>
          </div>
          <div class="ui-form-item fn-clear">
            <label for="email" class="ui-label w100"><strong>Email</strong>地址：</label>
            <input type="text" id="email" name="email" class="ui-input w220" value="" />
            <p class="ui-message" id="emailTip">请输入有效的Email地址</p>
          </div>
          <div class="ui-form-item fn-clear">
            <label for="username" class="ui-label w100">用户名：</label>
            <input type="text" id="username" name="username" class="ui-input w220" value="" />
            <p class="ui-message" id="usernameTip">用户名使用4-16个字符</p>
          </div>
          <div class="ui-form-item fn-clear">
            <label for="password" class="ui-label w100">设置密码：</label>
            <input type="password" id="password" name="password" maxlength="20" class="ui-input w220" value="" />
            <p class="ui-message" id="passwordTip">6-16个字符</p>
          </div>
          <div class="ui-form-item fn-clear">
            <label for="verifypass" class="ui-label w100">重复密码：</label>
            <input type="password" id="verifypass" name="repassword" maxlength="20" class="ui-input w220" value="" />
            <p class="ui-message" id="verifypassTip">请再一次输入密码</p>
          </div>
	<?
	if($public_r['regkey_ok'])
	{
	?>


          <div class="ui-form-item fn-clear" id="validate-code">
            <label for="validate" class="ui-label w100">验证码：</label>
            <div class="ui-form-block w120">
              <input type="text" id="validate" name="key" maxlength="10" class="ui-input w110"  value="" />
              <p class="validate-code-btn">看不清? <a href="javascript:void()"  id="verimgbut">换一张</a></p>
            </div>
            <img src="/e/ShowKey/?v=reg"  id="verimg" alt="点击图片更换验证码" title="点击图片更换验证码" style="border:1px solid #E5E5E5;height:33px; width:98px; margin-right:11px;" />
            <p class="ui-message" id="validateTip">输入上图运算的答案</p>
          </div>
	<?
	}	
	?>            
          <div  class="ui-form-item ui-form-checkbox fn-clear">
          <label class="ui-label w100">&nbsp;</label>
          <div class="ui-form-block w220">
          <label for="agreement" class="ui-label-checkbox">&nbsp;</label>
          <input type="checkbox" value="" name="agreement" id="agreement" checked="checked" value='1'/>我已阅读并接受《<a href="read.php">使用协议</a>》
          </div>
          </div>
          <div class="ui-form-item fn-clear">
            <label class="ui-label w100">&nbsp;</label>
            <input type="submit" id="register" class="ui-button w220" value="注册<?=$public_r[sitename]?>会员"/>
          </div>
        </div>
        </form>
      <div id="sign-app">
        <div class="sign-app-list">
          <h5>你还可以用以下方式直接登录：</h5>
          <a href="/e/memberconnect/?apptype=qq"><img src="images/qq_login.gif" alt="" /></a><a href="/e/memberconnect/?apptype=sina"><img src="images/sina_login.gif" alt="" /></a></div>
      </div>
      <!-- // sign-app end -->
    </div>
  </div>
  <!-- // sign-box#regbox end -->
</div>
<script>

	$.formValidator.initConfig({
		formID:"setform",
		debug:false,
		submitOnce:false,
		onSuccess:function(){
	$("#setform").submit();	
		},
		onError:function(msg,obj,errorlist){
			$("#errorlist").empty();
			$.map(errorlist,function(msg){
				$("#errorlist").append("<li>" + msg + "</li>")
			});
			//alert(msg);
		},
		submitAfterAjaxPrompt : '有数据正在异步验证，请稍等...'
	});
	
	// Email
	
	$("#email").formValidator({
		onShow:"请输入邮箱",
		onFocus:"邮箱至少6个字符,最多100个字符",
		onCorrect:"填写正确",
		defaultValue:""
	})
	.inputValidator({
		min:6,
		max:100,
		onError:"你输入的邮箱长度非法,请确认"
	})
	.regexValidator({
		regExp:"^([\\w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([\\w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$",onError:"你输入的邮箱格式不正确"
	});

	$("#username").formValidator({
		onShow:"请输入4-15位的用户名",
		onFocus:"用户名至少4个字符,最多15个字符",
		onCorrect:"该用户名可以注册"
	})
	.inputValidator({
		min:4,
		max:15,
		onError:"你输入的用户名非法,请确认"
	})
	.regexValidator({
		regExp:"myusername",
		dataType:"enum",
		onError:"用户名格式不正确"
	});

	// Password
	$("#password").formValidator({
		onShow:"请输入密码",
		onFocus:"至少6个长度",
		onCorrect:"密码输入正确",
		onError:'密码在6-16位'
	})
	.inputValidator({
		min:6,
		empty:{
			leftEmpty:false,
			rightEmpty:false,
			emptyError:"密码两边不能有空符号"
		},onError:"密码在6-16位"
	});

	// Verifypassword
	$("#verifypass").formValidator({
		onShow:"输再次输入密码",
		onFocus:"至少6个长度",
		onCorrect:"密码一致"
	})
	.inputValidator({
		min:6,
		empty:{
			leftEmpty:false,
			rightEmpty:false,
			emptyError:"重复密码两边不能有空符号"
		},onError:"重复密码不能为空,请确认"
	})
	.compareValidator({
		desID:"password",
		operateor:"=",
		onError:"2次密码不一致,请确认"
	});

	// Verimgbut
	$("#verimgbut,#verimg").click(function (){
		//	alert("ddddddd");
		$("#verimg").attr('src',"/e/ShowKey/?v=reg&t="+Math.random());
	});

	// Validate
	$("#validate").formValidator({
		onShow:"输入上图字母",
		onFocus:"输入上图字母",
		onCorrect:"验证码正确"
	})
	.inputValidator({
		min:4,
		max:4,
		onError:"验证码错误"
	})
	.regexValidator({
		regExp:"^[A-Za-z0-9]+$",
		onError:"你输入的邮箱格式不正确"
	});
	
// })(jQuery);	

</script>
<!-- // sign-content end -->
<? include "temp/footer.php";?>
</body>
</html>