Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to prohibit copying code on php web pages

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how the php web page forbids copying code, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Php web pages prohibit copying code: 1, log in to the php virtual host; 2, enter the root directory of the website; 3, find the index.php file under the corresponding template; 4, through "_ document.onselectstart=new Function (...)" Code implementation forbids copying.

This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer

Forbid others to copy the code of the page content of my website:

Many webmasters hope that their original articles will not be stolen by others. Because every article is painstakingly written, today a webmaster's article has been copied and published by others, so how should we prevent others from copying the content of your site?

There are many ways, but the more practical one is to prohibit copying web content and the right-click function. The editor of the www.51b host will teach you how to modify it:

First, log in to your php virtual host through your ftp tool, enter the templates folder under the root directory of your website (worry-free host users enter the public_html directory), enter the template corresponding to your website, and find the index.php file under the corresponding template.

In view of the different template formats of different files, index.php is only a common format, depending on the program.

Just put the following code inside the index.php file

_ document.oncontextmenu=new Function ("event.returnValue=false;"); / / screen right _ document.onselectstart=new Function ("event.returnValue=false;"); / / screen mouse drag

So no one can steal the content of your website!

The above is all the contents of the article "how to prohibit copying code on php web pages". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report