Revise session handling to prepare API authentication via token

This commit is contained in:
Bernd Bestel
2018-04-19 20:44:49 +02:00
parent 0c85342404
commit eae5b8bad9
9 changed files with 101 additions and 70 deletions

View File

@@ -61,3 +61,14 @@ function GetClassConstants($className)
$r = new ReflectionClass($className);
return $r->getConstants();
}
function RandomString($length, $allowedChars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
{
$randomString = '';
for ($i = 0; $i < $length; $i++)
{
$randomString .= $allowedChars[rand(0, strlen($allowedChars) - 1)];
}
return $randomString;
}