1
rickh
[pass protected registration] adding password field
  • 2004/10/21 20:12

  • rickh

  • Just popping in

  • Posts: 94

  • Since: 2004/4/9 6


Hello, I want the registration process making password protected. Only people who know the password can complete the registration.

First i've added an extra field in /include/registerform.php:

$reg_form->addElement(new XoopsFormText(Code"code"2625), true);


And then i've added a line in register.php (after 'function userCheck')

if ($code != 12345) { die("wrong code");  }


I've also added the variable '$code' in the function userCheck. So it look like this:

function userCheck($uname$email$pass$vpass$code)
{
    
    
//added by me
    
if ($code != 12345) { die("wrong code");  }
    
//added by me

    
global $xoopsConfigUser;
    
$xoopsDB =& Database::getInstance();
    
$myts =& MyTextSanitizer::getInstance();


But it wont work Anyone got an idea??

2
tklee
Re:[pass protected registration] adding password field
  • 2004/10/21 20:22

  • tklee

  • Just popping in

  • Posts: 8

  • Since: 2004/7/18


There are two solutions (one hack, one module) already out there -- maybe you wanna use them instead of developing a new one.

One is called Registraion Codes (a module + some hack); the other is called Registration Keys (a core hack well integrated into the admin). I wrote a quick (and subjective) comparison between them.

Here's the whole thread.

3
Mithrandir
Re: [pass protected registration] adding password field

Are you adding the $code parameter to the call of userCheck()?

4
rickh
Re:[pass protected registration] adding password field
  • 2004/10/21 22:03

  • rickh

  • Just popping in

  • Posts: 94

  • Since: 2004/4/9 6


Quote:

tklee wrote:
There are two solutions (one hack, one module) already out there -- maybe you wanna use them instead of developing a new one.

One is called Registraion Codes (a module + some hack); the other is called Registration Keys (a core hack well integrated into the admin). I wrote a quick (and subjective) comparison between them.

Here's the whole thread.

thanks for the links Didn't know there was already such a module. But when I use the registration codes module, the registerform remains blank

Quote:
Are you adding the $code parameter to the call of userCheck()?

well... i'm just trial and error-ing.. Maybe u can tell me what's the right way to do this? It seems that the $code parameter wont be send to register.php, because when i do "echo $code" it returns nothing.

5
Mithrandir
Re:[pass protected registration] adding password field

register.php, line 135:
$stop userCheck($uname$email$pass$vpass);

did you change that to
$stop userCheck($uname$email$pass$vpass$code);

6
rickh
Re:[pass protected registration] adding password field
  • 2004/10/21 22:32

  • rickh

  • Just popping in

  • Posts: 94

  • Since: 2004/4/9 6


well, i've deleted $code already from function Usercheck. Or is it necesarry to add it to that function?

And the code doesn't have to be stored in the database. It's just to check right code (12345). Extremely simple. It's just a temporary sollution.

7
Mithrandir
Re:[pass protected registration] adding password field

Well, you were a bit unspecific about WHERE you placed that check of the $code variable.

If you just want it to be checked after filling out the registration form, you should place it somewhere just before line 135
$stop userCheck($uname$email$pass$vpass);

but still inside the
case 'newuser':

branch.

8
rickh
Re:[pass protected registration] adding password field
  • 2004/10/21 23:05

  • rickh

  • Just popping in

  • Posts: 94

  • Since: 2004/4/9 6


Thanks!! That worked I've placed it after case 'newuser' and include header.php.

Login

Who's Online

330 user(s) are online (256 user(s) are browsing Support Forums)


Members: 0


Guests: 330


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits