常见问题

升级问题

使用环境:在首页或其他页面进行注册或登录功能


一、登录功能

<form class="content" id="loginform" method="post" novalidate="novalidate">
    {dr_form_hidden()}
    <div class="form-group">
        <div class="input-icon">
            <i class="fa fa-user"></i>
            <input class="form-control placeholder-no-fix" type="text" autocomplete="off" placeholder="账号/邮箱/手机" name="data[username]">
        </div>
    </div>
    <div class="form-group">
        <div class="input-icon">
            <i class="fa fa-lock"></i>
            <input class="form-control placeholder-no-fix" type="password" autocomplete="off" placeholder="登录密码" name="data[password]">
        </div>
    </div>
    {if $ci->member_cache['login']['code']}
    <div class="form-group">
        <div class="input-group login-code">
            <div class="input-icon">
                <i class="fa fa-code"></i>
                <input class="form-control placeholder-no-fix" type="text" autocomplete="off" placeholder="验证码" name="code">
            </div>
            <div class="input-group-btn fc-code">
                {dr_code(120, 35)}
            </div>
        </div>
    </div>
    {/if}
    <div class="form-actions">
        <label class="rememberme mt-checkbox mt-checkbox-outline">
            <input type="checkbox" name="remember" value="1"> 记住登录
            <span></span>
        </label>
        <button type="button" onclick="dr_ajax_member('{dr_member_url('login/index')}', 'loginform');" class="btn green pull-right"> 登录 </button>
    </div>
</form>


二、注册代码

{php $register=$ci->member_cache['register'];}
<form action="" class="form-horizontal form" method="post" name="regform" id="regform">
    {dr_form_hidden()}
    <div class="form-body">

        {if in_array('username', $register.field)}
        <div class="form-group" id="dr_row_username">
            <label class="col-md-2 control-label">账号</label>
            <div class="col-md-10">
                <input type="text" class="form-control " name="data[username]" id="dr_username">
            </div>
        </div>
        {/if}
        {if in_array('email', $register.field)}
        <div class="form-group " id="dr_row_email">
            <label class="col-md-2 control-label">邮箱</label>
            <div class="col-md-10">
                <input type="text" class="form-control " name="data[email]" id="dr_email">
            </div>
        </div>
        {/if}
        {if in_array('phone', $register.field)}
        <div class="form-group " id="dr_row_phone">
            <label class="col-md-2 control-label">手机号</label>
            <div class="col-md-10">
                <input type="text" class="form-control " name="data[phone]" id="dr_phone">
            </div>
        </div>
        {/if}
        {if in_array('name', $register.field)}
        <div class="form-group " id="dr_row_name">
            <label class="col-md-2 control-label">姓名</label>
            <div class="col-md-9">
                <label><input type="text" class="form-control input-large" name="data[name]" id="dr_name"></label>
            </div>
        </div>
        {/if}
        <div class="form-group " id="dr_row_password">
            <label class="col-md-2 control-label">密码</label>
            <div class="col-md-10">
                <input type="password" class="form-control " name="data[password]" id="dr_password">
            </div>
        </div>
        <div class="form-group " id="dr_row_password2">
            <label class="col-md-2 control-label">确认密码</label>
            <div class="col-md-10">
                <input type="password" class="form-control " name="data[password2]" id="dr_password2">
            </div>
        </div>
        {if $register.sms}
        <div class="form-group" id="dr_row_sms">
            <label class="col-md-2 control-label">短信验证</label>
            <div class="col-md-10">
                <div class="input-group input-large">
                    <input class="form-control placeholder-no-fix" type="text" autocomplete="off" id="dr_sms" name="sms">
                    <div class="input-group-btn">
                        <button class="btn blue" onclick="dr_ajax_url('/index.php?s=member&c=api&m=register_code&id='+$('#dr_phone').val()+'&code='+$('#dr_code').val())" type="button">获取手机验证码</button>
                    </div>
                </div>
            </div>
        </div>
        {/if}
        {if $register.sms || $register.code}
        <div class="form-group" id="dr_row_code">
            <label class="col-md-2 control-label">验证码</label>
            <div class="col-md-10">
                <div class="input-group input-large">
                    <input class="form-control placeholder-no-fix" type="text" autocomplete="off" id="dr_code" name="code">
                    <div class="input-group-btn fc-code">
                        {dr_code(120, 35)}
                    </div>
                </div>
            </div>
        </div>
        {/if}
        <div class="form-group" style="margin-top:30px">
            <button type="button" onclick="dr_ajax_submit('{dr_member_url('register/index')}', 'regform', '2000')" class=" btn red btn-block"> 立即注册 </button>
        </div>

        <div class="form-group" style="margin-top:30px">
            <label class="mt-checkbox mt-checkbox-outline" style="margin-left:20px;">
                <input type="checkbox" name="is_protocol" value="1" checked> 我已阅读并同意
                <span></span>
            </label>
            <label>
                <a href="javascript:dr_show_protocol();">《用户注册协议》</a>
            </label>
        </div>
    </div>
</form>


三、如果注册其他用户组怎么办改?

只需要改变一下注册按钮参数

  <div class="form-group" style="margin-top:30px">
            <button type="button" onclick="dr_ajax_submit('{dr_member_url('register/index', ['groupid' => 8888888])}', 'regform', '2000')" class=" btn red btn-block"> 立即注册 </button>
        </div>
8888888就改成你要注册的用户组id号