blob: 47edb81d9407eacd6e8dfc74abdd8f66bcc42a06 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<?php
/*
* TCOS script to save installation statistics
*
* We receive this VARS (using $_GET):
*
* id=[sha256sum identify macchine unique]
* distro=[ debian | ubuntu ]
* version=[ unstable | testing | etch | jaunty | intrepid | hardy | gusty ]
* tcos=[ TCOS version ]
* arch=[ i386 | amd64 ]
*
*
*/
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
function clean($var) {
$txt = preg_replace("@[^A-Za-z0-9\-_.]+@i","",$_GET[$var]);
return $txt;
}
$LOG_FILE=dirname(dirname(__FILE__)) . "/logs/tcos-stats.log";
if( ! file_exists($LOG_FILE) ) {
die("ERROR: Log file no exists\n");
}
if ( clean('id') == "" ) {
die("ERROR: id var not set\n");
}
function save_stats() {
global $LOG_FILE;
$fd=fopen($LOG_FILE, 'a');
fwrite($fd, date("Y-m-d H:i:s"). " HASH:". clean('id') . " distro:" . clean('distro') . " version:" . clean('version') . " arch:" . clean('arch') . " tcos:" . clean('tcos') . "\n");
fclose($fd);
}
save_stats();
?>
|