modoer點評系統(tǒng)防止注冊機惡意注冊解決辦法
解決辦法:在注冊時添加一個必填的選項,同理可增加其它選項來防止注冊

1.在數(shù)據(jù)表modoer_member里添加字段mobile,字段類型如下
`mobile` varchar(20) NOT NULL DEFAULT ''
2.找到文件/templates/main/default/member_reg.htm,在相應位置(不出意外的話在30行左右)添加
3.找到文件/static/javascript/member.js,在相應位置(應該在22行左右)添加
4.找到文件/core/modules/member/reg.php,在相應位置(48行左右)添加
5.找到文件/core/modules/member/model/member_class.php,
在28行,將
修改為
在31行,將
修改為
在150行左右,添加
163行左右,添加
182行左右,添加
6.找到/core/helper/validate.php,在12行左右添加
7.找到/core/modules/member/helper/query.php,在19行,將
修改為
8.找到/core/lang/CH/member.php,在30行左右和45行左右,添加
和
解決辦法:在注冊時添加一個必填的選項,同理可增加其它選項來防止注冊

1.在數(shù)據(jù)表modoer_member里添加字段mobile,字段類型如下
`mobile` varchar(20) NOT NULL DEFAULT ''
2.找到文件/templates/main/default/member_reg.htm,在相應位置(不出意外的話在30行左右)添加
- <tr>
- <td width="*">
- <input type="text" onblur="check_mobile(this);" name="mobile" class="t_input" style="width:200px;" validator="{'empty':'N','errmsg':'請?zhí)顚懩氖謾C號碼。'}" />
- <span id="msg_mobile" class="formmessage none"></span>
- <div class="formtip">手機號碼為<span class="font_2">11</span>或<span class="font_2">12</span>個字符</div>
- </td>
- </tr>
3.找到文件/static/javascript/member.js,在相應位置(應該在22行左右)添加
- function check_mobile(obj) {
- if(!obj.value) {
- $('#msg_mobile').html('<span class="font_1">請輸入手機號碼.</span>').show();
- return;
- }
- $.post(Url('member/reg/op/check_mobile'), {'mobile':obj.value,'in_ajax':1}, function(data) {
- $('#msg_mobile').html(data).show();
- });
- }
4.找到文件/core/modules/member/reg.php,在相應位置(48行左右)添加
- case 'check_mobile':
- if(!$mobile = trim($_POST['mobile'])) {
- echo lang('member_reg_ajax_mobile_empty'); exit;
- }
- if(!validate::is_mobile($mobile)) {
- echo lang('member_reg_ajax_mobile_invalid'); exit;
- }
- if(!$MOD['existsmobilereg'] && $user->check_mobile_exists($mobile)) {
- echo lang('member_reg_ajax_mobile_exists');
- exit;
- }
- echo lang('member_reg_ajax_mobile_normal'); exit;
- break;
5.找到文件/core/modules/member/model/member_class.php,
在28行,將
- $this->add_field('uid,username,password,password2,email,groupid,nexttime,nextgroupid,point,coin');
修改為
- $this->add_field('uid,username,password,password2,email,mobile,groupid,nexttime,nextgroupid,point,coin');
在31行,將
- $this->add_field_fun('password,email', 'trim');
修改為
- $this->add_field_fun('password,email,mobile', 'trim');
在150行左右,添加
- $this->loader->helper('validate');
- if(!$post['mobile'] || !validate::is_mobile($post['mobile'])) {
- redirect('member_post_empty_mobile');
- }
163行左右,添加
- if($this->check_mobile_exists($post['mobile']))
- redirect('member_post_exists_mobile');
182行左右,添加
- function check_mobile_exists($mobile, $without_uid = null) {
- $this->db->from($this->table);
- $this->db->where('mobile',$mobile);
- if($without_uid > 0) $this->db->where_not_equal('uid', $without_uid);
- return $this->db->count() > 0;
- }
6.找到/core/helper/validate.php,在12行左右添加
- function is_mobile($str) {
- if(strlen($str) == 11){
- return preg_match('/^(13[0-9]|15[0-9]|153|156|18[0-9])[0-9]{8}$/', $str);
- }elseif(strlen($str) == 12){
- return preg_match('/^0(13[0-9]|15[0-9]|153|156|18[0-9])[0-9]{8}$/', $str);
- }else{
- return false;
- }
- }
7.找到/core/modules/member/helper/query.php,在19行,將
- $db->select($select?$select:'uid,username,email,groupid,coin,point,reviews,subjects,responds,flowers');
修改為
- $db->select($select?$select:'uid,username,email,mobile,groupid,coin,point,reviews,subjects,responds,flowers');
8.找到/core/lang/CH/member.php,在30行左右和45行左右,添加
- 'member_reg_ajax_mobile_empty' => '<font color="red">您未填寫手機號碼</font>',
- 'member_reg_ajax_mobile_invalid' => '<font color="red">您填寫的手機號碼格式不正確</font>',
- 'member_reg_ajax_mobile_exists' => '<font color="red">您填寫的手機號碼已存在</font>',
- 'member_reg_ajax_mobile_normal' => '<font color="green">您可以使用這個手機號碼</font>',
和
- 'member_post_empty_mobile' => '對不起,您未填寫手機號碼或者格式錯誤,請返回重寫。',
- 'member_post_exists_mobile' => '對不起,您填寫的手機號碼已存在,請返回重寫。',