It is currently 19. Aug 2019 02:11  


  User Information

Guest Avatar




Facebook, Google Login
Registration

  Hot Links



  Board Categories








Post new topic Reply to topic  [ 1 post ] 
FollowersFollowers: 0
BookmarksBookmarks: 0
Views: 279

 [PHP] Passwörter 
AuthorMessage
FkP Admin
User avatar

Joined: 11.2013
Posts: 11182
Location: 58706 Menden
Gender: Male
Highscores: 1
Post [PHP] Passwörter
Ein Zufalls Generator für Passwörter !

Code:
<?php

function generatePassword($length=9, $strength=0) {
    $vowels = 'aeuy';
    $consonants = 'bdghjmnpqrstvz';
    if ($strength & 1) {
        $consonants .= 'BDGHJLMNPQRSTVWXZ';
    }
    if ($strength & 2) {
        $vowels .= "AEUY";
    }
    if ($strength & 4) {
        $consonants .= '23456789';
    }
    if ($strength & 8) {
        $consonants .= '@#$%';
    }

    $password = '';
    $alt = time() % 2;
    for ($i = 0; $i < $length; $i++) {
        if ($alt == 1) {
            $password .= $consonants[(rand() % strlen($consonants))];
            $alt = 0;
        } else {
            $password .= $vowels[(rand() % strlen($vowels))];
            $alt = 1;
        }
    }
    return $password;
}

?>

_________________
Image


3. Apr 2014 23:11
Profile Visit website
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
© phpBB® Forum Software | designed by Vjacheslav Trushkin for Free Forums 3 & Free Forums/DivisionCore.
phpBB3 free Forum by UserBoard.org | All Rights Reserved.