From 0d58e48647424515ae577a902dc13054bc9ebee4 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Wed, 11 Mar 2009 01:53:38 +0000 Subject: [PATCH] Improve debugging. --- common.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/common.php b/common.php index ecf4e31..2778fdf 100644 --- a/common.php +++ b/common.php @@ -80,17 +80,13 @@ function sign($a, $apiKey, $debug=false) { $qs .= '&'; } } - - // Generate the signature -// debug('API key: '.base64_encode($apiKey)); // API key of the client - debug('SIGN: '.$qs); // the TRUE at the end states we want the raw value, not hexadecimal form $hmac = hash_hmac('sha1', utf8_encode($qs), $apiKey, true); $hmac = base64_encode($hmac); - if ($debug) { - debug('h='.$hmac); - } + + debug('SIGN: ' . $qs . ' H=' . $hmac); + return $hmac; } // sign an array of query string @@ -142,7 +138,7 @@ function getAuthData($devId) { // $clientId: The decimal client identity function getClientData($clientId) { - $stmt = 'SELECT secret, chk_sig, chk_owner, chk_time'. + $stmt = 'SELECT id, secret, chk_sig, chk_owner, chk_time'. ' FROM clients WHERE active AND id='.mysql_quote($clientId); $r = query($stmt); if (mysql_num_rows($r) > 0) {