Approval code/access code / invitation code (register.php) Approval code/access code / invitation code (register.php)
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Approval code/access code / invitation code (register.php)

Started by narakalex, August 05, 2005, 09:34:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

narakalex

I've looked in the forum if there was any solution to my problem.. but haven't found any.. the closet was a registration where the email address have to comply with a predefined domain (@example.com)...

My problem is that.. i would like to have a public photomine gallery.. but i want to restrict everybody from registering to my website..

I'd like to be able to give out "approval/access" codes to my friends.. so that they'll be able to register.. cuz they know the access/approval code for the registration process...
It should proberly be something like this...(when people click on "register")

Username: mojojojo
Password: cpg
Re-enter password: cpg
Email: mojojojo@example.com
Approval-code: cpgrules

So basically it would only be people that knows the approval-code (that i have given out to people) that would be able to register to the website..

Any way to do this?

(PS. Just a simple hack of the register.php to check for the approval/access code would be a way i think... but how to come about this?... )

The closets solution i've been able to find is:  http://forum.coppermine-gallery.net/index.php?topic=16615.0

But since my friends have emails at different domains, this solution wouldn't work for me..  :(

narakalex

#1
a half solution..

You need to add 3 lines of code in register.php

Find this in register.php:
        array('input', 'occupation', $lang_register_php['occupation'], 255),
After occupation add the following line (new line)
   array('input', 'approvalcode', $lang_register_php['approvalcode'], 255),

Then find this in register.php:
$occupation = addslashes(get_post_var('occupation'));
After occupation add the following line (new line)
$approvalcode = addslashes(get_post_var('approvalcode'));

Then find this in register.php:
if (!eregi("^[_\.0-9a-z\-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$", $email)) $error .= '<li>' . $lang_register_php['err_invalid_email'];
After email add the following line (new line)
if (strstr($approvalcode,'cpgrules') != 'cpgrules') $error .= '<li>You must enter the approvalcode in the last box (below occupation)';

(if you want more then just 1 approvalcode/access code add this line instead..)
if (strstr($approvalcode,'cpgrules') != 'cpgrules' && strstr($approvalcode,'cpgrules2005') != 'cpgrules2005') {
    $error .= '<li>You must enter your approvalcode in the last box (below occupation)';
}



There is 1 small problem.. when people go to the registration page... There is no text to say that you need to enter a "approvalcode" in the last box..
This only comes when people try to register without the approvalcode.. then a error message comes.. stating "You must enter the approvalcode in the last box (below occupation)"

Any way to solve this?

(PS. This example is a TOTAL rip-off of "GauGau" so some credit should go to him for solving 90% of the problem...)
Rip-off: http://forum.coppermine-gallery.net/index.php?topic=16615.0

Nibbler

You either add a translation into the lang files for $lang_register_php['approvalcode'] or you just hardcode what you want instead of refering to this non-existant variable.