From df1d8b6068b0bd979cf04555cae6285c44531465 Mon Sep 17 00:00:00 2001 From: icewing Date: Mon, 10 Mar 2008 17:43:39 +0000 Subject: Marcus Povey * First draft api git-svn-id: https://code.elgg.org/elgg/trunk@144 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/api.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'engine/lib') 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; } /** -- cgit v1.2.3