<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>{lang('register_user')}</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">

	<meta name="author" content="CmsEasy Team" />
	<link rel="icon" href="{$base_url}/favicon.ico" type="image/x-icon" />
	<link href="{$base_url}/common/css/bootstrap/bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
	<link href="{$skin_user_path}/css/login.css" rel="stylesheet">
	<link href="{$base_url}/common/font/simple/css/font.css" rel="stylesheet" type="text/css"/>
	<script src="{$base_url}/common/js/jquery/jquery.min.js"></script>

</head>
<body>
<div class="div-table">
	<div class="div-cell">
		<!-- <div class="form-title">
                <h4>{get('sitename')}</h4>
                <h5></h5>
                <p>
                    <i class=""></i>
                    <i class=""></i>
                </p>
            </div> -->

		<div class="form-box">
			<h2>
				{if $telregister}
				{lang('registration')}
				{else}
				{lang('registered_account')}
				{/if}</h2>
			<div class="login-switch">
				<a href="javascript:void(0)" onclick="setdx(this)">
					<span class="glyphicon glyphicon-barcode"></span>
				</a>
				<div class="line-div"></div>
				<div class="poptip">
					<div class="poptip-arrow">
						<em></em>
						<span></span>
					</div>
					<div class="poptip-content">
						{lang('fast_registration')}
					</div>
				</div></div>

			<form id="login_form"   name="login_form" method="post"  action="<?php echo url('user/register') ?>" onsubmit="return check()">




				{if config::get('reg_on')}

				<ul>
					<li name='register'><strong style="font-size:14px;color:red;">{message()}</strong></li>
					<li>
						<div class="input-group" id="usernamediv" >
							<span class="input-group-addon"><i class="icon-user"></i></span>
							<input type="text" class="form-control" value="{lang('enter_username')}" placeholder="{lang('enter_username')}" onfocus="if(this.value=='{lang('enter_username')}') {this.value=''}" onblur="if(this.value=='') this.value='{lang('enter_username')}'" data-errortxt="{lang('enter_username')}" name="username" id="username" tabindex="1">
						</div>
					</li>
					{if (config::get('mobilechk_enable') && config::get('mobilechk_reg') && $telregister!=1)}
					<li name='register'>
						<div class="input-group" >
							<div class="input-group-btn">
								<button type="button" class="btn btn1 dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">+86</button>
							</div><!-- /btn-group -->
							<input placeholder="{lang('tel')}" onchange="setusername(this)" type='text' id="tel"  name="tel" value="{lang('tel')}" onfocus="if(this.value=='{lang('tel')}') {this.value=''}" onblur="if(this.value=='') this.value='{lang('tel')}'" tabindex="3" class="form-control">
						</div><!-- /input-group -->
					</li>
					<script>
                        $(function(){
                            $("#usernamediv").attr("style","display: none");
                        });
                        function setusername(obj){
                            $("#username").val($(obj).val());
                        }
					</script>
					{/if}

					<li>
						<div class="input-group">
							<span class="input-group-addon"><i class="icon-lock"></i></span>
							<input type="password" class="form-control" value="{lang('enter_password')}" placeholder="{lang('enter_password')}" onfocus="if(this.value=='{lang('enter_password')}') {this.value=''}" onblur="if(this.value=='') this.value='{lang('enter_password')}'" data-errortxt="{lang('enter_password')}" name="password" id="password" tabindex="2">

						</div>
						<div class="blank10"></div>
						<div class="ywz_zhuce_huixian" id='pwdLevel_1'> </div>
						<div class="ywz_zhuce_huixian" id='pwdLevel_2'> </div>
						<div class="ywz_zhuce_huixian" id='pwdLevel_3'> </div>
						<div class="ywz_zhuce_hongxianwenzi"> {lang('weak')}</div>
						<div class="ywz_zhuce_hongxianwenzi"> {lang('middle')}</div>
						<div class="ywz_zhuce_hongxianwenzi"> {lang('strong')}</div>
					</li>
					<li>
						<div class="input-group">
							<span class="input-group-addon"><i class="icon-lock"></i></span>
							<input  type="password" class="form-control" name="pwdconfirm" id="pwdconfirm" value="{lang('enter_againpassword')}" placeholder="{lang('enter_againpassword')}" onfocus="if(this.value=='{lang('enter_againpassword')}') {this.value=''}" onblur="if(this.value=='') this.value='{lang('enter_againpassword')}'" data-errortxt="{lang('enter_againpassword')}" tabindex="3">
						</div>
						<div class="blank10"></div>
						<div class="ywz_zhuce_huixian" id='pwdLevel_4'> </div>
						<div class="ywz_zhuce_huixian" id='pwdLevel_5'> </div>
						<div class="ywz_zhuce_huixian" id='pwdLevel_6'> </div>
						<div class="ywz_zhuce_hongxianwenzi"> {lang('weak')}</div>
						<div class="ywz_zhuce_hongxianwenzi"> {lang('middle')}</div>
						<div class="ywz_zhuce_hongxianwenzi"> {lang('strong')}</div>
					</li>
					<li>
						<div class="input-group">
							<span class="input-group-addon"><i class="icon-envelope"></i></span>
							<input type='text' id="e_mail"  name="e_mail" value="{lang('e_mail')}" class="form-control" onfocus="if(this.value=='{lang('e_mail')}') {this.value=''}" onblur="if(this.value=='') this.value='{lang('e_mail')}'"  placeholder="{lang('e_mail')}" tabindex="4" >
						</div>
					</li>
					{if config::get('invitation_registration')=='1'}<li>
					<div class="input-group">
						<span class="input-group-addon"><i class="icon-credit-card"></i></span>
						<input  placeholder="{lang('invitation_code')}" class="form-control" value="{lang('invitation_code')}" onfocus="if(this.value=='{lang('invitation_code')}') {this.value=''}" onblur="if(this.value=='') this.value='{lang(invitation_code)}'" type='text' id="invite" name="invite" tabindex="4">
					</div>
				</li>{/if}



					<!--
                    //选填
                    <li>
                    <select name="aquestion" onchange="set_question(this.value);" id="aquestion" class="select">
                        <option value="{lang('select_security')}">{lang('select_security')}</option>
                        <option value="{lang('father_was_born')}">{lang('father_was_born')}</option>
                        <option value="{lang('mother_was_born')}">{lang('mother_was_born')}</option>
                        <option value="{lang('elementary_school_name')}">{lang('elementary_school_name')}</option>
                        <option value="{lang('name_in_the_school')}">{lang('name_in_the_school')}</option>
                        <option value="{lang('favorite_sport')}">{lang('favorite_sport')}</option>
                        <option value="{lang('favorite_songs')}">{lang('favorite_songs')}</option>
                        <option value="{lang('favorite_movies')}">{lang('favorite_movies')}</option>
                        <option value="{lang('favorite_color')}" >{lang('favorite_color')}</option>
                        <option value="{lang('custom_questions')}" >{lang('custom_questions')}</option>
                    </select>
                    </li>


                    <div style="display:none;">
                    <input placeholder="" type='text' id="question"  name="question" class="form-control" value="" tabindex="5" class="input" />
                    </div>

                    <li>
                    <div class="input-group">
                    <span class="input-group-addon"><i class="icon-credit-card"></i></span>
                    <input value="" placeholder="{lang('answer')}" class="form-control" type='text' id="answer"  name="answer" tabindex="6" class="input" />
                    </div>
                    </li>
                    -->
					{if !(config::get('mobilechk_enable') && config::get('mobilechk_reg'))}
					{if $telregister}
					<input type="hidden" value="{session::get('user_tel_register')}" name="tel">
					<input type="hidden" value="1" name="telregister">
					{else}
					<li>
						<div class="input-group">
							<div class="input-group-btn">
								<button type="button" class="btn btn1 dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">+86</button>
							</div><!-- /btn-group -->
							<input placeholder="{lang('tel')}" type='text' id="tel"  name="tel" value="{lang('tel')}" onfocus="if(this.value=='{lang('tel')}') {this.value=''}" onblur="if(this.value=='') this.value='{lang('tel')}'" tabindex="3" class="form-control">
						</div><!-- /input-group -->
					</li>
					{/if}
					{/if}

					{if config::get('mobilechk_enable') && config::get('mobilechk_reg') && $telregister !=1 }
					<script src="{$base_url}/common/plugins/mobilechk/mobilechk.js"></script>
					<li>
						<div class="input-group">
							<span class="input-group-addon">&nbsp;&nbsp;<i class="icon-credit-card"></i>&nbsp;</span>
							<input type='text' placeholder="{lang('please_enter_the_phone_verification_code')}" id="mobilenum" name="mobilenum" class="form-control" placeholder="{lang('verifycode')}">
							<span class="input-group-btn">
					<input id="btm_sendMobileCode" onclick="sendMobileCode('{url('tool/smscode')}',$('#tel'));" type="button" value="{lang('send_cell_phone_verification_code')}" class="btn btn2" />
				  </span>
						</div>
					</li>
					{/if}

					<!-- {lang('address')}：
                    <div class="blank10"></div>
                    <input placeholder="{lang('address')}"  type='text' id="address"  name="address" value="" tabindex="3"  class="input" /> -->

					<?php $newcname='cname_'.lang::getistemplate(); ?>
					{loop $field $f}
					<?php
 $name=$f['name'];
 if(!preg_match('/^my_/',$name)) {
 unset($field[$name]);
 continue;
}
if(!setting::$var['user'][$name]['showinreg']) {
  continue;
 }

 ?>
					<li>
						<div class="input-group">
							<span class="input-group-addon"><?php echo setting::$var['user'][$name][$newcname]; ?></span>
							<?php echo form::getform($name,setting::$var['user'],$field,array()); ?>
					</li>
					{/loop}


					{if config::get('verifycode')=='1'}
					<li>
						<div class="input-group">
							<div class="input-group-btn">
								<button type="button" class="btn btn1 dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="padding:0px;">{verify()}</button>
							</div><!-- /btn-group -->
							<input type='text' id="verify"  tabindex="3"  name="verify" class="form-control" value="{lang('please_enter_code')}" placeholder="{lang('please_enter_code')}" onfocus="if(this.value=='{lang('please_enter_code')}') {this.value=''}" onblur="if(this.value=='') this.value='{lang('please_enter_code')}'" data-errortxt="{lang('please_enter_code')}">
						</div>
					</li>
					{/if}
					{if config::get('verifycode')=='2'}
					<li>
						<div id="verifycode_embed"></div>
					</li>
					<script src="http://api.geetest.com/get.php"></script>
					<script>
                        var loadGeetest = function(config) {
                            window.gt_captcha_obj = new window.Geetest({
                                gt : config.gt,
                                challenge : config.challenge,
                                product : 'float',
                                offline : !config.success
                            });
                            gt_captcha_obj.appendTo("#verifycode_embed");
                        };

                        $.ajax({
                            url : '{url('tool/geetest')}',
                            type : "get",
                            dataType : 'JSON',
                            success : function(result) {
                            //console.log(result);
                            loadGeetest(result)
                        }
                        });
					</script>
					{/if}


					{else}
					<div class="blank10"></div>
					<div class="alert alert-danger" role="alert"><span class="glyphicon glyphicon-warning-sign"></span> {lang('tips')}：{lang('sitecloseregister')}</div>


					{/if}


					<li>
						<input id="reg" type="submit" name="submit" value="{if $telregister}
				{lang('sure')}
				{else}
				{lang('register')}
				{/if} " class="btn btn4" />
					</li>
					<li>
						<p><span class="pull-right"name="btn_login"><a href="{url('user/getpass')}">{lang('findpassword')}</a></span>{lang('existing_accounts')},<a href="{url('user/login')}">{lang('log_in_immediately')}</a></p>
					</li>
					{if $ologinlist}
					<li class="othre-loak text-center">
						<h5>{lang('other_ways_of_landing')}</h5>
						<br />

						{loop $ologinlist $ologin}
						{if $ologin[enabled]==1}

						<a target="_blank" href="<?php echo url('user/ologin/logtype/'.$ologin[ologin_code]);?>"><img src="{$base_url}/images/{$ologin[ologin_code]}.png" border="0" class="fl" /></a>&nbsp;&nbsp;
						{/if}
						{/loop}


					</li>{/if}
				</ul>

			</form>
		</div>

		<div class="copyright">{get('site_right')} <a title="{get('sitename')}" href="{$base_url}/">{get('sitename')}</a>. {getCopyRight()}</div>
	</div>
</div>


<script>
    var register=false;
    function setdx(obj){
        /*if ($("[name='register']").css("display")=='none'){
            $(obj).html("<span class='icon-screen-desktop'></span>");
            $("[name='dxdl']").attr("style","display: block");
            register=true;
        }else{
            $(obj).html("<span class='glyphicon glyphicon-barcode'></span>");
            document.getElementById("loginform").action='<?php echo url("user/register/sjregister/1") ?>';
            $("[name='register']").attr("style","display:none ");
            register=false;
        };*/
        window.location.href = '<?php echo url("user/login/tellogin/1") ?>';
    }
</script>

<script type="text/javascript">
    $('#password').focus(function () {
        $('#pwdLevel_1').attr('class', 'ywz_zhuce_hongxian');
        $('#password').keyup();
    });


    $('#password').keyup(function () {
        var __th = $(this);

        if (!__th.val()) {
            $('#pwd_tip').hide();
            $('#pwd_err').show();
            Primary(1);
            return;
        }
        if (__th.val().length < 6) {
            $('#pwd_tip').hide();
            $('#pwd_err').show();
            Weak(1);
            return;
        }
        var _r = checkPassword(__th);
        if (_r < 1) {
            $('#pwd_tip').hide();
            $('#pwd_err').show();
            Primary(1);
            return;
        }

        if (_r > 0 && _r < 2) {
            Weak(1);
        } else if (_r >= 2 && _r < 4) {
            Medium(1);
        } else if (_r >= 4) {
            Tough(1);
        }

        $('#pwd_tip').hide();
        $('#pwd_err').hide();
    });


    $('#pwdconfirm').focus(function () {
        $('#pwdLevel_4').attr('class', 'ywz_zhuce_hongxian');
        $('#password').keyup();
    });


    $('#pwdconfirm').keyup(function () {
        var __th = $(this);

        if (!__th.val()) {
            $('#pwd_tip').hide();
            $('#pwd_err').show();
            Primary(4);
            return;
        }
        if (__th.val().length < 6) {
            $('#pwd_tip').hide();
            $('#pwd_err').show();
            Weak(4);
            return;
        }
        var _r = checkPassword(__th);
        if (_r < 1) {
            $('#pwd_tip').hide();
            $('#pwd_err').show();
            Primary(4);
            return;
        }

        if (_r > 0 && _r < 2) {
            Weak(4);
        } else if (_r >= 2 && _r < 4) {
            Medium(4);
        } else if (_r >= 4) {
            Tough(4);
        }

        $('#pwd_tip').hide();
        $('#pwd_err').hide();
    });


    function Primary(id) {
        if(id==''){
            id=1;
        }
        $('#pwdLevel_'+id).attr('class', 'ywz_zhuce_huixian');
        $('#pwdLevel_'+(id+1)).attr('class', 'ywz_zhuce_huixian');
        $('#pwdLevel_'+(id+2)).attr('class', 'ywz_zhuce_huixian');
    }


    function Weak(id) {
        if(id==''){
            id=1;
        }
        $('#pwdLevel_'+id).attr('class', 'ywz_zhuce_hongxian');
        $('#pwdLevel_'+(id+1)).attr('class', 'ywz_zhuce_huixian');
        $('#pwdLevel_'+(id+2)).attr('class', 'ywz_zhuce_huixian');
    }

    function Medium(id) {
        if(id==''){
            id=1;
        }
        $('#pwdLevel_'+id).attr('class', 'ywz_zhuce_hongxian');
        $('#pwdLevel_'+(id+1)).attr('class', 'ywz_zhuce_hongxian2');
        $('#pwdLevel_'+(id+2)).attr('class', 'ywz_zhuce_huixian');
    }

    function Tough(id) {
        if(id==''){
            id=1;
        }
        $('#pwdLevel_'+id).attr('class', 'ywz_zhuce_hongxian');
        $('#pwdLevel_'+(id+1)).attr('class', 'ywz_zhuce_hongxian2');
        $('#pwdLevel_'+(id+2)).attr('class', 'ywz_zhuce_hongxian3');
    }




    function checkPassword(pwdinput) {
        var maths, smalls, bigs, corps, cat, num;
        var str = $(pwdinput).val()
        var len = str.length;

        var cat = /.{16}/g
        if (len == 0) return 1;
        if (len > 16) { $(pwdinput).val(str.match(cat)[0]); }
        cat = /.*[\u4e00-\u9fa5]+.*$/
        if (cat.test(str)) {
            return -1;
        }
        cat = /\d/;
        var maths = cat.test(str);
        cat = /[a-z]/;
        var smalls = cat.test(str);
        cat = /[A-Z]/;
        var bigs = cat.test(str);
        var corps = corpses(pwdinput);
        var num = maths + smalls + bigs + corps;

        if (len < 6) { return 1; }

        if (len >= 6 && len <= 8) {
            if (num == 1) return 1;
            if (num == 2 || num == 3) return 2;
            if (num == 4) return 3;
        }

        if (len > 8 && len <= 11) {
            if (num == 1) return 2;
            if (num == 2) return 3;
            if (num == 3) return 4;
            if (num == 4) return 5;
        }

        if (len > 11) {
            if (num == 1) return 3;
            if (num == 2) return 4;
            if (num > 2) return 5;
        }
    }

    function corpses(pwdinput) {
        var cat = /./g
        var str = $(pwdinput).val();
        var sz = str.match(cat)
        for (var i = 0; i < sz.length; i++) {
            cat = /\d/;
            maths_01 = cat.test(sz[i]);
            cat = /[a-z]/;
            smalls_01 = cat.test(sz[i]);
            cat = /[A-Z]/;
            bigs_01 = cat.test(sz[i]);
            if (!maths_01 && !smalls_01 && !bigs_01) { return true; }
        }
        return false;
    }
</script>
<script language="javascript">
    $(function() {
        if (window.PIE) {
            $('.rounded').each(function() {
                PIE.attach(this);
            });
        }
    });
</script>


<script type="text/javascript" LANGUAGE="javascript">
    function checkEmail(e_mail) {
        //对电子邮件的验证
        var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
        return myreg.test('e_mail');
    }



    function check()
    {
        if (document.login_form.pwdconfirm.value!=document.login_form.password.value)
        {
            alert("{lang('twicepassnosame')}")
            document.login_form.password.value = ""
            document.login_form.pwdconfirm.value = ""
            document.login_form.password.focus();
            document.login_form.password.select();
            return false
        }

        if(document.login_form.username.value.length==0){
            alert("{lang('please_enter_your_user_name')}");
            document.login_form.username.focus();
            return false;
        }

        if(document.login_form.password.value.length==0){
            alert("{lang('please_set_a_password')}");
            document.login_form.password.focus();
            return false;
        }

        if(document.login_form.password2.value.length==0){
            alert("{lang('enter_confirm_password')}");
            document.login_form.password2.focus();
            return false;
        }

        {if config::get('invitation_registration')=='1'}
        if(document.login_form.invite.value.length==0){
            alert("{lang('enter_invitation_code')}");
            document.login_form.invite.focus();
            return false;
        }
        {/if}


            if(document.login_form.aquestion.value.length==0){
                alert("{lang('set_security')}");
                document.login_form.aquestion.focus();
                return false;
            }

            if(document.login_form.question.value.length==0){
                alert("{lang('please_set_the_security_answer')}");
                document.login_form.question.focus();
                return false;
            }

            if(document.login_form.answer.value.length==0){
                alert("{lang('please_enter_the_custom_security_answer')}");
                document.login_form.answer.focus();
                return false;
            }

            if(document.login_form.tel.value.length==0){
                alert("{lang('p_m_content')}");
                document.login_form.tel.focus();
                return false;
            }

            if(!isMobile(document.login_form.tel.value)){
                alert("{lang('please_enter_the_correct_telephone_number')}");
                document.login_form.tel.focus();
                return false;
            }

            if( document.login_form.pwdconfirm.value !=  document.login_form.password.value ){
                alert("{lang('two_password_input_inconsistencies')}");
                return false;
            }


            if(!checkEmail(document.login_form.e_mail.value)){
                alert("{lang('please_enter_the_correct_mailbox')}");
                document.login_form.e_mail.focus();
                return false;
            }



            {if config::get('mobilechk_enable') && config::get('mobilechk_reg')}
            if(document.login_form.mobilenum.value.length==0){
                alert("{lang('cell_phone_parity_error')}");
                document.login_form.mobilenum.focus();
                return false;
            }
            {/if}

                if(document.login_form.verify.value.length==0){
                    alert("{lang('enter_verifycode')}!");
                    document.login_form.verify.focus();
                    return false;
                }
                return true;
            }
            function set_question(value)
            {
                document.getElementById("question").value=value;
                document.getElementById("question").focus();
            }
</script>
<script type="text/javascript">
    <!--

    var JPlaceHolder = {
        //检测
        _check : function(){
            return 'placeholder' in document.createElement('input');
        },
        //初始化
        init : function(){
            if(!this._check()){
                this.fix();
            }
        },
        //修复
        fix : function(){
            jQuery(':input[placeholder]').each(function(index, element) {
                var self = $(this), txt = self.attr('placeholder');
                self.wrap($('<div></div>').css({position:'relative', zoom:'1', border:'none', background:'none', padding:'none', margin:'none'}));
                var pos = self.position(), h = self.outerHeight(true), paddingleft = self.css('padding-left');
                var holder = $('<span></span>').text(txt).css({position:'absolute', left:pos.left, top:pos.top, height:h, lienHeight:h, paddingLeft:paddingleft, color:'#aaa'}).appendTo(self.parent());
                self.focusin(function(e) {
                    holder.hide();
                }).focusout(function(e) {
                    if(!self.val()){
                        holder.show();
                    }
                });
                holder.click(function(e) {
                    holder.hide();
                    self.focus();
                });
            });
        }
    };
    //执行
    jQuery(function(){
        JPlaceHolder.init();
    });
    //-->
</script>
<!-- Bootstrap Js -->
<script src="{$base_url}/common/css/bootstrap/bootstrap-3.3.7/js/bootstrap.min.js"></script>


</body>
</html>