This is a discussion on licence key generation within the PHP Language forums, part of the PHP Programming Forums category; Hi, I'm looking for a php code that I can use to generate lience key that is activated between ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
toufik toufik wrote:
> Hi, > I'm looking for a php code that I can use to generate lience key that is > activated between 2 dates. > > Any hint please. More information needed... You'll need a database with 3 fields, key, start, end. Beyond that, we'd need to know what you are trying to accomplish. -- Justin Koivisto - spam@koivi.com http://www.koivi.com |
|
|||
|
"Justin Koivisto" <spam@koivi.com> wrote in message news:txyad.270$Iq6.11820@news7.onvoy.net... > toufik toufik wrote: > > > Hi, > > I'm looking for a php code that I can use to generate lience key that is > > activated between 2 dates. > > > > Any hint please. > > More information needed... You'll need a database with 3 fields, key, > start, end. Beyond that, we'd need to know what you are trying to > accomplish. > > -- > Justin Koivisto - spam@koivi.com > http://www.koivi.com Thanks Justin, What I need execaly, is how can secure my key, so that my customer couldn't create it himself. All this because the customer can see the source code. Toufik. tissad@gvs.ca http://www.gvs.ca |
|
|||
|
toufik toufik wrote:
> "Justin Koivisto" <spam@koivi.com> wrote in message > news:txyad.270$Iq6.11820@news7.onvoy.net... > >>toufik toufik wrote: >> >>>I'm looking for a php code that I can use to generate lience key that is >>>activated between 2 dates. >>> >>>Any hint please. >> >>More information needed... You'll need a database with 3 fields, key, >>start, end. Beyond that, we'd need to know what you are trying to >>accomplish. > > Thanks Justin, > What I need execaly, is how can secure my key, so that my customer couldn't > create it himself. > All this because the customer can see the source code. OK, so what you are doing (as an example) is: 1. Selling useage licenses to some PHP scripts for a client 2. You only want the licenses to work for a certain date range (like from now until a year from now) 3. Clients will need to pay fees to renew the license or the scripts stop working. There are a few ways you can do this. First the paranoid license keeper way: You will need to have some kind of permanent database set up. Use 3 fields: id - varchar(32), startdate - timestamp, enddate - timestamp Then, in the application that uses the licenses: <?php $q="SELECT count(*) FROM script_licenses WHERE id = ". "'$customer_code' AND startdate >= '".time()."' ". "AND enddate <= '".time()."'"; // do the query, get result into $result // if the entered license is good, the result should be 1 // if not, it should be 0 ?> You'll want to do that only once per request or session so you don't slow down the client site too much, and keep your database server from getting pounded too hard. OK, that's really all I can think of right at this moment. However, you should be able to set up a file that contains some kind of encrypted string that contains the start and end dates that the script will run for. Of course, by giving the client a file that has the keys, they may be able to decode it by searching the source code. Also, one thing you may want to look into is Turck MM Cache and its encoding: http://turck-mmcache.sourceforge.net/index_old.html I've yet to have a chance to play with it, but it does look a bit promising. I know that the server-side install only took a few minutes. ;) -- Justin Koivisto - spam@koivi.com http://www.koivi.com |
|
|||
|
>What I need execaly, is how can secure my key, so that my customer couldn't
>create it himself. > All this because the customer can see the source code. If the customer can see the source code, the customer can modify the source code so it doesn't require, look at, or need a key. Gordon L. Burditt |
|
|||
|
"toufik toufik" <toufiki@sympatico.ca> wrote in message
news:yLyad.11578$hk6.291664@news20.bellglobal.com. .. > > "Justin Koivisto" <spam@koivi.com> wrote in message > news:txyad.270$Iq6.11820@news7.onvoy.net... > > toufik toufik wrote: > > > > > Hi, > > > I'm looking for a php code that I can use to generate lience key that is > > > activated between 2 dates. > > > > > > Any hint please. > > > > More information needed... You'll need a database with 3 fields, key, > > start, end. Beyond that, we'd need to know what you are trying to > > accomplish. > > > > -- > > Justin Koivisto - spam@koivi.com > > http://www.koivi.com > > Thanks Justin, > What I need execaly, is how can secure my key, so that my customer couldn't > create it himself. > All this because the customer can see the source code. > > Toufik. tissad@gvs.ca > http://www.gvs.ca > For that, you need a asymmetric cipher like RSA. It's possible to implement that in PHP, although most servers don't have the GMP extension. Besides, as Gordon said, if your customers can see the source code, then they can comment out any restriction you put it. |
|
|||
|
Justin Koivisto <spam@koivi.com> wrote in message news:<kjBad.276$Iq6.11897@news7.onvoy.net>...
<snip> > Also, one thing you may want to look into is Turck MM Cache and its > encoding: > > http://turck-mmcache.sourceforge.net/index_old.html I'm not sure if it will work with PHP 5 _though_ many claim so. Zend, "The PHP company" hunted Dmitry Stogov, the author of Turck MM Cache by the end of 2003 and he seems to be working for Zend accelerator. phpSt.Manuel Lemos was suggesting him to update the license to non-GPL; but he doesn't seems to get any reply. More politics and flames here <http://sourceforge.net/forum/forum.php?thread_id=986362&forum_id=236228> -- | Just another PHP saint | Email: rrjanbiah-at-Y!com |