diff options
Diffstat (limited to 'engine/lib/api.php')
-rw-r--r-- | engine/lib/api.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/engine/lib/api.php b/engine/lib/api.php index 0e9260629..7e685cdd6 100644 --- a/engine/lib/api.php +++ b/engine/lib/api.php @@ -193,9 +193,18 @@ */ function validate_user_token($site, $token) { - $u = new User(); - - return $u->getUserIDFromAuthToken($site, $token); + global $CONFIG; + + $site = (int)$site; + $token = sanitise_string($token); + + $time = time(); + + $user = get_data_row("SELECT * from {$CONFIG->dbprefix}users_apisessions where token='$token' and site_id=$site and expires>$time"); + if ($user) + return $user->user_id; + + return false; } /** |