function generate($count, $type = 'num') {
switch ($type){
case 'num':
$symbols = '0123456789';
break;
case 'low':
$symbols = 'abcdefghijklmnopqrstuvwxyz';
break;
case 'up':
$symbols = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
default:
$symbols = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
}
for($i = 0; $i < $count; $i++)
$string .= $symbols{mt_rand(0, strlen($symbols)-1)};
return $string;
}
function getSymbols() {
return strtolower(substr(hash('gost', date('r')), 0, 17));
}
function getRandString($length, $alphabet = '1234567890qwertyuiopasdfghjklzxcvbnm')
{
$alphabet = str_repeat($alphabet, (int)($length / mb_strlen($alphabet)) + 1);
return mb_substr(str_shuffle($alphabet), 0, $length);
}