The simpler media website CMS
Hello,
Webhttrack or equivalent can make a copy of my Zenphoto website.
I've included a warning.php in index, album and image .php files, but I receive too many messages (one per page when someone uses such a tool !)
Is there any plugin that could help me ?
Here is my warning file that does work :
<?php function get_ip() { // IP si internet partagé if (isset($_SERVER['HTTP_CLIENT_IP'])) { return $_SERVER['HTTP_CLIENT_IP']; } // IP derrière un proxy elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { return $_SERVER['HTTP_X_FORWARDED_FOR']; } // Sinon : IP normale else { return (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''); } } $navigateur = $_SERVER["HTTP_USER_AGENT"]; $bannav = Array('HTTrack','httrack','WebCopier','HTTPClient','websitecopier','webcopier'); //Ajoutez différents user-agent dans la liste foreach ($bannav as $banned) { $comparaison = strstr($navigateur, $banned); if($comparaison!==false) { echo '<br>
Comments
What is your intend? To block anyone to copy content from your site? I am not sure that is possible because a website and all of its content is public by default. The only way would be to password protect everything and best serverside via htaccess. But that of course would exclude the public as well.
If it is just for images there is some hotlinking protection htaccess linked from our user guide.
Also there are service like the Internet Archive that also do this and which is probably not to block.
Also note that user agent etc are not always reliable infos send and these can be wrong, too.
Of course, everyone is able to browse my website.
The script I've added adds a warning on the copy, on each page.
The content is below, far below (I've added several br to the warning)
The warning is not displayed on the website !
I now use two warning.php files :
Here is the result if you copy my site :
Okay, so no blocking, just an addition. That of course can be removed if anyone really wants to. (Btw, over here I would be more or less allowed to copy if it is only to my own personal usage and education and a public source. We have a term "private copy" over here.)
Instead of having an extra file you could possibly create a plugin using the "theme_body" filter that is fired right after the
<body>
tag to inject this automatically.We also have a "private copy" law in France, allowing us to copy our discs, cd, dvd ...
But right now, I've not found terms about websites ...
I will learn how to make a plugin (this one should be easy)
... and I've moved the email function in my" if" loop, because, email was send on each visit of index.php ... beginner error ...
I guess sort of EU wide by now. Over here it cover all media from books to digital generally.
A plugin is not that complicated. You find a demo plugin here:
https://github.com/zenphoto/demo-plugin
You only need a single file one for this. That demo plugin has already the right
$plugin_is_filter = 5 | THEME_PLUGIN;
call.There is also already a fillter hook used. Just replace "theme_head" with "theme_body_open" (sorry wrong name above from memory). If you made a custom theme be sure you have
<?php zp_apply_filter('theme_body_open'); ?>
right after the<body>
element on all theme pages.Then assign a function to that filter hook that does your check and outputs as before. That should be all.
And for mailing you could also use Zenphoto's own mail function https://docs.zenphoto.org/1.5.3/function-zp_mail.html. You could also get the mail from your admin account itself but that's perhaps something for later. But the plain php mail() will work as well of course.
Wer sucht, der findet ?
Hello acrylian. When I was younger, I could speak and write German.
Thank you for your comments and help. I've started studying "how to" plugin !
I have found 2 things that might be interesting for Zenphoto users
1 Best way to stop people ripping your website is to use a modified .htaccess
Here is what I added in mine, and I cannot copy anything anymore from my website using Webhttrack website copier :
Source link
You remove the first line, and copy everything BEFORE
IfModule mod_autoindex.c
otherwise, it will not work.
Clic here to see my file
2 I have found a french official term stating you cannot rip a website, even for your private purpose :
Official link :
Problem solved
I must remove my warning.php include lines now !
As you can see below, nothing is copied :
you get this screen just after starting your ripping
Clicking the "explore your website" button opens the google search page as expected.
That htaccess excludes a lot of user agents. That info may of course be modified (you can send a cURL request and send any user agent you like). So whatever user agent you missed or pretends to be something else might still come through. So 100% bullet proof this will not be I fear.
Not bad, correct would be "Wer suchet, der findet" ;-)
Cools, sadly I never learnt French.
You are right : if you can see a picture over a web browser, you will always be able to copy that picture.
Many agents in my htaccess, yes.
Most people are not able to send a cURL request.
So it's a rather good protection.
I open a new subject about disabling right clic menu.
All right, just wanted to point out that this neither is or can be "bullet proof"
Please don't do. This can be done via JS but anyone can easily disable JS in its browser and bypass it. And for all others it cripples the browser abilities.
https://www.zenphoto.org/news/site-protection/
Too late ..
Can you disable body tag too ?