localhost MAC Address

View previous topic View next topic Go down

localhost MAC Address

Post by [CCS]ItzGame on Sun Dec 29, 2013 4:37 pm

Code:
<?php

ob_start(); // Turn on output buffering
system('ipconfig /all'); //Execute external program to display output
$mycom=ob_get_contents(); // Capture the output into a variable
ob_clean(); // Clean (erase) the output buffer

$findme = "Physical";
$pmac = strpos($mycom, $findme); // Find the position of Physical text
$mac=substr($mycom,($pmac+36),17); // Get Physical Address

echo $mac;
?>


on localhost its working but on remote server its not working

---
All you need to do is to put arp into diferrent group.

Default: -rwxr-xr-x 1 root root 48K 2008-11-11 18:11 /usr/sbin/arp*
With command: sudo chown root:www-data /usr/sbin/arp
you will get: -rwxr-xr-x 1 root www-data 48K 2013-30-09 9:13 /usr/sbin/arp*

And because apache is a daemon running under the user www-data, it's now able to execute this command.

So, if you now use a PHP script, e.g.:
Code:
<?php
$mac = system('arp -an');
echo $mac;
?>
avatar
[CCS]ItzGame
Administrator
Administrator

Messages : 1235
Inscription Date : 2013-08-15

http://ccservers.foro.bz

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum