This topic is locked
[SOLVED]

 Random password generated in register.php

7/3/2006 12:30:22 AM
PHPRunner General questions
W
wrjost author

Hello, everybody,

after having tested the demo thoroughly I decided to buy it - and here comes my first question:
in order to minize abuse I would like to assign a random password for new users instead of letting them choose their own.
Any suggestions/experience/code for register.php?
Greetings,
Wilfried

Admin 7/3/2006

Wilfried,
you'll need to edit generated register.php file manually.
At first remove Password and Confirm password boxes from the page.

Replace the code reading this password from the POST data with random password generator.
Here is the password generator code from remind.php file

// generate 6 letters length password

$password="";

for($i=0;$i<6;$i++)

{

$j=rand(0,35);

if($j<26)

$password.=chr(ord('a')+$j);

else

$password.=chr(ord('0')-26+$j);

}

W
wrjost author 4/23/2007

Hello, everybody,

being a conservative person, I just now upgraded my project from 3.0 to 3.1 (build 218). (Everything worked fine until that point.)
Two questions:

1.) What do I have to do so that the random password generation works again in register.php with version 3.1?
2.) Will those changes work in 4.0 beta as well or do I have to redo everything again?
Thank you,

Wilfried

Admin 4/23/2007

Wilfried,
version 3.1 Register page acts slightly different.

You need to find this snippet in your register.php file:

$strPassword = $values["password"];



and add this code just after:

// generate 6 letters length password

$password="";

for($i=0;$i<6;$i++)

{

$j=rand(0,35);

if($j<26)

$password.=chr(ord('a')+$j);

else

$password.=chr(ord('0')-26+$j);

}

$strPassword=$password;

$values["password"]=$password;



where "password" is your actual field name.