Ideas on how I stop my code being used on more than one URL

How do I enforce a single URL license?

  • (2 Pages)
  • +
  • 1
  • 2

25 Replies - 3082 Views - Last Post: 23 March 2009 - 01:45 AM Rate Topic: -----

#1 Rich Head   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 25-February 09

Ideas on how I stop my code being used on more than one URL

Post icon  Posted 25 February 2009 - 08:42 AM

I have no code to post, I'm just unsure of how when I make my code commercially available I enforce a single URL license...

I had thought about hard coding the URL into a function embedded in the admin console's index.php which checked itself against the current URL when called, and preventing admin functions being run if not the same (but the code would be visible and amendable)?

Anyone have any ideas they're willing to share?

Rich

Is This A Good Question/Topic? 0
  • +

Replies To: Ideas on how I stop my code being used on more than one URL

#2 Rich Head   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 25-February 09

Re: Ideas on how I stop my code being used on more than one URL

Posted 25 February 2009 - 08:50 AM

I've just realised that my avatar says "new D I C Head" underneath it - as someone named Rich Head (aka Dick Head) that's an unfortunate co-incidence! :blink:
Was This Post Helpful? 0
  • +
  • -

#3 thehat   User is offline

  • awake ? web();
  • member icon

Reputation: 106
  • View blog
  • Posts: 951
  • Joined: 28-February 08

Re: Ideas on how I stop my code being used on more than one URL

Posted 25 February 2009 - 09:05 AM

Use one way encryption on the url before you put it into your code. Then when the code executes, it gets the current page location, encrypts it and compares it to the stored value. If they match, happy days and the code can execute.
Was This Post Helpful? 0
  • +
  • -

#4 Rich Head   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 25-February 09

Re: Ideas on how I stop my code being used on more than one URL

Posted 25 February 2009 - 09:10 AM

View Postthehat, on 25 Feb, 2009 - 08:05 AM, said:

Use one way encryption on the url before you put it into your code. Then when the code executes, it gets the current page location, encrypts it and compares it to the stored value. If they match, happy days and the code can execute.


Thank you - I shall go and explore "one way encryption" - help was appreciated, thanks
Was This Post Helpful? 0
  • +
  • -

#5 Moonbat   User is offline

  • D.I.C Regular
  • member icon

Reputation: 36
  • View blog
  • Posts: 424
  • Joined: 30-June 08

Re: Ideas on how I stop my code being used on more than one URL

Posted 25 February 2009 - 09:24 AM

View PostRich Head, on 25 Feb, 2009 - 08:10 AM, said:

Thank you - I shall go and explore "one way encryption" - help was appreciated, thanks

'One-way encryption' is a bit of a misnomer because in order for something to be encrypted, there has to be an algorithm to decrypt it. 'One-way encryption' actually refers to hashing. The most commonly used hashing functions in PHP are md5() and sha1().
Was This Post Helpful? 0
  • +
  • -

#6 Rich Head   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 25-February 09

Re: Ideas on how I stop my code being used on more than one URL

Posted 25 February 2009 - 09:26 AM

I have explored that option; I see two problems - one is I'd need to allow for URL with and without www. (I can include an OR to cover that); but it feels a bit unsecure as I assume anyone with any nounce would see what I'm doing; assuming I've understood this correctly and could change the encrypted URL by generating their own to match their URL?

Or worse - what's to stop them just deleting this code?

<?php
function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
 if (crypt($pageURL)!=='$1$jY1.wg3.$bezqFkllFg.x3vZjqihDM.') {
	don't let them use it!
 } else {
	all is good!
}
?>



This post has been edited by Rich Head: 25 February 2009 - 09:29 AM

Was This Post Helpful? 0
  • +
  • -

#7 Rich Head   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 25-February 09

Re: Ideas on how I stop my code being used on more than one URL

Posted 25 February 2009 - 09:35 AM

I am going OT now - apologies - but whilst in this subject space has anyone any experience of "PHP LockIt!"?
Was This Post Helpful? 0
  • +
  • -

#8 rmccarter721   User is offline

  • D.I.C Head
  • member icon

Reputation: 8
  • View blog
  • Posts: 139
  • Joined: 10-September 07

Re: Ideas on how I stop my code being used on more than one URL

Posted 25 February 2009 - 09:38 AM

How about...

When they register a license, they specify the domain they will be hosting it on, you then store this in a MySQL table...

Then at the start of your code you connect to YOUR MySQL database & table, check to see...

I am not sure how, but you can then just encrypt the contents of a file...
Was This Post Helpful? 0
  • +
  • -

#9 Rich Head   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 25-February 09

Re: Ideas on how I stop my code being used on more than one URL

Posted 25 February 2009 - 09:44 AM

View PostFurnfield, on 25 Feb, 2009 - 08:38 AM, said:

How about...

When they register a license, they specify the domain they will be hosting it on, you then store this in a MySQL table...

Then at the start of your code you connect to YOUR MySQL database & table, check to see...

I am not sure how, but you can then just encrypt the contents of a file...


Thanks Furnfield, I had considered something like this first off, but was concerned that my server (and database) might go offline whilst I'm on a 3 week holiday - effectively knocking out their web site for the same period - I guess I could code defensively and bypass the checking if the database connection fails (maybe even email myself so that I worry about my servers whilst I'm on holiday!)

There seems to be an abundance of encrypting tools out there - I might try the above in main "index.php" file for the site and just encrypt the main page...

It all feels a bit "Heath Robinson" and "Sledgehammer to nut" - interested in any other opinions...
Was This Post Helpful? 0
  • +
  • -

#10 rmccarter721   User is offline

  • D.I.C Head
  • member icon

Reputation: 8
  • View blog
  • Posts: 139
  • Joined: 10-September 07

Re: Ideas on how I stop my code being used on more than one URL

Posted 25 February 2009 - 09:50 AM

Unless you have your main server, which is used the majority of the time, but if it goes down it reverts to a back up server? A free one hosted somewhere?

But yes, all you need to encrypt is the main page.. But ensure that it includes stuff that they require for the whole site, otherwise you may find them creating their own main page...
Was This Post Helpful? 0
  • +
  • -

#11 Rich Head   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 25-February 09

Re: Ideas on how I stop my code being used on more than one URL

Posted 25 February 2009 - 09:55 AM

View PostFurnfield, on 25 Feb, 2009 - 08:50 AM, said:

Unless you have your main server, which is used the majority of the time, but if it goes down it reverts to a back up server? A free one hosted somewhere?

But yes, all you need to encrypt is the main page.. But ensure that it includes stuff that they require for the whole site, otherwise you may find them creating their own main page...


"Backup server" that suggests some forward planning on my part :P

I'm erring towards doing what we've discussed AND encrypting all source except the includes - that way they'd have no idea what did what or how.

Thanks again for help - much appreciated

Rich
Was This Post Helpful? 0
  • +
  • -

#12 CTphpnwb   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3795
  • View blog
  • Posts: 13,738
  • Joined: 08-August 08

Re: Ideas on how I stop my code being used on more than one URL

Posted 25 February 2009 - 09:58 AM

This is an interesting read:

http://www.dreaminco...wtopic54675.htm
Was This Post Helpful? 0
  • +
  • -

#13 Rich Head   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 25-February 09

Re: Ideas on how I stop my code being used on more than one URL

Posted 25 February 2009 - 10:03 AM

View PostCTphpnwb, on 25 Feb, 2009 - 08:58 AM, said:

This is an interesting read:

http://www.dreaminco...wtopic54675.htm


Lost on a newbie like me - I'll read it again (and again) and see if I can get it to sink in :blink:
Was This Post Helpful? 0
  • +
  • -

#14 CTphpnwb   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3795
  • View blog
  • Posts: 13,738
  • Joined: 08-August 08

Re: Ideas on how I stop my code being used on more than one URL

Posted 25 February 2009 - 10:11 AM

View PostRich Head, on 25 Feb, 2009 - 12:03 PM, said:

Lost on a newbie like me - I'll read it again (and again) and see if I can get it to sink in :blink:

Think of the bright side: You aren't going to have to worry about your code being copied until stuff like that doesn't confuse you! :D
Was This Post Helpful? 0
  • +
  • -

#15 chris.ballard   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 25-February 09

Re: Ideas on how I stop my code being used on more than one URL

Posted 25 February 2009 - 11:42 AM

Zend Optimizer and Zend Guard are your friends. You can encrypt your code with zend guard. Then just have your client install Zend Optimizer and voila your client can not read your code.

As far as enforcing a single URL, all you have to do is generate a config script when they signup with a hardcoded URL in it. They will not be able to modify this because you encrypting it with zend guard.


Hope this helps.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2