Code to inform me if my website has been stolen
So I wrote some php code to check the URL of the current site then compare it to the URL it should be located at and to e-mail me if somebody copy pasted my code and used it on there own site. Then I hit my head against my desk realizin开发者_如何学Cg that the PHP would be executed on the server and potential thieves would never even see that code.
So I keep trying to think of ways to stop a simple full copy paste of my website. Is it possible to do that sort of thing in java script or something that would inform me if my website was stolen or make it break if it was.
So I keep trying to think of ways to stop a simple full copy paste of my website
The short and long of it is that it's impossible. If your web site contains a specific design, it is protected by law. You may be able to fight blatant rip-offs through legal means.
Other than that, there's no reliable way to protect HTML source code.
You could check the domain name via document.domain
in Javascript, and if it doesn't match your domain, make an AJAX request to your server to send an email.
Make sure you obfuscate the code through uglify, minify, etc.
This would protect it from newbies copying your pages without reading the code, whereas decent programmers would be able to figure it out and remove it.
You can obfuscate Javacscript to make if more difficult to understand but even this is possible to disentangle and reuse. You can try the same techniques in HTML but again these are not impossible to reverse.
This is not really possible. You can verify HTML and Javascript on other websites but unless you are google, your server will never be able compare your websites's Html or JS with other website.
Just warn people in your code that using your code could lead them to a law suit.
You could add an invisible image to your code (. If the person copying your code is stupid enough not to check for this, request for this image for the other persons site will show up in you log with the refferer set to the other persons page url.
精彩评论