MAC адрес с PHP

whyasker

Registered
Здравейте!

При положение, че има потребители с динамични IP адреси как може да се разпознае даден потребител.
Предполагам, че начинът за това е като се придобие МАС адреса на потребителя. Поразрових се из нета и намерих този код:

Код:
function returnMacAddress() {
// This code is under the GNU Public Licence
// Written by michael_stankiewicz {don't spam} at yahoo {no spam} dot
com
// Tested only on linux, please report bugs

// WARNING: the commands 'which' and 'arp' should be executable
// by the apache user; on most linux boxes the default configuration
// should work fine

// Get the arp executable path
$location = `which arp`;
$location = rtrim($location);

// Execute the arp command and store the output in $arpTable
$arpTable = `$location -n`;

// Split the output so every line is an entry of the $arpSplitted
array
$arpSplitted = split("\n",$arpTable);

// Get the remote ip address (the ip address of the client, the
browser)
$remoteIp = $GLOBALS['REMOTE_ADDR'];
$remoteIp = str_replace(".", "\\.", $remoteIp);

// Cicle the array to find the match with the remote ip address
foreach ($arpSplitted as $value) {
// Split every arp line, this is done in case the format of the
arp
// command output is a bit different than expected
$valueSplitted = split(" ",$value);

foreach ($valueSplitted as $spLine) {
if ( preg_match("/$remoteIp/",$spLine) ) {
$ipFound = true;
}

// The ip address has been found, now rescan all the string
// to get the mac address

if ($ipFound) {
// Rescan all the string, in case the mac address, in the
string
// returned by arp, comes before the ip address (you know,
Murphy's laws)
reset($valueSplitted);

foreach ($valueSplitted as $spLine) {
if (
preg_match("/[0-9a-f][0-9a-f][:-][0-9a-f][0-9a-f][:-][0-9a-f][0-9a-f][:-][0-9a-f][0-9a-f][:-]".
"[0-9a-f][0-9a-f][:-][0-9a-f][0-9a-f]/i",$spLine)) {
return $spLine;
}
}
}

$ipFound = false;
}
}

return false;
}

Проблемът е, че кодът не работи, а и като цяло, имайки впредвид Ethernet архитектурата, малко ме съмнява, че информация за МАС адреса стига въобще до сървъра.

Някой има ли някаква идея дали е възможно да се установи МАС адреса на потребител с РНР?
А и ако някой се сеща за друг начин да бъде различен даден потребител от друг - да пише. Не е задължително да е точно с МАС, просто трябва да РАБОТИ.

Please, help!!! :?
 
За да работи тоя код и да успееш да вземеш мак адреса трябва да го изпълниш само в/у твойта машина и ще вземеш само твоя мак адрес...
Няма начин да вземеш на даден потребител мак адреса с пхп. Можеш да вземеш само своят мак адрес.


П.С : Ако можеше да се взима мак адреса на потребителя чрез пхп всички щяха да банват по мак адрес. Като се замислиш е точно така ? Само, че всеки знае, че с 2 клика може да си промени и мак адреса... Файда нема
 
Тези опасения и аз ги имах.
А някакви други идеи как мога да разпознавам конкретен потребител?
 

Back
Горе