X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/6079edfe4444d2d0bc2f220f8823d6fcc57f2dd5..7420fa50ea7e810db85bcb7ced55dc01d21fafcd:/WEB-INF/lib/common.lib.php?ds=sidebyside diff --git a/WEB-INF/lib/common.lib.php b/WEB-INF/lib/common.lib.php index 6526d730..e09a943f 100644 --- a/WEB-INF/lib/common.lib.php +++ b/WEB-INF/lib/common.lib.php @@ -406,3 +406,14 @@ function ttDateToUserFormat($date) $o_date = new DateAndTime(DB_DATEFORMAT, $date); return $o_date->toString($user->date_format); } + +// ttRandomString generates a random alphanumeric string. +function ttRandomString($length = 32) { + $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + $charactersLength = strlen($characters); + $randomString = ''; + for ($i = 0; $i < $length; $i++) { + $randomString .= $characters[rand(0, $charactersLength - 1)]; + } + return $randomString; +}