Password Protect Lightroom Galleries

Over the past several months, I’ve received a number of requests for a password protected gallery for Lightroom. It would be easy enough to construct a password protected variant of one of my existing galleries. I could, for example, add password protection to my TTG Slimbox Gallery. But then, what if someone wanted to password protect a SimpleViewer gallery instead? Or an AutoViewer gallery? A Polaroid gallery?

Having no desire to contend with such questions or the inevitable requests for just one more password protected gallery, I’ve sought out and come up with a universal solution: a PHP script that allows users to password protect any gallery or webpage they want.

Simply titled, Password Protect, from Zubrag.com, is a PHP script that does just what its name would imply. It’s easy to install and setup, and it works with any gallery or webpage you’d like to use it on.


Password Protect

Download | Demo

To log into the demo, use the login and password “melody” and “taru”, respectively.

Requirements

All that’s required to get this running is a web server equipped with PHP (most of them are, these days). Note: the script will not run from your desktop; it will run only from a web server.

Setup

Setup is simple. Begin with an exported gallery from Lightroom.

Copy the password_protect.php file into the exported gallery folder.

Open the password_protect.php file in a text editor and create one or more username and password combinations. The instructions are at the top of the file, so it should be self-explanatory.

Save the file and upload the gallery to your website.

Point your browser to your gallery address, appended with password_protect.php?help. Example:

http://theturninggate.net/galleries/PasswordProtect/password_protect.php?help

You will be provided with a line of PHP code. Copy and insert the code into the first line of every page you would like to protect. In the case of a Lightroom gallery, you should open the index.html file and insert the code on the first line. Save the file, and rename the file to have a .php extension (i.e. index.html should be renamed index.php).

Coda

There are, of course, alternative solutions. Scripts abound on the Internet. I chose this script in particular for its simplicity, flexibility and freeness.

Send this article to a friend »

« Next Article | ... ... | Previous Article »

Comment »

23 October 07 / permalink

Hi Matthew,
When I saw this request, I came across loads of scripts, but this is probably the handiest way..

23 October 07 / permalink

Agreed, Sean. Luck of the draw getting this one in my Google search. Glad I did, though. ;)

Glad to find people concurring.

21 February 08 / permalink

Feeling especially thick – I’m unable to follow this. I don’t know where the exported gallery is apart from on the net and my FTP program won’t copy paste the php file.

Where am I going wrong?

Thanks

21 February 08 / permalink

Paul,
I need more information to determine where you’re going wrong. I’ll email you and we’ll get you sorted out.

24 February 08 / permalink

I have monoslideshow set up so that has more than one album. At the moment the php script you recommend will ask for a password then allow you to see all albums. Is there any way that you could modify the php so that it would work for just one of these albums?
I can only think of using htaccess to protect the photos within a folder for the album you want to protect. But htaccess will ask permission on all images until it has a correct password.
Thanks for all you work it has been incredibly helpfull!!

24 February 08 / permalink

Hi Mike,

You can’t password protect just one album in a MonoSlideshow gallery. You’d have to protect the entire page, or nothing at all. The PHP works on the page, and doesn’t interact with the images or the Flash components.

The best thing you can do is produce a separate, protected gallery, for the albums you want to protect. And then you’ll need to create a separate gallery page for each client.

Jay
4 March 08 / permalink

Hi Matt,
I’m having the same problem as Paul (listed above). I don’t think I am getting this.

I have three albums (all generated from LR) and I would like to password protect only one of them. Is this possible?
If so, I copied the password_protect.php file into one of my album folders and got the ‘code’ from … password_protect.php?help; pasted onto the first line of the index.html of the album and renamed it index.php

When I open the link, I get an error:
Parse error: syntax error, unexpected T_STRING in /home/username/public_html/album_name/index.php on line 2

I am probably doing something that’s quite simple completely wrong. I’d really appreciate your help.
thanks!

4 March 08 / permalink

Jay,

Each gallery is password protected individually, so yes, entirely possible.

Hard to say what the problem is without seeing your gallery, though. The basic instructions are thus:

What you’ll need to do is copy the password_protect.php file into each of the galleries you want to protect.

You will need to edit the password_protect.php file using a text-editor to set login and password combinations. The instructions are in the file; when you open it, you should see them towards the top. Follow those instructions, and let me know if you have problems.

After editing the password_protect.php file, you’ll need to access it via a web browser, appending ?help to the end of the URL, like this:

www.domain.com/gallery/password_protect.php?help

That will generate a line of code. You’ll need to copy this line of code, then paste it onto the first line of the index.html file you want to protect.

Rename index.html to index.php, and that should be all.

If you still have problems, contact me via email, matthew [at] theturninggate [dot] net, and I’ll try to sort you out.

4 March 08 / permalink

Hello,

I have followed the instruction to a tee and yet I keep getting this error in safari.

Parse error: syntax error, unexpected T_STRING in home/ben/public_html/headshots/zinalee/index.php on line 2

Any ideas? I checked out line 2 in the index.php file and it was the original line one from the index.html file.

Thanks
Ben

4 March 08 / permalink

Ben,
Can you zip your index.php file and mail it to me at the address in my last post?

5 March 08 / permalink

Mathew,

Thanks I emailed you the zipped file this morning. You can email me at ben [at] bengeldreich [dot] com.

cheers

ben

20 March 08 / permalink

Posted for reference:

For folks receiving the same errors as Ben, above, remove the XML prog, <?xml version=“1.0”; ?> from your page. That code deleted, things should work.

22 April 08 / permalink

I’m trying to get this to work by following the directions, however, when I go to the address that should give me the line of code, firefox just opens the download dialog for the password_protect.php file…any ideas?? I’m new to building/maintaining a website, so I have no clue what I’m doing wrong.

22 April 08 / permalink

I wonder if you’ve somehow setup Firefox to download PHP files rather than process them. I’m not really sure. Have you tried in another browser?

Name:

Email:

URL:

Comments support Textile formatting & Gravatars.

my personal information

Find

Categories

Lightroom Galleries

Lightroom IconWeb photo gallery templates, tutorials and resources for the Adobe Lightroom Web module.