Fight theft of plugin by sending parameters with AJAX callback
<p>I have built a new jQuery plugin and I want to be able to demo this to the user before they can purchase this. But I also don't want anybody to be able to simple copy the code without paying for it. </p>

<p>For that reason I have encoded the plugin using <a href="http://www.vincentcheung.ca/jsencryption/" rel="nofollow">http://www.vincentcheung.ca/jsencryption/</a></p>

<p>I thought of 2 ideas to further protect/make it harder to copy:</p>

<ul>
<li>Hard code the domain name check against <code>window.location.hostname</code></li>
<li>Using AJAX send as much information about the website back to a PHP script on my server. </li>
</ul>

<p>What extra information can be fetch using Javascript apart from the domain name. E.g. PHP you have the $_SERVER[].  </p>

<p>Do you have any ideas to protecting it further?</p>

<p>Ok I just have just wrote this myself and this, seems to work on two different domains. </p>

<pre><code>$.ajax({
    url: 'http://example.co.uk/record.php',
    type: 'post',
    data: 'href='+document.location.href + '&amp;referrer='+document.referrer
});
</code></pre>

<p>Record.php</p>

<pre><code>mysql_query("INSERT INTO `demo` (`id` ,`datetime` ,`href` ,`referrer`)VALUES (NULL ,CURRENT_TIMESTAMP , '".$_POST['href']."', '".$_POST['referrer']."')");
</code></pre>
