帝國CMS是基于B/S結(jié)構(gòu),安全、穩(wěn)定、強大、靈活的網(wǎng)站管理系統(tǒng).還提供了系統(tǒng)擴(kuò)展框架。小編對這款系統(tǒng)還比較了解,今天就以增加手機(jī)登錄為例為大家講解一下如何進(jìn)行二次開發(fā),我們今天講解的是7.5版本,使用的短信接口是我們短信寶短信群發(fā)平臺的短信接口,我們短信寶短信群發(fā)平臺非常穩(wěn)定,發(fā)送速度快,注冊就送測試短信,推薦大家使用!
需求介紹:反饋表單新增手機(jī)驗證碼校驗手機(jī)號的真假
首先打開項目:\e\tool\feedback\temp\feedback1.php 在29行左右新增手機(jī)驗證頁面
|
1
2
3
4
5
6
7
8
9
10
|
<tr> <td width='16%' height=25 bgcolor='ffffff'><div align="right">聯(lián)系電話:</div></td> <td bgcolor='ffffff'><input name='mycall' id="phone" type='text' size='42'> (*)</td> </tr> <tr> <td width='16%' height="25" bgcolor="#FFFFFF"> <div align='right'>驗證碼</div></td> <td height="25" bgcolor="#FFFFFF"> <input name='rzm' type='text' id='rzm' maxlength='30'> *<input type="button" style="font-size: 12px; height: 22px; line-height: 19px;" value="發(fā)送驗證碼" onclick="sendrzm()" id="sendag" ></td> </tr> |
在此文件58行左右新增JavaScript代碼
|
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
|
<script src="/js/jquery.min-1.7.2.js"></script> <SCRIPT language=javascript> <!-- var secs = 60; function sendrzm(){ var tel=$("#phone").val(); if($.trim(tel)==''||$.trim(tel).length!=11){ alert('請?zhí)顚懻_的手機(jī)號碼'); }else{ $.getJSON('/e/member/doaction.php?enews=Backsend&phone=' + tel + '', function(data) { console.log(data); if(data.d=='2'){ alert(data.n); }else{ document.feedback.sendag.disabled=true; for(i=1;i<=secs;i++) { window.setTimeout("update(" + i + ")", i * 1000); } } }); } } function update(num) { if(num == secs) { document.feedback.sendag.value ="重新發(fā)送驗證碼"; document.feedback.sendag.disabled=false; } else { printnr = secs-num; document.feedback.sendag.value = "(" + printnr +")重新發(fā)送驗證碼"; } } //--> </SCRIPT><? include("../../data/template/cp_2.php");?> |
打開項目:\e\member\doaction.php 在194行左右新增反饋表單驗證方法
|
1
2
3
4
5
|
elseif ($enews=='Backsend'){ $tel=$_GET['phone']; F_rzms($tel);} |
打開項目:\e\class\q_functions.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
function AddFeedback($add){ global $empire,$dbtbpre,$level_r,$public_r; CheckCanPostUrl();//驗證來源 if($add['bid']) { $bid=(int)$add['bid']; } else { $bid=(int)getcvar('feedbackbid'); } //驗證手機(jī)驗證碼 $tel=$add['mycall']; $rzm=$add['rzm']; C_sjrs($tel,$rzm); if(empty($bid)) { printerror("EmptyFeedbackname","history.go(-1)",1); } //驗證碼 $keyvname='checkfeedbackkey'; if($public_r['fbkey_ok']) { ecmsCheckShowKey($keyvname,$add['key'],1); } //版面是否存在 $br=$empire->fetch1("select bid,enter,mustenter,filef,groupid,checkboxf from {$dbtbpre}enewsfeedbackclass where bid='$bid';"); if(empty($br['bid'])) { printerror("EmptyFeedback","history.go(-1)",1); } //權(quán)限 $user=array(); if($br['groupid']) { $user=islogin(); if($level_r[$br[groupid]][level]>$level_r[$user[groupid]][level]) { printerror("HaveNotEnLevel","history.go(-1)",1); } } //實名驗證 eCheckHaveTruename('fb',$user['userid'],$user['username'],$user['isern'],$user['checked'],0); $pr=$empire->fetch1("select feedbacktfile,feedbackfilesize,feedbackfiletype from {$dbtbpre}enewspublic limit 1"); //必填項 $mustr=explode(",",$br['mustenter']); $count=count($mustr); for($i=1;$i<$count-1;$i++) { $mf=$mustr[$i]; if(strstr($br['filef'],",".$mf.","))//附件 { if(!$pr['feedbacktfile']) { printerror("NotOpenFBFile","",1); } if(!$_FILES[$mf]['name']) { printerror("EmptyFeedbackname","",1); } } else { $chmustval=ReturnFBCheckboxAddF($add[$mf],$mf,$br['checkboxf']); if(!trim($chmustval)) { printerror("EmptyFeedbackname","",1); } } } $saytime=date("Y-m-d H:i:s"); //字段處理 $dh=""; $tranf=""; $record="<!--record-->"; $field="<!--field--->"; $er=explode($record,$br['enter']); $count=count($er); for($i=0;$i<$count-1;$i++) { $er1=explode($field,$er[$i]); $f=$er1[1]; //附件 $add[$f]=str_replace('[!#@-','ecms',$add[$f]); if(strstr($br['filef'],",".$f.",")) { if($_FILES[$f]['name']) { if(!$pr['feedbacktfile']) { printerror("NotOpenFBFile","",1); } $filetype=GetFiletype($_FILES[$f]['name']);//取得文件類型 if(CheckSaveTranFiletype($filetype)) { printerror("NotQTranFiletype","",1); } if(!strstr($pr['feedbackfiletype'],"|".$filetype."|")) { printerror("NotQTranFiletype","",1); } if($_FILES[$f]['size']>$pr['feedbackfilesize']*1024)//文件大小 { printerror("TooBigQTranFile","",1); } $tranf.=$dh.$f; $dh=","; $fval="[!#@-".$f."-@!]"; } else { $fval=""; } } else { $add[$f]=ReturnFBCheckboxAddF($add[$f],$f,$br['checkboxf']); $fval=$add[$f]; } $addf.=",`".$f."`"; $addval.=",'".addslashes(RepPostStr($fval))."'"; } $type=0; $classid=0; $filename=''; $filepath=''; $userid=(int)getcvar('mluserid'); $username=RepPostVar(getcvar('mlusername')); $filepass=ReturnTranFilepass(); //上傳附件 if($tranf) { $dh=""; $tranr=explode(",",$tranf); $count=count($tranr); for($i=0;$i<$count;$i++) { $tf=$tranr[$i]; $tfr=DoTranFile($_FILES[$tf]['tmp_name'],$_FILES[$tf]['name'],$_FILES[$tf]['type'],$_FILES[$tf]['size'],$classid); if($tfr['tran']) { $filepath=$tfr[filepath]; //寫入數(shù)據(jù)庫 $filetime=$saytime; $filesize=(int)$_FILES[$tf]['size']; eInsertFileTable($tfr[filename],$filesize,$tfr[filepath],'[Member]'.$username,$classid,'[FB]'.addslashes(RepPostStr($add[title])),$type,$filepass,$filepass,$public_r[fpath],0,4,0); $repfval=($tfr[filepath]?$tfr[filepath].'/':'').$tfr[filename]; $filename.=$dh.$tfr[filename]; $dh=","; } else { $repfval=""; } $addval=str_replace("[!#@-".$tf."-@!]",$repfval,$addval); } } $filepath=dgdb_tosave($filepath); $filename=dgdb_tosave($filename); $ip=egetip(); $eipport=egetipport(); $sql=$empire->query("insert into {$dbtbpre}enewsfeedback(bid,saytime,ip,filepath,filename,userid,username,haveread,eipport".$addf.") values('$bid','$saytime','$ip','$filepath','$filename','$userid','$username',0,'$eipport'".$addval.");"); $fid=$empire->lastid(); //更新附件 UpdateTheFileOther(4,$fid,$filepass,'other'); ecmsEmptyShowKey($keyvname);//清空驗證碼 if($sql) { //有新的信息反饋時發(fā)送短信 require("../admin/smsbao/Smsbao.php"); //取出短信配置信息 $smsbao_config=file_get_contents("../admin/smsbao/config.txt"); $jiemi = encrypt($smsbao_config, 'D', 'a'); $smsbao_config=explode(",", $jiemi); //取出商家手機(jī)號配置信息 $sms_shop_config1=file_get_contents("../admin/smsbao/shop.txt"); $smsbao=new Sms($smsbao_config[0],$smsbao_config[1]); $mobiles=explode(',',trim($sms_shop_config1)); $mobiles=array_unique($mobiles); $content="【".$smsbao_config[2]."】您好,收到來自".$add['title']."的信息反饋,請及時查看處理。"; foreach($mobiles as $key=>$val){ $sms_res=$smsbao->sendSms($val,$content); } //發(fā)送短信完畢 $reurl=DoingReturnUrl("../tool/feedback/?bid=$bid",$add['ecmsfrom']); printerror("AddFeedbackSuccess",$reurl,1); } else {printerror("DbError","history.go(-1)",1);}} |
打開項目:\e\class\connect.php 新增反饋手機(jī)驗證碼發(fā)送方法
|
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
|
//反饋發(fā)送驗證碼function F_rzms($tel){ global $empire,$dbtbpre,$public_r; $ism=is_mobile($tel); if($ism == 2) { G_return("手機(jī)號碼為空或者錯誤!"); } $time=time(); //識別碼 $gzwc=RepPostVar(getcvar('banksend')); $zr=$empire->fetch1("select * from {$dbtbpre}rz where bsm='$gzwc' and sj='$tel' limit 1"); if($zr['id']){ //驗證次數(shù) if($zr['c']>10) { G_return("該號碼已多次接收不了驗證碼,建議更換手機(jī)重新注冊!"); } //驗證間隔時間 $gtime2=$zr['t']+60*2; if($time<$gtime2) { G_return("發(fā)送過程中,手機(jī)接收驗證碼需要1-2分鐘,請耐心等待!"); } $rm=no_make_password(6); $content=$rm; $fh=api_sendsms($tel,$content); if($fh){ $sql=$empire->query("update {$dbtbpre}rz set t='$time',rzm='$rm',c=c+1 where id='$zr[id]'"); $logincookie=$time+3600*2; $set1=esetcookie("gzwrz",$gzwc,$logincookie); G_return("驗證碼已發(fā)送成功,請查收!",1); }else{ G_return("發(fā)送失敗,請聯(lián)系管理員!"); } }else{ $rm=no_make_password(6); $content=$rm; $fh=api_sendsms($tel,$content); if($fh){ $gzwc=make_password(20); $sql=$empire->query("insert into {$dbtbpre}rz(bsm,rzm,sj,t,c) values('$gzwc','$rm','$tel','$time','1');"); $logincookie=$time+3600*2; $set1=esetcookie("banksend",$gzwc,$logincookie); G_return("驗證碼已發(fā)送成功,請查收!",1); }else{ G_return("發(fā)送失敗,請聯(lián)系管理員!"); } }} |
好了經(jīng)過以上的添加,短信寶反饋表單增加手機(jī)驗證就已經(jīng)安裝成功,可以正常使用了

報備一下短信寶的VIP模板,這樣就可以走短信寶的優(yōu)質(zhì)通道了,即便遇到敏感文字我們都不會人工審核,短信內(nèi)容3~5秒就可送達(dá)。
另外:我們已經(jīng)開發(fā)好完整的帝國CMS系統(tǒng)短信寶插件,點擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類