代码告诉我,如果我的网站被盗 [英] Code to inform me if my website has been stolen
问题描述
您可以通过 document.domain
在Javascript中检查域名,如果它与您的域名不匹配,请向您的服务器发送一封AJAX请求以发送电子邮件。
确保您通过uglify,minify等来混淆代码。
这样可以避免新手拷贝你的页面而无需阅读代码,而体面的程序员则可以找出并删除它。
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 realizing 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.
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.
这篇关于代码告诉我,如果我的网站被盗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!