Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Approval code/access code / invitation code (register.php)  (Read 7679 times)

0 Members and 1 Guest are viewing this topic.

narakalex

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Approval code/access code / invitation code (register.php)
« on: August 05, 2005, 09:34:25 pm »

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..  :(
« Last Edit: August 07, 2005, 02:13:44 pm by narakalex »
Logged

narakalex

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Approval code/access code
« Reply #1 on: August 06, 2005, 10:06:10 am »

a half solution..

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

Find this in register.php:
       
Code: [Select]
array('input', 'occupation', $lang_register_php['occupation'], 255),After occupation add the following line (new line)
   
Code: [Select]
array('input', 'approvalcode', $lang_register_php['approvalcode'], 255),
Then find this in register.php:
Code: [Select]
$occupation = addslashes(get_post_var('occupation'));After occupation add the following line (new line)
Code: [Select]
$approvalcode = addslashes(get_post_var('approvalcode'));
Then find this in register.php:
Code: [Select]
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)
Code: [Select]
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..)
Code: [Select]
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
« Last Edit: August 06, 2005, 10:24:49 am by narakalex »
Logged

Nibbler

  • Guest
Re: Approval code/access code (register.php)
« Reply #2 on: August 06, 2005, 05:20:33 pm »

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.
Logged
Pages: [1]   Go Up
 

Page created in 0.042 seconds with 19 queries.