Showing posts with label Generate Password. Show all posts
Showing posts with label Generate Password. Show all posts

Tuesday, 30 August 2016

Random Password Generator in PHP

Generate random passwords using this simple PHP function. This function takes length as input and generates a random password or random string for usage. This function can be customized as needed for length and allowed characters. For customization please contact us.

function radomPasswordGenerator($length) {
    $ac = "abcdefghijklmnopqrstuvwxyz0123456789";
    $ac_len = strlen($ac);
    for($i=0; $i<$length; $i++){
        $position = rand(0,$ac_len);
        $randomString .= $ac{$position};
    }
    return $randomString;
}

Tuesday, 19 July 2016

PHP Function generate authentication string

Simple PHP function to generate a authentication string. Create a random string in php. Generate random password in php using a simple function.

function generateAuthenticationString($length) {
    $allowedChars = "abcdefghijklmnopqrstuvwxyz0123456789";
    $string = "";
    for($i=0;$i<$length;$i++){
        $randPos = rand(0,36);
        $string .= $allowedChars{$randPos};
    }
    return $string;
}