update generateRndString
This commit is contained in:
parent
89acfaff8f
commit
1875210f3f
@ -53,11 +53,14 @@ class Utils
|
||||
* Generate random string
|
||||
*
|
||||
* @param int $length
|
||||
* @param bool $special_chars
|
||||
* @return string
|
||||
*/
|
||||
public static function generateRndString($length)
|
||||
public static function generateRndString($length, $special_chars = true)
|
||||
{
|
||||
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_ []{}<>~`+=,.;:/?|';
|
||||
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
if ($special_chars) $chars .= "!@#$%^&*()-_ []{}<>~`+=,.;:/?|";
|
||||
|
||||
$rnd_string = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$rnd_string .= $chars[mt_rand(0, strlen($chars) - 1)];
|
||||
|
Loading…
Reference in New Issue
Block a user