- This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hello.
I’m working on an image gallery.
Is there any way to only allow certain people to see the images and not everyone else on the net?
For example,
Bots scanning the net could see the images then copy them.
What is the best way to only allow authenticated users to see the images and prevent everyone else on the net from being able to see them?
Thanks.
What is the best way to only allow authenticated users to see the images
Authenticate your users. Once that’s done, serve them the image.
You’d need to write a separate script for serving the images, rather than allowing Apache/whatever server you use handle it normally. If you’re using PHP, look into using header
to set the appropriate http headers, and readfile
for actually serving the file.
This is a basic example of the mechanics, but keep in mind there are also security concerns. Doing this sort of thing can open you up to all kinds of vulnerabilities. If you don’t know what you’re doing, you can allow an attacker to gain total control of your site — so do your homework first. Ask if you have any specific questions.