PHPCMS V9實現硬件地址MAC綁定訪問技術實現

目的:會員登陸須要 用戶名、密碼、身份識別碼(新增字段)

效果: QQ截圖20130104154619.jpg

解決方法:


目前數據庫中macaddress字段已經添加,修改了phpcms\modules\member\index.php 635行左右:php

  1. if($r['macaddress'] != $macaddress) {                               
  2.                                         $ip = ip();
  3.                                         if($rtime && $rtime['times'] < 5) {
  4.                                                 $times = 5 - intval($rtime['times']);
  5.                                                 $this->times_db->update(array('ip'=>$ip, 'times'=>'+=1'), array('username'=>$username));
  6.                                         } else {
  7.                                                 $this->times_db->insert(array('username'=>$username, 'ip'=>$ip, 'logintime'=>SYS_TIME, 'times'=>1));
  8.                                                 $times = 5;
  9.                                         }
  10.                                         showmessage(L('macaddress_error', array('times'=>$times)), 'index.php?m=member&c=index&a=login', 3000);
  11.                                 }  www.bbscms.net
www.bbscms.net 
還有:
  1. //驗證用戶macaddress
  2.                                 //$macaddress = md5(md5(trim($macaddress)).$r['encrypt']);
  3.                                 if($_POST['macaddress'] != $macaddress) {                               
  4.                                         showmessage(L('macaddress_error', array('times'=>$times)), 'index.php?m=member&c=index&a=login', 3000);
  5.                                 }

 

以及phpcms\modules\member\classes\client.class.php 40行左右:html

  1. public function ps_member_login($macaddress, $username, $password, $isemail=0) {
  2.                 if($isemail) {
  3.                         if(!$this->_is_email($username)) {
  4.                                 return -3;
  5.                         }
  6.                         $return = $this->_ps_send('login', array('macaddress'=>$macaddress, 'email'=>$username, 'password'=>$password));
  7.                 } 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綁定訪問技術實現
相關文章
相關標籤/搜索