From: Evan Prodromou Date: Fri, 29 Aug 2008 01:53:04 +0000 (-0400) Subject: code for session token X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=54bee1b999273174b18fc30e69d5acce79d99e18;p=quix0rs-gnu-social.git code for session token darcs-hash:20080829015304-84dde-1c93203bdfbd4c1696cdd3c07212ff16a9f727dd.gz --- diff --git a/lib/util.php b/lib/util.php index 08930e99a7..51616799f3 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']; +}