code for session token

darcs-hash:20080829015304-84dde-1c93203bdfbd4c1696cdd3c07212ff16a9f727dd.gz
This commit is contained in:
Evan Prodromou 2008-08-28 21:53:04 -04:00
parent ff566a149d
commit 54bee1b999

View File

@ -1477,3 +1477,11 @@ function common_canonical_sms($sms) {
preg_replace('/\D/', '', $sms);
return $sms;
}
function common_session_token() {
common_ensure_session();
if (!array_key_exists('token', $_SESSION)) {
$_SESSION['token'] = common_random_bytes(64);
}
return $_SESSION['token'];
}