Jonlin hace 6 años
padre
commit
d6774b7cb8

+ 7 - 0
application/user/controller/Register.php

@@ -28,6 +28,13 @@ class Register extends Controller
             $confirm_password = input('post.confirm_password');
             $user_phone = input('post.user_phone');
             $captcha = input('post.captcha');
+            $ch_box = input('post.ch_box');
+
+            //验证是否勾选协议
+            if ($ch_box == false) {
+                //验证失败
+                $this->error('未勾选协议');
+            }
 
             //验证密码
             if ($user_password != $confirm_password) {

+ 1 - 1
application/user/view/register/index.html

@@ -84,7 +84,7 @@
                     <input type="text" name="captcha" placeholder="{:lang('login_captcha')}" required class="text" style="width:60%;float:left;">
                     <img src="{:captcha_src()}" style="width:30%;height:38px;" id="change_captcha"/>
                 </div>
-                <input type="checkbox" id="ch_box" onclick="c_box()" /><span>我已阅读并同意
+                <input type="checkbox" name="ch_box" id="ch_box" onclick="c_box()" /><span>我已阅读并同意
                 <a href="xieyi.html" target="_blank">《用户协议》</a>及<a href="xieyi.html" target="_blank">《法律声明及隐私条款》</a></span><br><br>
                 <div class="form-group">
                     <input type="submit" class="layui-btn" id="layui-btn" value="{:lang('register_sumbit')}" lay-submit lay-filter="login"/>