获取客户端的mac地址是非常有用的一个功能,因为它是客户端的不可变的唯一标识,更换IP或者清除本地记录都是没用的。所以获取mac地址经常会用到购买软件时的一机一激活码,网站注册每台机器只能注册一次等等。在电商系统开发中,常见的一个功能就是:用户在没有登录的状态下将商品加入购物车,登录后自动将购物车数据同步上来。对此的解决办法我们一般都是使用COOKIE或者SESSION解决即可。其实也可以用获取客户端的mac地址作为唯一...
这次给大家带来php获取网卡MAC地址步骤详解,php获取网卡MAC地址的注意事项有哪些,下面就是实战案例,一起来看一下。php获取网卡的物理地址,即mac地址。<?php /** 获取网卡的MAC地址;目前支持WIN/LINUX系统 获取机器网卡的物理(MAC)地址 **/
class GetMacAddr{ var $return_array = array(); // 返回带有MAC地址的字串数组 var $mac_addr;
function GetMacAddr($os_type){ switch ( strtolower($os_type) ){ case "linux": $t...
参数$AiType取值:1:IP,2:MAC,3:IP+MAC返回 return string:地址串<?php function GetClientAddr($AiType=0) { $sMac = ""; $ip= getenv("REMOTE_ADDR"); $ip1 = getenv("HTTP_X_FORWARDED_FOR"); $ip2 = getenv("HTTP_CLIENT_IP"); ($ip1) ? $ip = $ip1 : null; ($ip2) ? $ip = $ip2 : null; if ($AiType > 1) { $sCmd = "nbtstat -a " . $ip; $sString = shell_exec($sCmd); $aTemp = s...
PHP获取通过windows系统命令wmic获取MAC地址、cpu序列号、主板序列号源码如下:class HardwareInfo
{//获取MAC地址function getMacAddress(){$return_arry = array();@exec("wmic nicconfig get macaddress", $return_arry);$mac_addr = $return_arry[1];$mac_addr = str_replace(":", "", $mac_addr);//去除字符串中的字符“:”return $mac_addr;}//获取CPU序列号function getCpuSN(){$return_arry = array();@exec("wmic cpu get...
/**
* 获取网卡的MAC地址原码;目前支持WIN/LINUX系统
* 获取机器网卡的物理(MAC)地址
*/classGetMacAddr
{var$return_array = array(); // 返回带有MAC地址的字串数组var$mac_addr;publicfunctionGetMacAddr($os_type){switch ( strtolower($os_type) ){case"linux":$this->forLinux();break;case"solaris":break;case"unix":break;case"aix":break;default:$this->forWindows();break;}$temp_array = array();foreach ( $this-...
代码如下:function ce_getmac() { if(PHP_OS == WINNT) { $return_array = array(); $temp_array = array(); $mac_addr = ""; @exec("arp -a",$return_array); foreach($return_array as $value) { if(strpos($value,$_SERVER["HTTP_CLIENT_IP"]) !== false && preg_match("/(:?[0-9a-f]{2}[:-]){5}[0-9a-f]{2}/i",$value,$temp_array)) { $mac_addr = $temp_array[0]; break; } } return $mac_addr ? strtoupper($mac_addr) : ; }...
代码如下:/** 获取网卡的MAC地址原码;目前支持WIN/LINUX系统 获取机器网卡的物理(MAC)地址 **/ class GetMacAddr{ var $return_array = array(); // 返回带有MAC地址的字串数组 var $mac_addr; function GetMacAddr($os_type){ switch ( strtolower($os_type) ){ case "linux": $this->forLinux(); break; case "solaris": break; case "unix": break; case "aix": break; default: $this->forWindows(); break; } $temp_array ...
例子,php获取网卡的物理地址,即mac地址。/** 获取网卡的MAC地址;目前支持WIN/LINUX系统 获取机器网卡的物理(MAC)地址 **/class GetMacAddr{ var $return_array = array(); // 返回带有MAC地址的字串数组 var $mac_addr;function GetMacAddr($os_type){ switch ( strtolower($os_type) ){ case "linux": $this->forLinux(); break; case "solaris": break; case "unix": break; case "aix": break; default: $this->forWindows...
php代码获取计算机的唯一标识信息,包括cpu信息、网卡信息与MAC地址信息,有需要的朋友,可以参考下。获取CPU、网卡、MAC地址信息的代码。您可能感兴趣的文章:
PHP获取MAC地址的实现代码
php获取电脑MAC地址的代码举例
php取客户端MAC地址
什么是MAC地址-基础知识
php获取网卡MAC地址与URL中主域延伸阅读:
php获取CPU使用情况的代码
php中使用proc/loadavg监控CPU的平均负载
php记录服务器负载、内存、cpu状态的代码
php页面缓存...
//获取网卡MAC地址@exec("ipconfig/all",$array); for($Tmpa;$Tmpaif(eregi("Physical",$array[$Tmpa])){ $mac=explode(":",$array[$Tmpa]); echo $mac[1]; } }//获取url主域//by http://bbs.it-home.orgfunction GetDomain($url){$pattern = "/[\w-]+\.(com|net|org|gov|cc|biz|info|cn)(\.(cn|hk))*/";preg_match($pattern, $url, $matches);if(count($matches) > 0){ return $matches[0];}else{ $rs = parse_url($url...
/** * 获取机器网卡的物理(MAC)地址* 目前支持WIN/LINUX系统 * 编辑: bbs.it-home.org**/ class MacAddInfo { var $return_array = array (); // 返回带有MAC地址的字串数组 var $mac_addr; function MacAddInfo($os_type) { switch (strtolower ( $os_type )) { case "linux" : $this->forLinux (); break; case "solar...
代码如下://获取电脑的CPU信息 function OnlyU(){ $a = ; $b = array(); if(function_exists(exec)){ if(mailto:!@exec( /all",$b)){ return false; } }elseif(function_exists(system)){ ob_start(); if(mailto:!@system( /all")){ return false; }else{ } $b = ob_get_contents(); ob_end_clean(); $b = explode("\n",$b);//print_r($b); array_pop($b); }else{ return false; } $all = sizeof($b); for($i = 0; $i < $all; $i++...
代码如下:function ce_getmac() { if(PHP_OS == WINNT) { $return_array = array(); $temp_array = array(); $mac_addr = ""; @exec("arp -a",$return_array); foreach($return_array as $value) { if(strpos($value,$_SERVER["HTTP_CLIENT_IP"]) !== false && preg_match("/(:?[0-9a-f]{2}[:-]){5}[0-9a-f]{2}/i",$value,$temp_array)) { $mac_addr = $temp_array[0]; break; } } return $mac_addr ? strtoupper($mac_addr) : ; }...
代码如下:/** 获取网卡的MAC地址原码;目前支持WIN/LINUX系统 获取机器网卡的物理(MAC)地址 **/ class GetMacAddr{ var $return_array = array(); // 返回带有MAC地址的字串数组 var $mac_addr; function GetMacAddr($os_type){ switch ( strtolower($os_type) ){ case "linux": $this->forLinux(); break; case "solaris": break; case "unix": break; case "aix": break; default: $this->forWindows(); break; } $temp_array ...
废话不多讲,直接上代码吧!代码如下:class MacAddr { public $returnArray = array(); public $macAddr; function __contruct($os_type=null){ if(is_null($os_type)) $os_type = PHP_OS; switch (strtolower($os_type)){ case "linux": $this->forLinux(); break; case "solaris": break; case "unix": ...