彩票计划

  • <tr id='uPAta3'><strong id='uPAta3'></strong><small id='uPAta3'></small><button id='uPAta3'></button><li id='uPAta3'><noscript id='uPAta3'><big id='uPAta3'></big><dt id='uPAta3'></dt></noscript></li></tr><ol id='uPAta3'><option id='uPAta3'><table id='uPAta3'><blockquote id='uPAta3'><tbody id='uPAta3'></tbody></blockquote></table></option></ol><u id='uPAta3'></u><kbd id='uPAta3'><kbd id='uPAta3'></kbd></kbd>

    <code id='uPAta3'><strong id='uPAta3'></strong></code>

    <fieldset id='uPAta3'></fieldset>
          <span id='uPAta3'></span>

              <ins id='uPAta3'></ins>
              <acronym id='uPAta3'><em id='uPAta3'></em><td id='uPAta3'><div id='uPAta3'></div></td></acronym><address id='uPAta3'><big id='uPAta3'><big id='uPAta3'></big><legend id='uPAta3'></legend></big></address>

              <i id='uPAta3'><div id='uPAta3'><ins id='uPAta3'></ins></div></i>
              <i id='uPAta3'></i>
            1. <dl id='uPAta3'></dl>
              1. <blockquote id='uPAta3'><q id='uPAta3'><noscript id='uPAta3'></noscript><dt id='uPAta3'></dt></q></blockquote><noframes id='uPAta3'><i id='uPAta3'></i>

                待发短信

                在线客服
                产品支持 短信宝客服
                合作渠道 渠道合作
                服务咨询

                4001-021-502

                工作时间

                9:00-21:00

                PbootCMS_V3.1.2注册模块新增短信宝短信接口

                PbootCMS是全新内核且永久开源免费的PHP企业网站开发建设管理系统,是一套高效、简洁、 强悍的可免费商用的PHP CMS源码,能够满足各类企ξ 业网站开发建设的需要。系统采用简单到想哭的模板标签,只要懂HTML就可快速开发企业网站。小编对他还是比较了解的,今天小编就以新增短信接口为例,给大家讲解一下如何进行二次开发,我们今天讲解的是v3.1.2版本,使用的短信接口是我们短信宝短信群发平台的短信接口,我们短信宝短信群发平≡台的接口非常稳定,发送速度快,注册就送测试短信,推荐大家使用
                1:打开项目:apps\admin\view\default\system\config.html 增加短♂信设置页面

                1
                2
                3
                4
                5
                6
                7
                8
                9
                10
                11
                12
                13
                14
                15
                16
                17
                18
                19
                20
                21
                22
                23
                24
                25
                26
                27
                28
                29
                30
                31
                <div class="layui-tab-item">
                                <form action="{url./admin/Config/index}" method="post" class="layui-form">
                                    <input type="hidden" name="formcheck" value="{$formcheck}" >
                 
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">是否开启</label>
                                        <div class="layui-input-block">
                                            <input type="radio" name="sms_status" value="1" {if([$configs.sms_status.value]==1)} checked="checked" {/if} title="是">
                                            <input type="radio" name="sms_status" value="0" {if([$configs.sms_status.value]==0)} checked="checked" {/if} title="否">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">短信宝账号</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="sms_account"  value="{$configs.sms_account.value}" placeholder="请输入短信宝账号" class="layui-input">
                                        </div>
                                    </div>
                 
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">短信宝密码</label>
                                        <div class="layui-input-inline">
                                            <input type="password" name="sms_pwd" value="{$configs.sms_pwd.value}" placeholder="请输入短信宝密码" class="layui-input">
                                        </div>
                                    </div>
                 
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">短信宝签名</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="sms_signid"  value="{$configs.sms_signid.value}" placeholder="请输入短信宝签名" class="layui-input">
                                        </div>
                                    </div>

                2:打开相同项目:apps\admin\view\default\system\config.html 修改〓大概在707行

                1
                2
                3
                4
                5
                6
                7
                8
                9
                <div class="layui-form-item">
                        <label class="layui-form-label">会员注册验证码</label>
                        <div class="layui-input-block">
                            <input type="radio" name="register_check_code" value="0" {if([$configs.register_check_code.value]=='0')} checked="checked" {/if} title="禁用">
                            <input type="radio" name="register_check_code" value="1" {if([$configs.register_check_code.value]=='1'||[$configs.register_check_code.value]=='')} checked="checked" {/if} title="普通验证码">
                            <input type="radio" name="register_check_code" value="2" {if([$configs.register_check_code.value]=='2')} checked="checked" {/if} title="邮箱验证码">
                             <input type="radio" name="register_check_code" value="3" {if([$configs.register_check_code.value]=='3')} checked="checked" {/if} title="短信验▲证码">
                        </div>
                    </div>

                3:打开项目:apps\admin\controller\system\ConfigController.php 修改保存方法

                1
                2
                3
                4
                5
                6
                7
                8
                9
                10
                11
                12
                13
                14
                15
                16
                17
                18
                19
                20
                21
                22
                23
                24
                25
                26
                27
                28
                29
                30
                31
                32
                33
                34
                35
                36
                37
                38
                39
                40
                41
                42
                43
                44
                45
                46
                47
                48
                49
                50
                51
                52
                53
                54
                55
                56
                57
                58
                59
                60
                61
                62
                63
                64
                65
                66
                67
                68
                69
                70
                71
                72
                73
                74
                75
                76
                77
                78
                79
                80
                81
                82
                83
                84
                85
                86
                87
                88
                89
                90
                91
                92
                93
                94
                95
                96
                public function index()
                    {
                        if (! ! $action = get('action')) {
                            switch ($action) {
                                case 'sendemail':
                                    $rs = sendmail($this->config(), get('to'), '【' . CMSNAME . '】测试邮件''欢迎您使用' . CMSNAME . '网站开发管理系统!');
                                    if ($rs === true) {
                                        alert_back('测试邮件发送成功!');
                                    else {
                                        error('发送失败:' . $rs);
                                    }
                                    break;
                            }
                        }
                         
                        // 修改参数配置
                        if ($_POST) {
                            unset($_POST['upload']); // 去除上传组件
                            foreach ($_POST as $key => $value) {
                                if (! preg_match('/^[\w\-]+$/', $key)) {
                                    continue;
                                }
                                $config = array(
                                    'debug',
                                    'sn',
                                    'sn_user',
                                    'pagenum',
                                    'tpl_html_cache',
                                    'tpl_html_cache_time',
                                    'session_in_sitepath'
                                );
                                if (in_array($key, $config)) {
                                    if ($key == 'tpl_html_cache_time' && ! $value) {
                                        $value = 900;
                                    else {
                                        $value = post($key);
                                    }
                                    $this->modConfig($key, $value);
                                else {
                                    $this->modDbConfig($key);
                                }
                            }
                             
                            $this->log('修改参数配置成功!');
                            path_delete(RUN_PATH . '/config'); // 清理缓存的配置文件
                             
                            switch (post('submit')) {
                                case 'email':
                                    success('修改成功!', url('/admin/Config/index' . get_tab('t2'), false));
                                    break;
                                case 'baidu':
                                    success('修改成功!', url('/admin/Config/index' . get_tab('t3'), false));
                                    break;
                                case 'api':
                                    success('修改成功!', url('/admin/Config/index' . get_tab('t4'), false));
                                    break;
                                case 'watermark':
                                    success('修改成功!', url('/admin/Config/index' . get_tab('t5'), false));
                                    break;
                                case 'security':
                                    success('修改成功!', url('/admin/Config/index' . get_tab('t6'), false));
                                    break;
                                case 'urlrule':
                                    success('修改成功!', url('/admin/Config/index' . get_tab('t7'), false));
                                    break;
                                case 'pagetitle':
                                    success('修改成功!', url('/admin/Config/index' . get_tab('t8'), false));
                                    break;
                                case 'member':
                                    success('修改成功!', url('/admin/Config/index' . get_tab('t9'), false));
                                    break;
                                case 'upgrade':
                                    success('修改成功!', url('/admin/Upgrade/index' . get_tab('t2'), false));
                                    break;
                                case 'sms':
                                    success('修改成功!', url('/admin/Config/index' . get_tab('t10'), false));
                                    break;
                                default:
                                    success('修改成功!', url('/admin/Config/index'false));
                            }
                        }
                        $configs = $this->model->getList();
                        $configs['debug']['value'] = $this->config('debug');
                        $configs['sn']['value'] = $this->config('sn');
                        $configs['sn_user']['value'] = $this->config('sn_user');
                        $configs['session_in_sitepath']['value'] = $this->config('session_in_sitepath');
                        $configs['pagenum']['value'] = $this->config('pagenum');
                        $configs['url_type']['value'] = $this->config('url_type');
                        $configs['tpl_html_cache']['value'] = $this->config('tpl_html_cache');
                        $configs['tpl_html_cache_time']['value'] = $this->config('tpl_html_cache_time');
                        $this->assign('configs', $configs);
                         
                        $this->assign('groups', model('admin.member.MemberGroup')->getSelect());
                         
                        $this->display('system/config.html');
                    }

                4:打开项目:apps\home\controller\ParserController.php 修改大概143行

                1
                2
                3
                4
                5
                6
                7
                8
                9
                10
                11
                12
                13
                14
                15
                16
                17
                18
                19
                20
                21
                22
                23
                24
                25
                26
                27
                28
                29
                30
                31
                32
                33
                34
                35
                36
                37
                38
                39
                40
                41
                42
                43
                44
                45
                46
                47
                48
                49
                50
                51
                52
                53
                54
                55
                56
                57
                58
                59
                60
                61
                62
                63
                64
                65
                66
                67
                68
                69
                70
                71
                72
                73
                74
                75
                76
                77
                78
                79
                80
                81
                  public function parserSingleLabel($content)
                    {
                        $content = str_replace('{pboot:ucenter}', Url::home('member/ucenter'), $content); // 用户中心
                        if (! ! $url = get("backurl")) { // 获取会跳地址
                            $content = str_replace('{pboot:login}', Url::home('member/login'null"backurl=" . urlencode($url)), $content); // 登录地址
                        else {
                            $content = str_replace('{pboot:login}', Url::home('member/login'), $content); // 登录地址
                        }
                         
                        $content = str_replace('{pboot:register}', Url::home('member/register'), $content); // 注册地址
                        $content = str_replace('{pboot:isregister}', Url::home('member/isRegister'), $content); // 检查是否注册地址
                        $content = str_replace('{pboot:umodify}', Url::home('member/umodify'), $content); // 修改资料地址
                        $content = str_replace('{pboot:logout}', Url::home('member/logout'), $content); // 推出登录
                        $content = str_replace('{pboot:upload}', Url::home('member/upload'), $content); // 上传资料
                         
                        if (strpos($content, '{pboot:sendemail}')) {
                            session('sendemail'true); // 避免非法外部提交
                            $content = str_replace('{pboot:sendemail}', Url::home('member/sendEmail'), $content); // 上传资料
                        else {
                            session('sendemail'false);
                        }
                 
                        if (strpos($content, '{pboot:sendsms}')) {
                            session('sendsms'true); // 避免非法外部提交
                            $content = str_replace('{pboot:sendsms}', Url::home('member/sendSms'), $content); // 发送短信
                        else {
                            session('sendsms'false);
                        }
                 
                 
                 
                        $content = str_replace('{pboot:islogin}', session('pboot_uid') ? 1 : 0, $content); // 是否登录
                        if (strpos($content, '{pboot:mustlogin}') !== false) {
                            $content = str_replace('{pboot:mustlogin}''', $content);
                            if (! session('pboot_uid')) { // 没有经登录
                                if ($this->config('login_no_wait')) {
                                    location(Url::home('member/login'null"backurl=" . urlencode(get_current_url())));
                                else {
                                    error('您的权限不足,无法浏览本页面!', Url::home('member/login'null"backurl=" . urlencode(get_current_url())));
                                }
                            }
                        }
                         
                        $content = str_replace('{pboot:msgaction}', Url::home('message'), $content); // 留言提交路径
                        $content = str_replace('{pboot:scaction}', Url::home('search'), $content); // 搜索提↑交路径
                        $content = str_replace('{pboot:msgcodestatus}', $this->config('message_check_code') === '0' ? 0 : 1, $content); // 是否开留言启验证码
                        $content = str_replace('{pboot:formcodestatus}', $this->config('form_check_code') === '0' ? 0 : 1, $content); // 是否开启表单验证码
                         
                        $content = str_replace('{pboot:checkcode}', CORE_DIR . '/code.php', $content); // 验证码路径
                        $content = str_replace('{pboot:lgpath}', Url::get('home/Do/area'), $content); // 多语言切换前置路径,如{pboot:lgpath}?lg=cn
                         
                        $content = str_replace('{pboot:appid}', $this->config('api_appid'), $content); // API认证用户
                        $content = str_replace('{pboot:timestamp}', time(), $content); // 认证」时间戳
                        $content = str_replace('{pboot:signature}', md5(md5($this->config('api_appid') . $this->config('api_secret') . time())), $content); // API认证密钥
                         
                        $content = str_replace('{pboot:httpurl}', get_http_url(), $content); // 当前访问的域名地址
                        $content = str_replace('{pboot:pageurl}', get_current_url(), $content); // 当前页面的地址
                         
                        $content = str_replace('{pboot:registercodestatus}', $this->config('register_check_code') === '0' ? 0 : ($this->config('register_check_code') ?: 1), $content); // 是否开启注册验证码
                        $content = str_replace('{pboot:logincodestatus}', $this->config('login_check_code') === '0' ? 0 : 1, $content); // 是否开启评论验证码
                        $content = str_replace('{pboot:commentcodestatus}', $this->config('comment_check_code') === '0' ? 0 : 1, $content); // 是否开启评论验证码
                        $content = str_replace('{pboot:commentaction}', Url::home('comment/add'null"contentid={content:id}"), $content); // 评论提交路径
                        $content = str_replace('{pboot:mycommentpage}', Url::home('comment/my'), $content); // 我的评论
                         
                        $content = str_replace('{pboot:registerstatus}', $this->config('register_status') === '0' ? 0 : 1, $content); // 是否开启注册
                        $content = str_replace('{pboot:loginstatus}', $this->config('login_status') === '0' ? 0 : 1, $content); // 是否开启登录
                        $content = str_replace('{pboot:commentstatus}', $this->config('comment_status') === '0' ? 0 : 1, $content); // 是否开启评论
                                                                                                                                     
                        // 记录蜘蛛爬行
                        if ($this->config('spiderlog') !== '0') {
                            if ($this->config('tpl_html_cache')) { // 缓存时插入script,否则直接执行
                                $spidercode = "<script src='" . Url::home('Spider', null, 'url=' . URL) . "' async='async'></script>";
                                $content = preg_replace('/(<\/body>)/i', $spidercode . "\n$1", $content);
                            else {
                                $spider = new SpiderController(URL);
                                $spider->index();
                            }
                        }
                         
                        return $content;
                    }

                5:打开项目:template\default\html\member\register.html 修改注册页面

                1
                2
                3
                4
                5
                6
                7
                8
                9
                10
                11
                12
                13
                14
                15
                16
                17
                18
                19
                20
                21
                22
                23
                24
                25
                26
                27
                28
                29
                30
                31
                32
                33
                34
                35
                36
                37
                38
                39
                40
                41
                42
                43
                44
                45
                46
                47
                48
                49
                50
                51
                52
                53
                54
                55
                56
                57
                58
                59
                60
                61
                62
                63
                64
                65
                66
                67
                68
                69
                70
                71
                72
                73
                74
                75
                76
                77
                78
                79
                80
                81
                82
                83
                84
                85
                86
                87
                88
                89
                <div class="container pages">
                 
                    {include file=comm/position.html}
                 
                    <!-- 用户注册 -->
                    <div class="row">
                        <div class="col-lg-3"></div>
                        <div class="col-12 col-lg-6">
                            <form class="my-4" onsubmit="return register(this);">
                                {pboot:if({pboot:registercodestatus}==3)}
                                <div class="form-group">
                                    <label for="username">手机号</label>
                                    <input type="text" name="username" required id="username" onblur="isRegister()" class="form-control" placeholder="请输入登录账号">
                                    <div id="usernote"></div>
                                </div>
                                {else}
                                <div class="form-group">
                                    <label for="username">账 号</label>
                                    <input type="text" name="username" required id="username" onblur="isRegister()" class="form-control" placeholder="请输入登录账号">
                                    <div id="usernote"></div>
                                </div>
                                {/pboot:if}
                 
                                 
                                <div class="form-group">
                                    <label for="nickname">昵 称</label>
                                    <input type="text" name="nickname" required id="nickname" class="form-control" placeholder="请输入账号昵称">
                                </div>
                                 
                                <div class="form-group">
                                    <label for="password">密 码</label>
                                    <input type="password" name="password" required id="password" class="form-control" placeholder="请输入登录密码">
                                </div>
                                 
                                <div class="form-group">
                                    <label for="rpassword">确认密码</label>
                                    <input type="password" name="rpassword" required id="rpassword" class="form-control" placeholder="请再次输入登录密码">
                                </div>
                                 
                                {pboot:if({pboot:registercodestatus}==1)}
                                <div class="form-group">
                                    <label for="checkcode">验证码</label>
                                    <div class="row">
                                        <div class="col-6">
                                            <input type="text" name="checkcode" required id="checkcode" class="form-control" placeholder="请输入验证码">
                                        </div>
                                        <div class="col-6">
                                            <img title="点击刷新" style="height:33px;" id="codeimg" src="{pboot:checkcode}" onclick="this.src='{pboot:checkcode}?'+Math.round(Math.random()*10);" />
                                        </div>
                                    </div>
                                </div>
                                {/pboot:if}
                                 
                                {pboot:if({pboot:registercodestatus}==2)}
                                <div class="form-group">
                                    <label for="checkcode">邮箱验证码</label>
                                    <div class="row">
                                        <div class="col-6">
                                            <input type="text" name="checkcode" required id="checkcode" class="form-control" placeholder="请输入验证码">
                                        </div>
                                        <div class="col-6">
                                            <span  class="btn btn-info mb-2" onclick="sendEmail();">发送</span>
                                        </div>
                                    </div>
                                </div>
                                {/pboot:if}
                 
                                {pboot:if({pboot:registercodestatus}==3)}
                                <div class="form-group">
                                    <label for="checkcode">手机验证码</label>
                                    <div class="row">
                                        <div class="col-6">
                                            <input type="text" name="checkcode" required id="checkcode" class="form-control" placeholder="请输入验证码">
                                        </div>
                                        <div class="col-6">
                                            <span  class="btn btn-info mb-2" onclick="sendSms();">发送</span>
                                        </div>
                                    </div>
                                </div>
                                {/pboot:if}
                                <div class="form-group">
                                   <button type="submit" class="btn btn-info mb-2">立即注册</button>
                                   <span class="text-secondary ml-3">已有账号?<a href="{pboot:login}">马上登录</a></span>
                                </div>
                            </form>
                        </div>
                        <div class="col-lg-3"></div>
                    </div> 
                </div>

                6:打开项目:apps\home\controller\MemberController.php 增加注册模块短信发送函数

                1
                2
                3
                4
                5
                6
                7
                8
                9
                10
                11
                12
                13
                14
                15
                16
                17
                18
                19
                20
                21
                22
                23
                24
                25
                26
                27
                28
                29
                30
                31
                32
                33
                34
                35
                36
                    public function sendSms()
                    {
                        $to = post('to');
                 
                        if ($this->config('register_check_code') != 3) {
                            json(0, '发送失败,后台配置非短信验【证码模式!');
                        }
                        if (! preg_match('/^1[0-9]{10}$/', $to)) {
                            json(0, '账号格式不正确,请输入正确的手机号码!');
                        }
                 
                        if (! session('sendsms')) {
                            json(0, '非法提交发送短信!');
                        }
                        if (time() - session('lastsendsms') < 60) {
                            json(0, '您提交太频繁了,请稍后再※试!');
                        }
                 
                        // 检查手机注册
                        if ($this->model->checkUsername("usermobile='$to' OR username='$to'")) {
                            json(0, '您输入的手机号已被注册!');
                        }
                        $rs = false;
                        if ($to) {
                            $code = create_code(4);
                            session('checkcode', strtolower($code));
                            $mail_body = "您的验证码为:" . $code;
                            $rs = sendsms($this->config(), $to, $mail_body);
                        }
                        if ($rs === true) {
                            session('lastsendsms', time()); // 记录最后提交时间
                            json(1, '发送成功!');
                        else {
                            json(0, '发送失败,' . $rs);
                        }
                    }

                7:打开项目:core\function\helper.php 增加短信宝发送接口

                1
                2
                3
                4
                5
                6
                7
                8
                9
                10
                11
                12
                13
                14
                15
                16
                17
                18
                19
                20
                21
                22
                23
                24
                25
                26
                27
                28
                29
                30
                31
                32
                33
                34
                35
                36
                37
                38
                function sendsms(array $config, $to, $content)
                {
                    $statusStr = array(
                        "0" => "短信发送成功",
                        "-1" => "参数不全",
                        "-2" => "服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!",
                        "30" => "密码错误",
                        "40" => "账号不存在",
                        "41" => "余额不足",
                        "42" => "帐户已过期",
                        "43" => "IP地址限制",
                        "50" => "内容含有敏感词"
                    );
                    if (! $to || ! $content) {
                        return false;
                    }
                 
                    if ($config['sms_status'] == 0){
                        alert_back('短信暂未开启】');
                    }
                 
                    if (! isset($config['sms_status']) || ! isset($config['sms_pwd']) || ! isset($config['sms_signid'])) {
                        alert_back('短信发送参数配置有误');
                    }
                 
                    $user = $config['sms_account'];
                    $pass = md5($config['sms_pwd']);
                    $content = "【" . $config['sms_signid'] . "】".$content;
                    $phone = $to; // 替换空格
                    $smsapi = "";
                    $sendurl = $smsapi."sms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content);
                    $res =file_get_contents($sendurl) ;
                     if ($res == 0) {
                         return true;
                        else {
                         error('短信发送失败,' . $statusStr[$res]);
                     }
                }

                经过上面的替换,短信宝的短信平台已经■替换成功了,可以正常使用了。进行测试发送:

                报备一下短信宝的VIP模板,这样就可以走短信宝的优质通道了,即便遇到敏感文字我们都不会人工审核,短信内容3~5秒就可送达。

                另外:我们已经开发好完整的PbootCMS_V3.1.2注册模块系统短信宝插件,点击此链接?下载及查看安装流程。

                开源插件

                最新更新

                电商类

                CMS类

                微信类

                文章标签