This will generate a random password when you signup.
In signup.php after:
PHP Code:
if ($arr[0] >= $maxusers)
die("The current user account limit (" . number_format($maxusers) . ") has been reached. Inactive accounts are pruned all the time, please check back again later...");
?>
ADD
PHP Code:
<script language="JavaScript"> function randomPassword(length) { chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ234567890"; pass = ""; for(x=0;x<length;x++) { i = Math.floor(Math.random() * 62); pass += chars.charAt(i); } return pass; } function randomPass() { pass = randomPassword('7'); document.getElementById('p1').value = pass; document.getElementById('p1').type = "text"; document.getElementById('p2').value = pass; } </script>
THEN FIND:
PHP Code:
<input type="password" size="40" name="wantpassword"/>
AND
PHP Code:
<input type="password" size="40" name="passagain"/>
REPLACE WITH:
PHP Code:
<input type="password" size="40" name="wantpassword" id="p1"/>
PHP Code:
<input type="password" size="40" name="passagain" id="p2"/>
AFTER DOING THAT WE NEED TO ADD THE BUTTON:
In my case after:
PHP Code:
<input type="password" size="40" name="wantpassword" id="p1"/>
ADD THIS:
PHP Code:
<input type="button" value="Generate" onclick="randomPass();" />
Thats it!
NOTE: If you want to change the password lenght just edit this line where 7 is the number of letters generated:
PHP Code:
pass = randomPassword('7');
You can also change the characters too in this line:
PHP Code:
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ234567890";