PHPCMS V9实现硬件地址MAC绑定访问技术实现
目的:会员登录需要 用户名、密码、身份识别码(新增字段)
效果:
解决方法:
目前数据库中macaddress字段已经添加,修改了phpcms\modules\member\index.php 635行左右:
- if($r['macaddress'] != $macaddress) {
- $ip = ip();
- if($rtime && $rtime['times'] < 5) {
- $times = 5 - intval($rtime['times']);
- $this->times_db->update(array('ip'=>$ip, 'times'=>'+=1'), array('username'=>$username));
- } else {
- $this->times_db->insert(array('username'=>$username, 'ip'=>$ip, 'logintime'=>SYS_TIME, 'times'=>1));
- $times = 5;
- }
- showmessage(L('macaddress_error', array('times'=>$times)), 'index.php?m=member&c=index&a=login', 3000);
- } www.bbscms.net
还有:
- //验证用户macaddress
- //$macaddress = md5(md5(trim($macaddress)).$r['encrypt']);
- if($_POST['macaddress'] != $macaddress) {
- showmessage(L('macaddress_error', array('times'=>$times)), 'index.php?m=member&c=index&a=login', 3000);
- }
以及phpcms\modules\member\classes\client.class.php 40行左右:
- public function ps_member_login($macaddress, $username, $password, $isemail=0) {
- if($isemail) {
- if(!$this->_is_email($username)) {
- return -3;
- }
- $return = $this->_ps_send('login', array('macaddress'=>$macaddress, 'email'=>$username, 'password'=>$password));
- } else {
- $return = $this->_ps_send('login', array('macaddress'=>$macaddress, 'username'=>$username, 'password'=>$password));
- }
- return $return;
- }
- 转自模板超市,原文链接:http://www.bbscms.net/html/website/jiaocheng/20130104/6089_2.html
- PHPCMS V9实现硬件地址MAC绑定访问技术实现