Reputation: 179
Is it possible to generate a unique ID based on server hardware/OS? I want to generate license keys for my PHP web app based on customer server, just like Atlassian JIRA does.
Thanks for your help.
Upvotes: 4
Views: 2264
Reputation: 13
I think a better way is to code an EXE in any other language that gets the HWID from the server, and then have your PHP script exec() the EXE, if the output from the EXE matches then you run the script... If not, you show an error.
You might want to use blenc_encrypt() in PHP at the very least so that you can prevent users from going in and changing "if (systemhwid == validhwid)" to "if (1 == 1)"
A better option for encryption is to use IonCube (I think it's Ioncube that encrypts PHP files) but unfortunately it costs lots of money.
Search PHP.net for the blenc_encrypt() function
To those who avoid questions by saying things like "a web server is not meant to do that" or "you don't need to verify HWID on servers", JUST ANSWER THE QUESTION! Don't just say it isn't possible, because my answer proves it IS possible... You just need to think outside the box, and you need a little thought. Also, don't question the user's intent, they just want a straight answer, no BS.
Upvotes: 0
Reputation: 3882
You can try to read several $_SERVER
/ $_ENV
variables and combine them to a string. After this md5 this string and you will have your license key.
You have to be careful on which variables to choose if you do not want your customers to get a new license key everytime they update their servers. Also not all variables are available on all system configurations.
Upvotes: 3