]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
code for session token
authorEvan Prodromou <evan@prodromou.name>
Fri, 29 Aug 2008 01:53:04 +0000 (21:53 -0400)
committerEvan Prodromou <evan@prodromou.name>
Fri, 29 Aug 2008 01:53:04 +0000 (21:53 -0400)
darcs-hash:20080829015304-84dde-1c93203bdfbd4c1696cdd3c07212ff16a9f727dd.gz

lib/util.php

index 08930e99a724cdef8bace9ac31cd5060834b239d..51616799f374fb67a34938c611aeca2f6912e252 100644 (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'];
+}