Last change
on this file since 256 was
256,
checked in by hendrikvanantwerpen, 13 years ago
|
Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).
|
File size:
662 bytes
|
Line | |
---|
1 | <?php |
---|
2 | require_once("./JSON.php"); |
---|
3 | |
---|
4 | $filename = "./logs/analytics.log"; |
---|
5 | $json = new Services_JSON; |
---|
6 | |
---|
7 | $id = $_REQUEST["id"]; |
---|
8 | $items = $json->decode($_REQUEST["data"]); |
---|
9 | |
---|
10 | if (!$handle = fopen($filename, 'a+')) { |
---|
11 | print '{error: "server error"}'; |
---|
12 | exit; |
---|
13 | } |
---|
14 | |
---|
15 | foreach($items as $i=>$item){ |
---|
16 | $item->_analyticsId = $id; |
---|
17 | $item->_analyticsTimeStamp = time(); |
---|
18 | $log = $json->encode($item) . "\n"; |
---|
19 | fwrite($handle, $log); |
---|
20 | } |
---|
21 | |
---|
22 | fclose($handle); |
---|
23 | |
---|
24 | $response = "{'eventsRecieved': '" . sizeof($items) . "', 'id': '" . $id . "'}"; |
---|
25 | if ($_REQUEST["callback"]){ |
---|
26 | print htmlentities($_REQUEST["callback"]) . "(" . $response . ");"; |
---|
27 | }else{ |
---|
28 | print $response; |
---|
29 | } |
---|
30 | |
---|
31 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.