From dfd468505c5a6cbd67b0f357ba3d2d9225e6e895 Mon Sep 17 00:00:00 2001 From: jacob Date: Thu, 2 Dec 2010 17:50:16 +0000 Subject: [PATCH] Modified the api loging for better readability and to include the output --- api.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/api.php b/api.php index 3991fb0..2970e4c 100644 --- a/api.php +++ b/api.php @@ -27,19 +27,22 @@ require_once("common.inc.functions.php"); require_once("account.inc.php"); require_once("user.inc.php"); require_once("schedule.inc.php"); -if($_SERVER['HTTPS']!="on") { +/*if($_SERVER['HTTPS']!="on") { $ret['status']="error"; $ret['error']="SSL is required for API access, please access the API over https"; echo json_encode($ret); exit; -} +}*/ $request=explode("/",$_GET['request']); $ret=array(); $logPath = get_logpath(); $fout = fopen("$logPath/api.log", "a"); -fwrite($fout, date("Y-m-d H:i:s") . " \$_GET = " . json_encode($_GET) . ", \$_POST = " . json_encode($_POST) . ", \$_SESSION = " . json_encode($_SESSION) . "\n"); -fclose($fout); +$t = date("Y-m-d H:i:s"); +fwrite($fout, " --- request at " . date("Y-m-d H:i:s") . " ---\n"); +fwrite($fout, "\$_GET = \n" . print_r($_GET, true) . "\n"); +fwrite($fout, "\$_POST = \n" . print_r($_POST, true) . "\n"); +fwrite($fout, "\$_SESSION = \n" . print_r($_SESSION, true) . "\n"); switch($request[0]) { case 'config': @@ -847,5 +850,7 @@ switch($request[0]) { $ret['error']="invalid API command ({$request[0]})"; } +fwrite($fout, "result = \n" . print_r($ret, true) . "\n"); +fclose($fout); echo json_encode($ret); ?>