Ever wanted to give out a script that should be restricted to run on one PC? Well, of course you can buy the expensive ioncube pro version which has this feature build in, but the cheaper one ( 199 $ ) also does the job, if you write your own function – which is actually mentioned for windows based systems only.
It’s really not hard, and you can restrict any script to a certain MAC network adapter address. Here’s how to do it:
function getMac(){
exec("ipconfig /all", $output);
foreach($output as $line){
if (preg_match("/(.*)Physical Address(.*)/", $line)){
$mac = $line;
$mac = str_replace("Physical Address. . . . . . . . . :","",$mac);
}
}
return $mac;
}
$mac = getMac();
$mac = trim($mac);
After that, you only need to know the MAC address of the PC the script should run on, and compare that string to the one retrieved. To make the script really secure, you will have to obfuscate it, which can be done by any free PHP encoder or the splendid tool from ioncube.
![[Ask]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/ask.png)
![[Bloglines]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/bloglines.png)
![[BlogMarks]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/blogmarks.png)
![[Blogsvine]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/blogsvine.png)
![[del.icio.us]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/digg.png)
![[diigo]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/diigo.png)
![[dzone]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/dzone.png)
![[Facebook]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/facebook.png)
![[Fark]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/fark.png)
![[Faves]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/faves.png)
![[Furl]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/furl.png)
![[Google]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/google.png)
![[LinkedIn]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/linkedin.png)
![[Ma.gnolia]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/magnolia.png)
![[Mister Wong]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/misterwong.png)
![[MySpace]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/myspace.png)
![[Newsvine]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/newsvine.png)
![[oneview]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/oneview.png)
![[OnlyWire]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/onlywire.png)
![[Reddit]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/reddit.png)
![[Slashdot]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/slashdot.png)
![[Sphinn]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/sphinn.png)
![[Spurl]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/spurl.png)
![[Squidoo]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/squidoo.png)
![[StumbleUpon]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/technorati.png)
![[Twitter]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/twitter.png)
![[Windows Live]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/windowslive.png)
![[Yahoo!]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://www.artviper.net/wp/wp-content/plugins/bookmarkify/email.png)
Comment by saeed othman
May 23, 2008Dear sir
i just like to say,,, Thaaaaaaaaaaaaaaaank you…
i passed a huge time and effort while searching on this issue,,,,
thank you very very much
and i hope that you have no problem if i ask you for any help in the future
Comment by moka
November 19, 2008Hey! Thanks for your idea!
You mentioned this script is “windows based”, does that mean that is work only on windows? Does it work on other OSs, like Linux or Mac?
Thanks in advice!
Comment by ergonomic-backpack
January 8, 2009This is a good post, i’m searching around.
I think using MAC address could prevent unauthorized to access your system admin.
Comment by Shelon Padmore
May 10, 2009It’s also handy to check the machine ID. This is even more fool proof than the MAC which can be cloned.
- Shelon Padmore
Comment by Kevin
October 21, 2009Thank you so very much!!!
Comment by Akilanda Nageswari
January 4, 2010Dear sir
i just like to say,,, Thank you very much …
thanks alot to give that queries. i passed a huge time and effort while searching on this issue,,,,
thank you very very much
i have another one query sir can u help me..
how i detect hardware and software information using php sir in windows OS ??
How i find the speed of the internet ?? in php
how i show the lan system in php
Comment by Jenn
January 7, 2010Perfect thanks a million.