By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,721 Members | 1,217 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,721 IT Pros & Developers. It's quick & easy.

licence key generation

P: n/a
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.
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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 - sp**@koivi.com
http://www.koivi.com
Jul 17 '05 #2

P: n/a

"Justin Koivisto" <sp**@koivi.com> wrote in message
news:tx*****************@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 - sp**@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. ti****@gvs.ca
http://www.gvs.ca
Jul 17 '05 #3

P: n/a
toufik toufik wrote:
"Justin Koivisto" <sp**@koivi.com> wrote in message
news:tx*****************@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 - sp**@koivi.com
http://www.koivi.com
Jul 17 '05 #4

P: n/a
>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
Jul 17 '05 #5

P: n/a
"toufik toufik" <to*****@sympatico.ca> wrote in message
news:yL********************@news20.bellglobal.com. ..

"Justin Koivisto" <sp**@koivi.com> wrote in message
news:tx*****************@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 - sp**@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. ti****@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.
Jul 17 '05 #6

P: n/a
Justin Koivisto <sp**@koivi.com> wrote in message news:<kj*****************@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
Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.