Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Downloads (http://www.bvlist.com/forumdisplay.php?f=16)
-   -   [MOD] Random Password Generator (http://www.bvlist.com/showthread.php?t=11023)

Chez 15th November 2016 16:24

[MOD] Random Password Generator
 
This will generate a random password when you signup.

http://s13.postimg.org/8567s7d1z/screenshot_16.png

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++)   {     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"


BamBam0077 30th November 2021 01:31

pass = randomPassword('6');

chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX YZ234567890";

pass = randomUsername('12');

chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX YZ234567890";

Bump:
PHP Code:


Username:


All times are GMT +2. The time now is 13:03.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.