Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. <?php
  2. $ipaddress=$_SERVER['REMOTE_ADDR'];
  3. $macaddr=false;
  4.  
  5. #run the external command, break output into lines
  6.  
  7. $arp=`arp $ipaddress`;
  8.  
  9. $lines = explode(" ", $arp);
  10.  
  11. $macaddr = $lines[3];
  12.  
  13.  
  14. ?>
  15.  
  16. <?php
  17. //RETURNS AN IP ADRES 127.0.0.1
  18. $ipaddress=$_SERVER['REMOTE_ADDR'];
  19.  
  20. $macaddr = false;
  21.  
  22. #run the external command, break output into lines
  23.  
  24. $arp='arp ' . $ipaddress;
  25.  
  26. //You're trying to explode `arp 127.0.0.1` with a space
  27. $lines = explode(" ", $arp);
  28.  
  29. //$lines contains array(0 => 'arp', 1 => '127.0.0.1')
  30.  
  31. //$lines[3] does not exist that's where the undefined offset is coming from.
  32. $macaddr = $lines[3];
  33.  
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement