mirror of
https://github.com/Mibew/i18n.git
synced 2025-01-23 05:40:30 +03:00
Switch to a more reliable function for generation of userid
This commit is contained in:
parent
b77e2a9743
commit
e61706955a
@ -38,11 +38,6 @@ $kind_avatar = 7;
|
|||||||
$kind_to_string = array($kind_user => "user", $kind_agent => "agent", $kind_for_agent => "hidden",
|
$kind_to_string = array($kind_user => "user", $kind_agent => "agent", $kind_for_agent => "hidden",
|
||||||
$kind_info => "inf", $kind_conn => "conn", $kind_events => "event", $kind_avatar => "avatar");
|
$kind_info => "inf", $kind_conn => "conn", $kind_events => "event", $kind_avatar => "avatar");
|
||||||
|
|
||||||
function get_user_id()
|
|
||||||
{
|
|
||||||
return (time() + microtime()) . rand(0, 99999999);
|
|
||||||
}
|
|
||||||
|
|
||||||
function next_token()
|
function next_token()
|
||||||
{
|
{
|
||||||
return rand(99999, 99999999);
|
return rand(99999, 99999999);
|
||||||
@ -772,7 +767,7 @@ function visitor_from_request()
|
|||||||
if (isset($_COOKIE[$usercookie])) {
|
if (isset($_COOKIE[$usercookie])) {
|
||||||
$userId = $_COOKIE[$usercookie];
|
$userId = $_COOKIE[$usercookie];
|
||||||
} else {
|
} else {
|
||||||
$userId = get_user_id();
|
$userId = uniqid('', TRUE);
|
||||||
setcookie($usercookie, $userId, time() + 60 * 60 * 24 * 365);
|
setcookie($usercookie, $userId, time() + 60 * 60 * 24 * 365);
|
||||||
}
|
}
|
||||||
return array('id' => $userId, 'name' => $userName);
|
return array('id' => $userId, 'name' => $userName);
|
||||||
|
Loading…
Reference in New Issue
Block a user