<commit_before><?php
namespace Views\Controller;

use Think\Controller;

class LoginController extends Controller
{

    //注册页面
    public function register()
    {
        $this->display();
    }


    public function index($channel){
        $this->display();
    }

    public function send_code()
    {
        $phone = I("post.phone");
        $code = "";
        $code .= rand(0, 9);
        $code .= rand(0, 9);
        $code .= rand(0, 9);
        $code .= rand(0, 9);
        sendCode($phone, $code);
        session('randomCode', $code);
        session('phone', $phone);
    }


    //注册表单体检处理页面
    public function register_do()
    {
        if (IS_POST) {

            $code = $_SESSION['randomCode'];
            $phone = $_SESSION['phone'];


            $clients['name'] = I('post.phone');
            $clients['channel']=I('post.channel');
            $clients['phone'] = I('post.phone', '', 'strip_tags');
            $clients['pswd'] = I('post.password', '', 'strip_tags');
            $clients['type'] = I('post.role_name');
            $clients['remark']='normal';
            $input_code = I('post.verification', '', 'strip_tags');


            if ($clients['phone'] == $phone) {
                if ($input_code == $code) {
                    $res = D('ClientsKMW')->add($clients);
//                    dump($clients);
//                    echo 'add result: ' . $res;
                    if ($res) {
                        $result = sentToRemote($clients);
                        if ($result) {
                            $this->clearSession();
                            //设置成功后跳转页面的地址，默认的返回页面是$_SERVER['HTTP_REFERER']
                            $this->success('注册成功，正在前往下载', 'after_success', 3);
//                            dump($result);
                        } else {
                            //更新刚才插入的数据，将remark值更新
                            $register=D('ClientsKMW');
                            $update['remark']='kmw_fail';
                            $register->where('name='.$clients['name'].' AND pswd='.$clients['pswd'])->save($update);
                            //错误页面的默认跳转页面是返回前一页，通常不需要设置<commit_msg>fix check remote response's success.<commit_after><?php
namespace Views\Controller;

use Think\Controller;

class LoginController extends Controller
{

    //注册页面
    public function register()
    {
        $this->display();
    }


    public function index($channel){
        $this->display();
    }

    public function send_code()
    {
        $phone = I("post.phone");
        $code = "";
        $code .= rand(0, 9);
        $code .= rand(0, 9);
        $code .= rand(0, 9);
        $code .= rand(0, 9);
        sendCode($phone, $code);
        session('randomCode', $code);
        session('phone', $phone);
    }


    //注册表单体检处理页面
    public function register_do()
    {
        if (IS_POST) {

            $code = $_SESSION['randomCode'];
            $phone = $_SESSION['phone'];


            $clients['name'] = I('post.phone');
            $clients['channel']=I('post.channel');
            $clients['phone'] = I('post.phone', '', 'strip_tags');
            $clients['pswd'] = I('post.password', '', 'strip_tags');
            $clients['type'] = I('post.role_name');
            $clients['remark']='normal';
            $input_code = I('post.verification', '', 'strip_tags');


            if ($clients['phone'] == $phone) {
                if ($input_code == $code) {
                    $res = D('ClientsKMW')->add($clients);
//                    dump($clients);
//                    echo 'add result: ' . $res;
                    if ($res) {
                        $result = sentToRemote($clients);
                        if ($result&&$result['data']) {
                            $this->clearSession();
                            //设置成功后跳转页面的地址，默认的返回页面是$_SERVER['HTTP_REFERER']
                            $this->success('注册成功，正在前往下载', 'after_success', 3);
//                            dump($result);
                        } else {
                            //更新刚才插入的数据，将remark值更新
                            $register=D('ClientsKMW');
                            $update['remark']='kmw_fail';
                            $register->where('name='.$clients['name'].' AND pswd='.$clients['pswd'])->save($update);
                            //错误页面的默认跳转页面是返回前一页，通常不需要设置
{'fraction_non_alphanumeric': 0.1684283088235294, 'fraction_numerical': 0.004136029411764706, 'mean_word_length': 1.4845890410958904, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2887083', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1340, 'n_words': 203}