91成人在线播放_欧美一区二区视频在线观看_91精品国产高清久久久久久_国产精品久久亚洲不卡4k岛国


待發短信

在線客服
產品支持 短信寶客服
合作渠道 渠道合作
服務咨詢

4001-021-502

工作時間

9:00-21:00

海洋CMS V12.8新增短信寶短信接口

海洋cms是一套專為不同需求的站長而設計的視頻點播系統,靈活,方便,人性化設計簡單易用是最大的特色。采用PHP+MYSQL架構,原生PHP代碼帶來卓越的訪問速度和負載能力免去您的后顧之優。今天小編就以新增短信接口為例,給大家講解一下如何進行二次開發,使用的短信接口是我們短信寶短信群發平臺的短信接口,我們短信寶短信群發平臺的接口非常穩定,發送速度快,注冊就送測試短信,推薦大家使用
1:打開項目:\data\admin目錄下邊創建 sms.php ,代碼如下

1
<?php $smsbao_user = "短信寶用戶名"; $smsbao_pass = "短信寶密碼"; $smsbao_sign = "短信寶簽名";  ?>

2:打開項目系統的核心目錄如:/sgmtnc(每個項目核心目錄名可能不一樣)增加admin_sms.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
<?php   
header('Content-Type:text/html;charset=utf-8');
require_once(dirname(__FILE__)."/config.php");
CheckPurview();
if($action=="set")
{
    $weburl= $_POST['smsbao_user'];
    $token = $_POST['smsbao_pass'];
    $token = $_POST['smsbao_sign'];
    $open=fopen("../data/admin/sms.php","w" );
    $str='<?php '
    $str.='$smsbao_user = "';
    $str.="$smsbao_user";
    $str.='"; ';
    $str.='$smsbao_pass = "';
    $str.="$smsbao_pass";
    $str.='"; ';
    $str.='$smsbao_sign = "';
    $str.="$smsbao_sign";
    $str.='"; ';
    $str.=" ?>";
    fwrite($open,$str);
    fclose($open);
    ShowMsg("成功保存設置!","admin_sms.php");
    exit;
}
 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>短信設置</title>
<link  href="img/style.css" rel="stylesheet" type="text/css" />
<link  href="img/style.css" rel="stylesheet" type="text/css" />
<script src="js/common.js" type="text/javascript"></script>
<script src="js/main.js" type="text/javascript"></script>
</head>
<body>
<script type="text/JavaScript">if(parent.$('admincpnav')) parent.$('admincpnav').innerHTML='后臺首頁&nbsp;&raquo;&nbsp;管理員&nbsp;&raquo;&nbsp;短信設置';</script>
<div class="r_main">
  <div class="r_content">
    <div class="r_content_1">
<form action="admin_sms.php?action=set" method="post"
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tb_style">
<tbody><tr class="thead">
<td colspan="5" class="td_title">短信設置</td>
</tr>
<tr>
<td width="80%" align="left" height="30" class="td_border">
<?php require_once("../data/admin/sms.php"); ?>
短信寶用戶名:<input  name="smsbao_user"  value="<?php echo $smsbao_user;?>">
還沒有賬號?<a href="http://www.gjrencai.com/reg"  style="color:red; " target="_blank">請點擊注冊</a>
</td>
</tr>
 
<tr>
<td width="80%" align="left" height="30" class="td_border">
短信寶密碼:<input name="smsbao_pass" value="<?php echo $smsbao_pass;?>">
</td>
</tr>
 
<tr>
<td width="80%" align="left" height="30" class="td_border">
短信寶簽名:<input name="smsbao_sign" value="<?php echo $smsbao_sign;?>">
</td>
</tr>
<tr>
<td width="90%" align="left" height="30" class="td_border">
* 如果修改無效,請檢查/data/admin/sms.php文件權限是否可寫。
</td>
</tr>
<tr>
<td width="10%" align="left" height="30" class="td_border">
<input type="submit" value="確 認" class="btn" >
</td>
</tr>
</tbody></table>   
     
 
</form>
</div>
    </div>
</div>
<?php
viewFoot();
?>
</body>
</html>

3:當前目錄同時打開inc_menu.php 大概166行 增加短信設置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'system'=>array (
    'link'=>"admin_config.php",
    0=>"系統",
    1=>"<a target='I2' href='admin_config.php'>網站設置</a>",
    2=>"",
    3=>"<a target='I2' href='admin_config_mark.php'>圖片水印設置</a>",
    4=>"<a target='I2' href='admin_datarelate.php?action=ftppic'>遠程圖片設置</a>",
    5=>"",
    6=>"<a target='I2' href='admin_player.php'>播放器設置</a>",
    7=>"<a target='I2' href='../js/player/dmplayer/admin/'>彈幕播放管理</a>",
    8=>"<a target='I2' href='admin_player.php?action=boardsource'>播放來源管理</a>",
    9=>"<a target='I2' href='admin_playerdown.php?action=boardsource'>下載來源管理</a>",
    10=>"",
    11=>"<a target='I2' href='admin_manager.php'>系統賬號管理</a>",
    12=>"<a target='I2' href='admin_vcode.php'>后臺登陸驗證碼</a>",
    13=>"<a target='I2' href='admin_isapi.php'>資源庫API設置</a>",
    14=>"<a target='I2' href='admin_ip.php'>后臺IP安全設置</a>",
    15=>"<a target='I2' href='admin_weixin.php'>微信公眾號設置</a>",
    16=>"<a target='I2' href='admin_smtp.php'>郵件服務器設置</a>",
    17=>"<a target='I2' href='admin_sms.php'>短信設置</a>",
),

4:打開項目:\templets\default\html\reg.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
<script>
    var time = 0; // 倒計時時間
    var res = null// 倒計時資源,釋放時使用
    var sendNode = null// 發送的按鈕節點
    //var diffTime = "<?php echo $diff; ?>"; // 由php計算的時間差的結果。所以就算用戶刷新頁面,倒計時還是存在的。
  
    /**
     * 執行倒計時的方法
     */
    function sendTime() {
        clearTimeout(res); // 先清空一下倒計時資源。
        time--; // 倒計時時間遞減。
  
        // 如果倒計時到達0時,則恢復按鈕原來的內容
        if (time <= 0) {
            time = "獲取驗證碼";
            sendNode.val(time);
            clearTimeout(res);
            time = 0;
            return;
        }
        // 倒計時的內容寫到按鈕里面
        sendNode.val("剩余" + time + "秒");
        res = setTimeout("sendTime()", 1000);
    }
  
    /**
     * 調用處
     */
    $(function() {
        sendNode = $("#get_code"); // 獲取發送的節點
        var flg = true// 防止ajax重復提交的標記
        // 在頁面加載時,先判斷一下是否上次倒計時未完成,由php計算,防止頁面刷新,覆蓋掉倒計時。
  
        /**
         * 點擊發送短信,觸發事件
         */
        sendNode.on("click"function() {
            // 如果當前倒計時結束,則收集表單數據,并ajax提交到服務端
            if (0 == time) {
                var phoneNum = $("input[name='nickname']").val();
                var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;  
                if (!myreg.test(phoneNum)) {  
                      alert('手機號碼不能為空或不正確'); 
                     return false;
                }               
                if (true) {}
                var code = $("input[name='validate']").val();
                var data = {"code" : code, "phone" : phoneNum,"Obtain" : 1};
                var err = "";
                if (flg == true) {
                    flg = false;
                    // ajax提交請求
                    $.ajax({
                        "url" "reg.php",
                        "type" "post",
                        "data" : data,
                        "dataType" "json",
                        "success" function (msg) {
                            $(".errmsg").text("");
                           console.log(msg);
                            if (msg == '發送成功') {
                                 time = 60;
                                sendTime();
                                alert("發送驗證碼成功!");
                         
                            else {
                               alert('短信發送失敗,原因'+msg);
                            }
  
                                // 刷新圖形驗證碼
                            $("#code_img").click();
                            flg = true;
                        }
                    });
                }
                return false;
            }
        });
    });
</script>

5:打開項目:/reg.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
if ($_POST['Obtain'] == '1') {
    $mobile = $_POST['phone'];
    $code = $_POST['code'];
    $phone="/^[1][3,4,5,7,8][0-9]{9}$/"
    if(!preg_match($phone,$mobile)||!$mobile)
    {
    echo json_encode("手機號不正確");       
    exit();        
    }
    if($cfg_feedback_ck=='1')
    {
    $code = empty($code) ? '' : strtolower(trim($code));
    if($code=='' || $code != $svali)
        {
            ResetVdValue();
            echo json_encode( "驗證碼不正確");
            exit();
        }
    }  
    $pcode = rand(00000,99999);
    require_once("data/admin/sms.php"); 
//  $ret = file_get_contents($url);
    $ret = 0;
    if ($ret == 0) {
        echo json_encode('發送成功');
        $_SESSION['pcode'] = $pcode;
        exit;
    }else{
        echo json_encode('發送失敗'.$ret);
        exit;
    }
}

6:當前文件同時修改對應的html 大概234行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function viewRegister()
{
    $mystr=
"<ul>".
"<form id=\"f_Activation\"   action=\"/".$GLOBALS['cfg_cmspath']."reg.php?action=reg\" method=\"post\">".
"<li><input type=\"input\" name=\"m_user\" id=\"m_user\" autofocus class=\"form-control\" placeholder=\"用戶名\" /></li>".
"<li><input type=\"password\" name=\"m_pwd\" class=\"form-control\" placeholder=\"密碼\" /></li>".
"<li><input type=\"password\" name=\"m_pwd2\" class=\"form-control\" placeholder=\"確認密碼\" /></li>".
"<li><input type=\"text\" name=\"email\" class=\"form-control\" placeholder=\"郵箱地址\" /></li>".
"<li><img id=\"vdimgck\" src=\"./include/vdimgck.php\" alt=\"看不清?點擊更換\" align=\"absmiddle\" class=\"pull-right\" style='width:70px; height:32px;' onClick=\"this.src=this.src+'?'\"/><input type=\"text\" name=\"validate\" id=\"vdcode\" placeholder=\"驗證碼\" style='width:50%;text-transform:uppercase;' class=\"form-control\" /> </li>".
"<li style='display: flex;'><input type=\"text\" name=\"nickname\" id=\"phone\" placeholder=\"手機號\" style='width:50%;text-transform:uppercase;' class=\"form-control\" /> <input style='width: 30%;margin-left: 60px' class=\"pull-right btn btn-block btn-info\" value='獲取驗證碼' id=\"get_code\"></li>".
"<li><input type=\"input\" name=\"mcode\" id=\"mcode\"  autofocus class=\"form-control\" placeholder=\"短信驗證碼\" /></li>".
"<li><input type=\"submit\" value=\"注冊\" class=\"btn btn-block btn-warning\"/></li>".
"<li class=\"text-center\"><a class=\"text-muted\" href=\"./login.php\">已有賬號,直接登錄?</a></li>".
"</form>".
"</ul>";
    return $mystr;
}

經過上面的替換,短信寶的短信平臺已經替換成功了,可以正常使用了。進行測試發送:

報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,即便遇到敏感文字我們都不會人工審核,短信內容3~5秒就可送達。

另外:我們已經開發好完整的海洋CMS V12.8系統短信寶插件,點擊此鏈接?下載及查看安裝流

開源插件

最新更新

電商類

CMS類

微信類

文章標簽