示例#1
0
function umc_get_code()
{
    $chars = "abcdefghijkmnopqrstuvwxyz023456789";
    srand((double) microtime() * 1000000);
    $i = 0;
    $pass = '';
    while ($i <= 4) {
        $num = rand() % 33;
        $tmp = substr($chars, $num, 1);
        $pass = $pass . $tmp;
        $i++;
    }
    $sql = "SELECT * FROM minecraft_iconomy.story WHERE code='{$pass}';";
    $D3 = umc_mysql_fetch_all($sql);
    $count = count($D3);
    if ($count > 0) {
        umc_get_code();
    }
    return $pass;
}
function umc_get_code()
{
    $pass = umc_random_code_gen();
    $sql = "SELECT * FROM minecraft_iconomy.story WHERE code='{$pass}';";
    $D3 = umc_mysql_fetch_all($sql);
    $count = count($D3);
    if ($count > 0) {
        umc_get_code();
    }
    return $pass;
}