注意:未初始化的字符串偏移量:在第316行的/.../libraries/functions.php中为62

Man oh man I cannot figure this out... Please help. What a missing here?

here are the errors:

Notice: Uninitialized string offset: 62 in /..../libraries/functions.php on line 316
Notice: Undefined variable: stilldo in /..../libraries/functions.php on line 322

Here is the code:

function generate_password($length = 12, $letters = true, $mixed_case = true, $numbers = true, $punctuation = false){

    ## Generate the alfa
    $alfa = '';
    if($letters == true)    $alfa .= 'abcdefghijklmnopqrstuvwxyz';
    if($mixed_case == true) $alfa .= strtoupper('abcdefghijklmnopqrstuvwxyz');
    if($numbers == true)    $alfa .= '0123456789';
    if($punctuation == true)$alfa .= '~!@#$%^&*(),.=+<>';

    ## Set Random Seed
    if(!function_exists('_generate_password_seed')):
    function _generate_password_seed(){
        list($usec, $sec) = explode(' ', microtime());
        return (float) $sec + ((float) $usec * 100000);
    }
    endif;
    srand(_generate_password_seed());

    ## Generate the password
    $token = "";
    for($i = 0; $i < $length; $i ++) {
        $token .= $alfa[@rand(0, @strlen($alfa))];
    }

    ## Check the length
    if(strlen($token) < $length){
        // echo $stilldo = $length - strlen($token);
        $token .= generate_password($stilldo);
    }

    ## Return the password
    return $token;
}

I get this error 5 out of 10 times i run this function and I can't seem to crack it.

Notice: Undefined variable: stilldo means, that a variable $stilldo is not defined, nor initialized... That means, that You call function generate_password in recursion when passing it an undefined variable, that in fact has a null value. Therefore Your function cannot work properly.

The part of your code should look like this:

## Check the length
if(strlen($token) < $length){
    $stilldo = $length - strlen($token);
    $token .= generate_password($stilldo);
}

Yes, a stupid mistake - You commented out the right line (where only echo should be commented out or deleted).

Enjoy!