forum.coppermine-gallery.net

No Support => General discussion (no support!) => Topic started by: Oasis on October 29, 2003, 05:10:01 pm

Title: Password Protect Albums - Theory and Practice
Post by: Oasis on October 29, 2003, 05:10:01 pm
this brings us back to the topic of password protected albums!  :D
With password protected albums this would be much simpler...

gaugau, please DO consider this..  :)
I am getting requests for this feature every few days...
Title: Password Protect Albums - Theory and Practice
Post by: aymeric on October 29, 2003, 05:53:59 pm
Quote from: "oasis"
With password protected albums this would be much simpler


yes! that's a good idea :)
Title: Password Protect Albums - Theory and Practice
Post by: Oasis on October 29, 2003, 06:32:18 pm
gaugau, here is something that might work:

first, create a new column in the TABLE_ALBUMS called "albumpass".
When users specify a password while editing an album, then visibility becomes (FIRST_USER_CAT + USER_ID) and the password they specify is written into the albumpass column.

Then, in functions.inc.php where the script specifes which albums the user can't see
Quote
       $result = db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE visibility != '0' AND visibility !='".(FIRST_USER_CAT + USER_ID)."' AND visibility != '".$USER_DATA['group_id']."'");

add an extra criteria
Quote
AND albumpass != '".$HTTP_POST_VARS['albumpass']."'

Then all you have to do is show a form with an input box for users to type in a password, whenever they click on a private album that has a nonempty "albumpass" field.

OK, I don't know if this is actually feasible (I recall posting before that I hardly know any php...  :) ), but from what I have learnt in the past few months fiddling around with code, it seems to me that it should work. And  it doesn't seem to compromise the original authentication system (one of the concerns pointed out in the previous post on this subject)...
What do you think? Would it work?
Title: Password Protect Albums - Theory and Practice
Post by: DJMaze on October 29, 2003, 07:11:37 pm
The password protection you mention could work if...
All options like Lasts uploads, most views, etc. also block password protected albums from showing.

So it would be some more changes as you say.
Title: Password Protect Albums - Theory and Practice
Post by: Oasis on October 29, 2003, 08:08:57 pm
OK I've tried it out, but I had to use HTTP_GET_VARS instead of POST because I don't know where to change the code to add the password box.

Anyway, here are the results of my test:

Quote
The password protection you mention could work if...
All options like Lasts uploads, most views, etc. also block password protected albums from showing


It seems to do that automatically, since it is just processing that extra criteria. To show you what is happening, I created a new user called passwordtest.
Its user albums are at http://photo.enctu.org/passwordtest
There are two albums, both set to private (show only to owner). One of them has the albumpass set to "hello", the other is set to "world".

Now look at this:
http://photo.enctu.org/passwordtest&albumpass=hello
http://photo.enctu.org/passwordtest&albumpass=world
(Note the topviewed toprated random and lastuploaded pictures)

The same thing goes with the thumbnails:
No albumpass varible
http://photo.enctu.org/thumbnails.php?album=1630
Specified albumpass
http://photo.enctu.org/thumbnails.php?album=1630&albumpass=hello

So it seems that it could work, but it still needs an interface to type the password that only appears when it should... And maybe the variable could be kept accross pages, so if you entered it once it will be active throughout the session.

By the way, I jut found out a slight problem with my original idea. That is if no albumpass is specified, all albums with no password will be viewable (because the password matches...both blank). So I added a line so that if $albumpass is blank it will  be replaced by "hahahanoonewilleverusethispassword". I'm sure there is abetter way though.  :lol:
Title: Password Protect Albums - Theory and Practice
Post by: Oasis on October 31, 2003, 08:25:53 pm
OK so is anyone going to give me a clue on how to display the password box? I really can't find the place.
Title: Password Protect Albums - Theory and Practice
Post by: hyperion on November 01, 2003, 05:16:42 am
For a start, you should just be able to detect no password and then redirect to a password form. The use of empty instead of isset will also screen for blank password entries. This will output the form with the action to return to the same script.

-----------------------------------------------------
Code: [Select]

if (empty($_POST['password'])) {

    pageheader('Password Protected Album');
    print "<form action=\"$_SERVER['PHP_SELF']\" method=\"post\">";    
    print "Password:</td><td><input type=\"password\" name=\"password\"><br><input type=\"submit\" value=\"Log in\">";
    print "</form>";
    pagefooter();  
}

-----------------------------------------------------

Also, you could make it more elegant by adding another field to the album database.

Code: [Select]

Password_Protected             Password
        Y                        flip
        N
        Y                        flop
        N
        N


-Hyperion
Title: Password Protect Albums - Theory and Practice
Post by: Oasis on November 01, 2003, 12:52:35 pm
Thanks for the tip hyperion!  :)

OK I have a question... you know when we type
"index.php?lang=english"
and it is english throught the session (and even subsequent sessions)
how do I do the same do the same for $albumpass?

currently what i have managed to do is when you click into a private album, it asks you for a password. When they enter the right password, the pics in the album are shown... BUT when they click on the pictures themselves, the albumpass variable is not passed on and is lost, so the album goes back to being private, and it tells you that there are no images to display..

how do I make the variable pass on to displayimage.php?

here, you can take a look: http://photo.enctu.org/passwordtest
but the language is hardcoded, so you're gonna see only chinese but I'm sure you can guess what it's saying.
Title: Password Protect Albums - Theory and Practice
Post by: Oasis on November 01, 2003, 02:21:21 pm
OK I figured it out...  :D

in init.inc.php
Quote
if (isset($HTTP_POST_VARS['albumpass'])) {
    $USER['albumpass'] = $HTTP_POST_VARS['albumpass'];
}


and then GLOBAL $user in function get_private_album_set()

OK, I have completed the guest side of the password protection scheme (you can try it here: http://photo.enctu.org/passwordtest.the passwords should be obvious from the album names)
HOWEVER, I have had to make extensive changes to many parts of the code in various files, so it's gonna take me some time to write the changes out... Also, what I have done required changes in the theme.php, so I can see this isn't going to be an easy hack to implement...

I will now try to code the part for setting the password. I will post here if I have any news.
Title: Password Protect Albums - Theory and Practice
Post by: gazon_zaseyan on January 15, 2004, 05:08:27 pm
Hi guys,

 Can somebody tell me the whole process of installing that option? I did read the whole topic, but it looks kinda complicated... I don't wanna mess it up by changing wrong things...

is there a ready manual or something for installing this MOD?!

Thank you !
Title: Password Protect Albums - Theory and Practice
Post by: Joachim Müller on January 15, 2004, 05:13:18 pm
no, there's no manual or similar. This is not even considered a mod, but more a theoretical discussion. If you're not feeling comfortable with it (if you're not familiar with webserver stuff), my advice is to not play with it (i.e. not use/apply this).

GauGau
Title: Password Protect Albums - Theory and Practice
Post by: gazon_zaseyan on January 15, 2004, 05:23:38 pm
Quote from: "gaugau"
no, there's no manual or similar. This is not even considered a mod, but more a theoretical discussion. If you're not feeling comfortable with it (if you're not familiar with webserver stuff), my advice is to not play with it (i.e. not use/apply this).

GauGau


I probably wont :) thanks.

So isn't there any other MOD for password protected albums? :( That would be a really helpfull MOD, and I think not only for me...

are you planning on writing a MOD like that?

Thanks
Title: Password Protect Albums - Theory and Practice
Post by: Joachim Müller on January 15, 2004, 05:44:35 pm
one step at a time: we (dev team) have our workload set up for the current dev version (that will become the next coppermine release): passwords-protected pics won't be in it I'm afraid. If the next version is being released, we'll be going through the "feature requests" board and decide on which features will go into the future release.
Usually the dev team members don't write mods, but add code to the actual releases. Maybe someone else (who needs the modification as well) will take up the task and write a password-protection-mod.

GauGau
Title: How is the password protected album mod going?
Post by: itang on April 15, 2004, 09:22:50 am
I have read this post:

http://forum.coppermine-gallery.net/index.php?topic=1112

and I have found this cpg gallery applied password protection for each album successfully. But this album is in Chinese only. I think you can guest the opperation if you are familiar with cpg.

http://www.enjoyalbum.net/main.php?cat=13730

I have an account for your test: 123456 pass: test

However, the author havn't give any information about how he did it.

Can anyone follow this and provide a helpful hand to people who really want this function?
Title: Password Protect Albums - Theory and Practice
Post by: Joachim Müller on April 15, 2004, 09:43:31 am
is http://www.enjoyalbum.net/ your page?

GauGau
Title: Password Protect Albums - Theory and Practice
Post by: itang on April 15, 2004, 10:01:32 am
No, if it were my page I would not ask for this feature at here. :cry:
Title: Password Protect Albums - Theory and Practice
Post by: Joachim Müller on April 18, 2004, 07:34:54 am
enjoyalbum uses an illegal copy of coppermine, with modifications built in that are not within the "regular" coppermine files (it's not illegal to add features, but you mustn't remove the "powered by" tag at the bottom, that's why it's illegal). Hard to say how they did this and that feature, but I'm rather sure they won't tell :wink: . Please do not contact enjoyalbum on this, the dev team already has and will take care of the copyright issue.

GauGau
Title: Password Protect Albums - Theory and Practice
Post by: itang on April 18, 2004, 06:12:27 pm
OK. Hope that somebody can do us a favour and get the password protection to work.
Title: Password Protect Albums - Theory and Practice
Post by: doggystyle on April 18, 2004, 06:23:03 pm
so oasis, can you please send the changes you did to the files to get the pw-protection work?! :(
Title: Re: Password Protect Albums - Theory and Practice
Post by: kieranmullen on April 22, 2004, 05:59:08 pm
Would it be much easier than password protection to user tables that already exist?

Private Album Name would be made into a group. Admin could grant permisson to that group or the album owner could. Only album members would be able to view pictures from that album.
Title: Re: Password Protect Albums - Theory and Practice
Post by: Roshlin on April 23, 2004, 11:27:47 pm
Hi friends,

I don't know if this post belongs here. I just want too know if this is possible.
The user creates a gallery and has private albums, which only he and  his family and friends can access.
But he does not want others in the family editing his albums, so if he gives them the username and password , they will de able to edit or delete the photos. Could he have another password where his family can see,rate comment ,, but not delete/edit photos.
 ??? sort of admin mode and user mode for users gallery???

Thanks
Roshlin
Title: Re: Password Protect Albums - Theory and Practice
Post by: Joachim Müller on April 24, 2004, 01:20:52 pm
The family members mustn't use the uploaders username and password, but register for their own username and password. You (as gallery admin) will have to make them members of a special group (e.g. called "Family members"), and the uploader then grants permissions for this group to view the gallery.
It's basic for any application that deals with users and permissions that people have their own username and password, you can't have several people use the same username and still have different permissions for them.

GauGau

P.S. Your posting does not belong here. If you have problems configuring coppermine, post on a separate thread (start your own) with more details on what you actually want to do.
Title: Re: Password Protect Albums - Theory and Practice
Post by: doggystyle on April 27, 2004, 07:18:55 pm
i would like to use the solution oasis posted in this thread but he didn´t answer to pm or my post in this thread  :'(
Title: Re: Password Protect Albums - Theory and Practice
Post by: Casper on April 27, 2004, 07:37:56 pm
Unfortunately for us, Oasis has been too busy in his life to help on coppermine for some time now.  We hope he returns when he has the time.

But we ask that users of this forum DO NOT send unrequested PM's or emails to the supporters of this board.
Title: Re: Password Protect Albums - Theory and Practice
Post by: Einstein on April 28, 2004, 06:20:15 pm
Private Album Name would be made into a group. Admin could grant permisson to that group or the album owner could. Only album members would be able to view pictures from that album.
I see two options (both are have different purposes)
1. Password protected album
- A password field albums table, if empty no password
- This is the fast and easy way

2. User group permission (like above)
- A new table with user groups access rights
- This is a more organized way of doing it

BTW, I will probably make the number 2 if I have time
Title: Re: Password Protect Albums - Theory and Practice
Post by: doggystyle on May 01, 2004, 01:08:10 pm
Private Album Name would be made into a group. Admin could grant permisson to that group or the album owner could. Only album members would be able to view pictures from that album.
I see two options (both are have different purposes)
1. Password protected album
- A password field albums table, if empty no password
- This is the fast and easy way

2. User group permission (like above)
- A new table with user groups access rights
- This is a more organized way of doing it

BTW, I will probably make the number 2 if I have time

i prefer nr.1 because it's easier to handle for the users and you can invite peope which are not registered in the gallery. if somebody knows how to do this, please send it here
Title: Re: Password Protect Albums - Theory and Practice
Post by: crazy_heart on May 15, 2004, 04:42:37 pm
so oasis, can you please send the changes you did to the files to get the pw-protection work?! :(
yes please, I've been trying to do it but no luck yet! :( :-\\
Title: Re: Password Protect Albums - Theory and Practice
Post by: dt on June 17, 2004, 11:18:15 am
i have read this and still do not uderstand it  ???

i want my gallery only to be viewed by regisetered members only.
and do not allow them to create their own gallery

and only make my cpg gallery visble only to the memebers that i have activated their regiesteration


sorry if this has bee ask before
Title: Re: Password Protect Albums - Theory and Practice
Post by: Casper on June 17, 2004, 11:50:18 am

i want my gallery only to be viewed by regisetered members only.

see this mod. http://forum.coppermine-gallery.net/index.php?topic=3503.msg15506#msg15506


and do not allow them to create their own gallery

In groups, change 'can have personal albums' to NO for all groups.

and only make my cpg gallery visble only to the memebers that i have activated their regiesteration

There is no way at the moment to allow registration requests be approved first, but you can do the following workaround.
In config, set 'allow new user registrations' to NO.  Then edit your login page to tell unregistered users to email you requesting membership.  You will have to create the new user yourself, and email them the details.
Title: Re: Password Protect Albums - Theory and Practice
Post by: matkoo on July 28, 2004, 09:09:04 am
To be honest, I think this is one of really important features.
Most of my friends are not enough skilled to register and login. But they can fill in some password to see pictures.
So, friends, if it is possible, let me know. I am going to migrate from Menalto Gallery to Coppermine soon :-)

Martin
Title: Re: Password Protect Albums - Theory and Practice
Post by: yoshikiwei on July 28, 2004, 09:23:07 am
i believe a hack that i posted before could solve this issue
see here http://forum.coppermine-gallery.net/index.php?topic=4961.0

it requires the album owner to click on a link and send it to his friends/family
Title: Re: Password Protect Albums - Theory and Practice
Post by: Joachim Müller on July 28, 2004, 09:54:01 am
password protected albums are currently under development and will probably be in cpg1.4 (once it is going to be released).

GauGau
Title: Re: Password Protect Albums - Theory and Practice
Post by: matkoo on August 03, 2004, 04:09:24 pm
One pretty important note about this feature...
Categories as well as albums under protection would be great. I think that categories are even more important. I am looking for 1.4 therefore :-)
But... I think that password is sometimes kind of "correct answer" to some question (of course, usually the question is "Type current password").
But it could be like "type first name of our high school professor" and only responsible persons would know that it is "joachim". I am sure you got the idea - password protected without sending a password. So please let the owner set the question to be asked correctly.

This would move CPG big step forward comparing with similar products.
Title: Re: Password Protect Albums - Theory and Practice
Post by: doggystyle on August 05, 2004, 02:38:52 pm
password protected albums are currently under development and will probably be in cpg1.4 (once it is going to be released).

great news, when this is done i really don't have anything to ask for  :) . will there be an "invite user to this album by email"- link for every album?
Title: Re: Password Protect Albums - Theory and Practice
Post by: Casper on August 05, 2004, 02:59:32 pm
But... I think that password is sometimes kind of "correct answer" to some question (of course, usually the question is "Type current password").
But it could be like "type first name of our high school professor" and only responsible persons would know that it is "joachim".

This is very easy to acheive.  You would just have to edit your language file, and replace this;
Code: [Select]
'enter_alb_pass' => 'Enter Album Password',
with this;
Code: [Select]
'enter_alb_pass' => 'Type first name of our high school professor',
This is taken from the version 1.4 language file, you wont find it in 1.3x
Title: Re: Password Protect Albums - Theory and Practice
Post by: matkoo on August 05, 2004, 05:02:13 pm
But... I think that password is sometimes kind of "correct answer" to some question (of course, usually the question is "Type current password").
But it could be like "type first name of our high school professor" and only responsible persons would know that it is "joachim".

This is very easy to acheive.  You would just have to edit your language file, and replace this;
Code: [Select]
'enter_alb_pass' => 'Enter Album Password',
with this;
Code: [Select]
'enter_alb_pass' => 'Type first name of our high school professor',
This is taken from the version 1.4 language file, you wont find it in 1.3x

I think this is not the best way to do it, this question can be for every kategory/album different. Language file would change all questions for password.

Mat
Title: Re: Password Protect Albums - Theory and Practice
Post by: Casper on August 05, 2004, 05:30:46 pm
Yes, I didn't think of that. :-[

So what would be needed is an extra field in the database, along with the password, for the album admin to set an 'password prompt'.
And a box to input it, next to the password set box in modifyalb.php.
Title: Re: Password Protect Albums - Theory and Practice
Post by: matkoo on August 06, 2004, 08:25:47 am
Yes, I didn't think of that. :-[

So what would be needed is an extra field in the database, along with the password, for the album admin to set an 'password prompt'.
And a box to input it, next to the password set box in modifyalb.php.

Yes, that is it. Prompt+password should be part of category/album table in database.
Believe me, many many people have photos which are not completely confidentail, but not for public audience as well - family photos, photos with friends etc.

Mat
Title: Re: Password Protect Albums - Theory and Practice
Post by: Casper on August 06, 2004, 11:41:24 am
This is obviously feasible, but I will ask Tarique (the developer of the album passwords) if this will be easy to implement, and of course the dev team if it would be a function that is of enough value to add to the core code, or if it would be better as an available hack.
Title: Re: Password Protect Albums - Theory and Practice
Post by: Casper on August 06, 2004, 01:28:05 pm
@matkoo

Tarique is adding this (password prompt) to the development version, so should be in 1.4.  ;)
Title: Re: Password Protect Albums - Theory and Practice
Post by: matkoo on August 06, 2004, 03:53:14 pm
Huh, great!

I am really looking forward to it!
I am sure many people will appreciate it. Being a registered user is too much complicated for more than a half of internet users (IMHO). Typing a password is much easier. Another option could be possibility to disable masking password (the users will see typing the correct answer instead of '*' <- it may scare unexprienced users  ;D )

Mat