T4VN is an online PHP Help community that provides PHP Tutorials, PHP Examples, PHP Scripts, PHP Support
    HOME  |  HOSTING COUPON  |  TEMPLATE  |  PHP SCRIPTS  |  LINK TO US  |  LINK  |  REGISTER | CONTACT
::: Member Login :::
 Username
 Password
 
Forgot your password ?
::: PHP Tutotal :::
  PHP Basic (7)
  PHP Advanced (4)
  PHP Database (2)
  Coding Step By Step (8)
  PHP and AJAX (0)
::: PHP Example :::
  Arrays (1)
  Code Highlighters (3)
  Database Functions (12)
  Date & Time (5)
  E-Mail (6)
  Forms (5)
  Guestbooks (1)
  Logging (2)
  Miscellaneous (10)
  Password Generators (3)
  Randomizers (3)
  String Manipulation (10)
  User Authentication (6)
::: Search On T4VN :::
::: T4VN Statistics :::
  PHP Scripts : 64
  PHP Example : 67
  PHP Tutorials : 21
  PHP News : 93
  Total Coupon : 36
  Other Tutorials :
  Member : 215
  Visitor Online : 2
  Today Visit: 128
  Total Visitor : 285994
  Most Online : 41
::: Sponsored Links :::

PR 4 For This Webpage

Vinaora Logo
Home Today :

PwdGen

Author : Zapotek

A simple, pesudo-random, password generator written in PHP ( Command Line Interface ).

PHP Example :

#!/usr/bin/php
<?php
/********************************************************************
 * Author Info
 * -----------
 * Author:       Zapotek
 * E-Mail:       zapmade[at]gmail.com
 * 
 * File Info
 * ---------
 * Name:           PwdGen
 * IDE Used:       Eclipse IDE using the PHPEclipse Plug-In
 * OS Used:        Novell SuSE Linux 10
 * Tested Under:   PHP 4.3.11 (cgi)
 * 
 * Comments
 * --------
 * Just a:
 * Pseudo-Random Password Generator
 ********************************************************************/

//Declaring vars
$num_s 48;
$num_e 57;
$high_letter_s 65;
$high_letter_e 90;
$low_letter_s 97;
$low_letter_e 122;
$all_s 33;
$all_e 126;
$char_type $argv[2];
$len $argv[1];

if (
$argc 3) {
    echo 
"Usage: $argv[0] <length> <type>\n\n".
"Types:\n"."-num\tNumerical\n".
"-ll\tLower letters\n".
"-hl\tHigher letters\n".
"-e\tEverything goes\n";
}

switch (
$argv[2]) {

    case 
"-num";
        for (
$i 0$i $len$i ++) {
            
$out rand($num_s$num_e);
            
$pwd .= sprintf("%c"$out);
        }
        echo 
$pwd;
        
info($num_s$num_e$len);
        break;

    case 
"-ll";
        for (
$i 0$i $len$i ++) {
            
$out rand($low_letter_s$low_letter_e);
            
$pwd .= sprintf("%c"$out);
        }
        echo 
$pwd;
        
info($low_letter_s$low_letter_e$len);
        break;

    case 
"-hl";
        for (
$i 0$i $len$i ++) {
            
$out rand($high_letter_s$high_letter_e);
            
$pwd .= sprintf("%c"$out);
        }
        echo 
$pwd;
        
info($high_letter_s$high_letter_e$len);
        break;

    case 
"-e";
        for (
$i 0$i $len$i ++) {
            
$out rand($all_s$all_e);
            
$pwd .= sprintf("%c"$out);
        }
        echo 
$pwd;
        
info($all_s$all_e$len);
        break;

}

function 
info($start$end$len) {
    
$combos pow($end $start$len);
    echo 
"\n$combos possible combinations\n";
}
?>


Usage Example :

PHP Example :

<?
0lil
-z:/home/zapotek/workspace # ./pwdgen.php 14 -e 
1$kK3Ip,]_Ge'CH 
23.6204393769E+27 possible combinations 
?>



Other Example
Pattern based Password Generator
Easy to remember password for the membership tutorials


::: Resources :::
  Links Directory
  Programming 2 3
  Webmaster 2 3
  Web Design 2 3
  Web Hosting 2 3
  Other Links 2 3
  Asian ShowBiz News
  Teach Seo For You
::: New Templates :::




::: Other Tutorials :::
 Program Design

  Powered By T4VN.NET - Version 2.0 - CopyRight © T4VN.NET 2005-2007