Hoi ik moet een simple pagina maken die via bepaalde macadressen benaderd kan worden.
Dus als het macadres erin staat moet het naar een link verwijzen .. zoniet dan moet het iets zeggen als forbidden ofzo.
Dit heb ik voor zover bij elkaar kunnen toveren :
<?php
#Retrieve the MAC address of the client device:
#In PHP, you can use the $_SERVER['REMOTE_ADDR'] variable to get the IP address of the client device.
#Then, you can use the arp command in PHP's exec() function to retrieve the MAC address associated with that IP address.
$ipAddress = $_SERVER['REMOTE_ADDR'];
$macAddress = exec("arp -a $ipAddress");
#Compare the retrieved MAC address with the allowed MAC addresses:
#Maintain a list of allowed MAC addresses in your PHP code or a database.
#Compare the retrieved MAC address with the allowed MAC addresses to determine if access should be granted.
$allowedMACAddresses = ['44:62:88:92:33:03', '11:22:33:44:55:66'];
if (in_array($macAddress, $allowedMACAddresses)) {
// Grant access to the webpage
echo '<p>Access</p>';
} else {
// Deny access to the webpage
echo '<p>Forbidden</p>';
}
?>
Zou iemand mij hiermee kunnen helpen ?
2.795 views