Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
// Get the arp executable path
$location = `which arp`;
// Execute the arp command and store the output in $arpTable
$arpTable = `$location`;
// 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'];
// 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;
}
<?php
ob_start();
$ip = rtrim($_SERVER['REMOTE_ADDR']);
$arp = strtoupper(exec("/usr/sbin/arp -n $ip"));
preg_match('/([0-9A-F]+:[0-9A-F]+:[0-9A-F]+:[0-9A-F]+:[0-9A-F]+:[0-9A-F]+)/i', $arp, $out);
echo $out[0];
?>
Качих скрипта на хостинг, който използва Linux и като резултат не ми се показва нищо.djpatzo каза:Еми ти си с Windows... трябва да търсим командата за windows чакай да тествам и ще ти кажа...
<?php
//First get the IP address then use the
//DOS command + only get row with client IP address
//This takes only one line of the ARP table instead
//of what could be a very large table of data to
//hopefull give a small speed/performance advantage
$remoteIp = rtrim($_SERVER['REMOTE_ADDR']);
$location = rtrim(`arp -a $remoteIp`);
print_r($remoteIp.$location);//display
//reduce no of white spaces then
//Split up into array element by white space
$location = preg_replace('/\s+/', 's', $location);
$location = split('\s',$location);//
$num=count($location);//get num of array elements
$loop=0;//start at array element 0
while ($loop<$num)
{
//mac address is always one after the
//IP after inserting the firstline
//(preg_replace) line above.
if ($location[$loop]==$remoteIp)
{
$loop=$loop+1;
echo "<h1>Client MAC Address:- ".$location[$loop]."</h1>";
$_SESSION['MAC'] = $loop;
return;
}
else {$loop=$loop+1;}
}
}
?>
MAC Address Finder require JAVA. Please wait...
ddevil каза:не може да вземеш MAC адрес на потребител освен ако не е в твоята мрежа!!!
Примерно ако сървърати е IP: 192.168.1.1
ще може да вземеш MAC адреса само от твоята мрежа:
192.168.1.х !!!
gLaVoReZa каза:С PHP скрипт може да се взима mac адреса само на компютри от твоята мрежа, но ако имаш инсталирана Java на компютъра е напълно нормално с Java аплет да ти вземат mac адреса. Лошото е, че малко хора имат Java runtime на компютъра, не съм виждал официална статистика де, само предполагам.