代码告诉我,如果我的网站被盗 [英] Code to inform me if my website has been stolen

查看:100
本文介绍了代码告诉我,如果我的网站被盗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我编写了一些php代码来检查当前网站的URL,然后将其与它应该位于的URL进行比较,并且如果有人复制粘贴我的代码并在自己的网站上使用它,则通过电子邮件发送给我。然后我对着我的办公桌敲了一下头,意识到PHP将在服务器上执行,潜在的盗贼甚至不会看到那些代码。

所以我一直试图想到方法来停止我的网站简单的完整复制粘贴。是否有可能在java脚本中做这样的事情,或者是否会告诉我,如果我的网站被盗或如果它被破坏。

解决方案

您可以通过 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆