diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-08-28 21:53:04 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-08-28 21:53:04 -0400 |
commit | 54bee1b999273174b18fc30e69d5acce79d99e18 (patch) | |
tree | caf29a96a10b022996cfffa3674b062b52e79da8 /lib/util.php | |
parent | ff566a149d59ac7f78899911ca892b0193b0888b (diff) |
code for session token
darcs-hash:20080829015304-84dde-1c93203bdfbd4c1696cdd3c07212ff16a9f727dd.gz
Diffstat (limited to 'lib/util.php')
-rw-r--r-- | lib/util.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/util.php b/lib/util.php index 08930e99a..51616799f 100644 --- a/lib/util.php +++ b/lib/util.php @@ -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']; +} |