Web Hosting Talk







View Full Version : PHP Serial Number Generator


latheesan
09-22-2007, 01:46 PM
I want to geneate a unique serial number based on domain name, and a expiry date in dd-mm-yyyy format and have a away of checking if the given serial number is valid for the domain/date.

Any idea where i can get started? Any links to an existing scripts/articles/guide like what i describted would be much appreciated. Thanks.

justforselling1
09-22-2007, 01:49 PM
just md5 it with a rand factor

md5("$mydomainname-dd-mm-yyy".rand(microtime()));

latheesan
09-22-2007, 02:35 PM
Generating the serial number was the easy part, because i was thiking about using the md5 function also.

validating the serial is the problem for me. How can i validate a serial and see when it's supposed to expire?

Annex
09-22-2007, 03:00 PM
Generating the serial number was the easy part, because i was thiking about using the md5 function also.

validating the serial is the problem for me. How can i validate a serial and see when it's supposed to expire?
Use a MySQL database. Store the date and the serial in there, then you can pull it at any time.

latheesan
09-22-2007, 04:15 PM
Actually, i intended to release a script i was working on and have some sort of custom lincensing system where use sets the givn serial into the config.php file and the rest of the script is encoded by ioncube.

Tom P
09-22-2007, 04:18 PM
Easy way: Take a look at http://www.olate.co.uk/products/iono/ who offer a PHP licensing product, it looks amazing but you have to be able to justify the cost.

Hard way: There is never a very easy way to do licensing, as you have to thing about the people who will try and get around it. For instance, the script will have to be encrypted otherwise it could easily be modified to bypass the check.

Annex
09-22-2007, 04:40 PM
Actually, i intended to release a script i was working on and have some sort of custom lincensing system where use sets the givn serial into the config.php file and the rest of the script is encoded by ioncube.
You definitely would want some form of SQL, I really don't see any other option.

Jatinder
09-23-2007, 01:21 AM
The way I see it, the script, once installed on the client's server, will need to call another script on your server. It will send along the license key in the request. The script on your server will then do a check in the database and send back a true/false status. You can use cURL for this.

A simpler option is to go with http://phpaudit.com/ . They got a free version also which is good for first 15 licenses.