From 3ceb893f66920383b0f79faf1fc896469ee3d2a4 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 3 Aug 2015 19:21:06 +0300 Subject: add one catchall function to make uniqids/keyhashes/etc used by tt-rss --- include/functions.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'include/functions.php') diff --git a/include/functions.php b/include/functions.php index c27455220..cecfaeada 100644 --- a/include/functions.php +++ b/include/functions.php @@ -738,7 +738,7 @@ $_SESSION["name"] = db_fetch_result($result, 0, "login"); $_SESSION["access_level"] = db_fetch_result($result, 0, "access_level"); - $_SESSION["csrf_token"] = uniqid(rand(), true); + $_SESSION["csrf_token"] = uniqid_short(); db_query("UPDATE ttrss_users SET last_login = NOW() WHERE id = " . $_SESSION["uid"]); @@ -768,7 +768,7 @@ $_SESSION["auth_module"] = false; if (!$_SESSION["csrf_token"]) { - $_SESSION["csrf_token"] = uniqid(rand(), true); + $_SESSION["csrf_token"] = uniqid_short(); } $_SESSION["ip_address"] = $_SERVER["REMOTE_ADDR"]; @@ -1996,6 +1996,10 @@ } } + function uniqid_short() { + return uniqid(base_convert(rand(), 10, 36)); + } + // TODO: less dumb splitting require_once "functions2.php"; -- cgit v1.2.3