WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : complete simply working javascript password generator file. Use letter, vowels, consonants (uppercase and lowercase) arrays to create a really random and secure password. improved security using time functions to initialize random number generator.
Categories : Java Script, HTML, Security, Authentication, Strings Update Picture
Aureliano Rama
Date : Jun 12th 2002
Grade : 2 of 5 (graded 4 times)
Viewed : 20430
File : jspassgen.html
Images : No Images for this code example.
Search : More code by Aureliano Rama
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<html>
<head>
<title>JSPassGen v2.1</b></title>

<script language="javascript">
<!-- //hide

// JSPassGen v2.1
// Javascript password generator
// by Ummon <jeffhawke@iname.com>
// heavily based on Jpass v1.1 (Kelv 2000 kelv@kelv.net)
// http://freshmeat.net/projects/jpass/

/*
        complete simply working javascript password generator file. Use letter,
vowels, consonants
(uppercase and lowercase) arrays to create a really random and secure password.
        improved security using time functions to initialize random number generator.
        can be embedded in html and can be used in HTML event handler like onclick
and onmouseover.
        tested in Explorer, Netscape and Mozilla enviroment.

        This little script uses some arrays of consonants, vowels and digits to
create a really random
password
        As javascript doesn't have a reliable random function, it use more layers of
randomizers than
normally required for such a script.

*/

function choice(arg)
//return random index number in valid range of arg array
{
        return Math.floor(Math.random()*arg.length);
}

function randstr(arg)
//return random argument of arg array
{
var str = '';
var seed = choice(arg);
        str = arg[seed];
return str;
}

function initialize()
//use actual time to initialize random function as javascript doesn't provide an
initialization function itself
//to get more random, use getMilliseconds() function
//don't use getTime() as it produces numbers larger than 1000 billions, eheh
{
        var count=new Date().getSeconds();
        for (c=0; c<count; c++)
                Math.random();
}

function mkpass()
{
        //use of initialize() can decrease speed of script. On really slow systems,
disable it.
        initialize();

        //password length
        var pass_len=10;

        var cons_lo =
['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']
;
        var cons_up =
['B','C','D','F','G','H','J','K','L','M','N','P','Q','R','S','T','V','W','X','Y','Z']
;
        var hard_cons_lo = ['b','c','d','f','g','h','k','m','p','s','t','v','z'];
        var hard_cons_up = ['B','C','D','F','G','H','K','M','P','S','T','V','Z'];
var link_cons_lo = ['h','l','r'];
var link_cons_up = ['H','L','R'];
var vowels_lo = ['a','e','i','o','u'];
var vowels_up = ['A','E','I','U']; //O (letter o) and 0 (number zero) get
confused
        var digits = ['1','2','3','4','5','6','7','8','9'];

        //change at will how many times digits appears in names array. Order doesn't
matter
        var names = [cons_lo, cons_up, digits, hard_cons_lo, hard_cons_up, digits,
link_cons_lo,
link_cons_up, digits, vowels_lo, vowels_up, digits];

var newpass= '';
        for(i=0; i<pass_len; i++)
         newpass = newpass + randstr(names[choice(names)]);

return newpass;
}

// -->
</script>

</head>
<body bgcolor=#ffffff>

<center>
<b>JSPassGen v2.1</b><br>
(c) 2002 <a href="mailto:jeffhawke@iname.com">Ummon</a>
<br><br>

Onclick event on button:<br>
<form name="pswd">
<input type="text" name="pass" size="15">
<input type="button" value="Generate" onclick="document.pswd.pass.value=mkpass()">
</form>

Onclick event on link:<br>
<form name="pswd2">
<input type="text" name="pass" size="15">
<a href="javascript:void(0)" onclick="document.pswd2.pass.value=mkpass
()">Generate</a>
</form>

</center>


</body>
</html>



Prevent Right Mouse steal your graphics
Categories : HTML, Java Script, Security
MD5 secured login
Categories : PHP, Java Script, Authentication, Security
Password using php, Javascript, and html form
Categories : Security, PHP, Authentication, Java Script
Random Password Generator
Categories : PHP, Strings, Security
How to create <SELECT> menues that change on the fly according to other <SELECT> menues on the page?
Categories : Java Script, HTML
Javascript linked dropdowns
Categories : Java Script, HTML, Classes and Objects
Javascript animated menu items
Categories : DHTML, CSS, Java Script, HTML
Authenticator for Exchange Server LDAP
Categories : PHP, Authentication, LDAP, Security, Sessions
phpSecurePages is a PHP module to secures pages with a loginname and password. It handles multiple user groups (each has own viewing rights), store data in a MySQL database or a configuration file, and can be used to identify Web site viewers.
Categories : PHP, Security, Authentication
Bouncing Marquee at Status Bar
Categories : Java Script, HTML, Browsers
A damaged image generator (class) for validating text. CAPTCHA - Completely Automated Public Turing test to tell Computers and Humans Apart
Categories : PHP, PHP Classes, Security, GD image library, Security
Use of bitmasks to represent permissions
Categories : PHP, Authentication, Bitwise Operators, Security, PHP Classes
Check if Javascript is Enabled or Disabled - Works in all Browsers
Categories : Java Script, HTML, Web Browsers
Page Loading Message shown during the time your site's page is being loaded.
Categories : HTML, CSS, Java Script
Javascript Background Scroller
Categories : Java Script, CSS, HTML