Mercurial > hg > freeDiameter
annotate contrib/app_acct_tools/display_results.php @ 533:4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Tue, 07 Sep 2010 16:57:48 +0900 |
parents | |
children | ce3cacbbccc9 |
rev | line source |
---|---|
533
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1 <?php |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
2 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
3 # The copyright of this file is the same as the freeDiameter project. Licence is BSD. |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
4 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
5 # This file should no be called directly; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
6 # instead it should be included from another script that sets its parameters as described bellow. |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
7 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
8 ## $USERS |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
9 # An array of the user names to display; the empty array will display all users. |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
10 # This parameter MUST be set. |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
11 if (!isset($USERS)) |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
12 die('Do not call this file directly'); |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
13 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
14 ## $START_TIME: |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
15 # If set, this restricts the displayed data to sessions starting after $START |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
16 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
17 ## $END_TIME: |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
18 # If set, this restricts the displayed data to sessions starting before $END |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
19 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
20 ## $LIMIT: |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
21 ## $LIMIT_OFFSET: |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
22 # If set, these limit the number of accounting records displayed (for pagination purpose) |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
23 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
24 #------------------------------------------------------------------------------------------ |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
25 # DATABASE: |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
26 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
27 /* The Connection String used to access that database: |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
28 Example: "host=localhost dbname=app_acct user=freediameter password=foo" */ |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
29 $CONNSTR=""; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
30 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
31 /* The name of the table containing the processed data (from process_records.php script) */ |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
32 $PROCESSED="processed"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
33 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
34 #------------------------------------------------------------------------------------------ |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
35 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
36 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
37 /* Connect to the database */ |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
38 $dbconn = pg_connect($CONNSTR) |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
39 or die('Could not connect: ' . pg_last_error() . "\n"); |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
40 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
41 /* Function to format download size (from php.net) */ |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
42 function human_readable( $size ) |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
43 { |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
44 $count = 0; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
45 $format = array("B","KB","MB","GB","TB","PB","EB","ZB","YB"); |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
46 while(($size/1024)>1 && $count<8) |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
47 { |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
48 $size=$size/1024; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
49 $count++; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
50 } |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
51 if( $size >= 100 ) $decimals = 0; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
52 elseif ($size >= 10 ) $decimals = 1; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
53 else $decimals = 2; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
54 $return = number_format($size,$decimals,'.',' ')." ".$format[$count]; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
55 return $return; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
56 } |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
57 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
58 /* Build the SQL query */ |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
59 $sql = 'SELECT *, to_char(sess_start, \'YYYY-MM-DD HH24:MI:SS (TZ)\') as fmt_sess_start FROM "'.$PROCESSED.'"'; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
60 $where=0; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
61 if ($USERS) { |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
62 $USERS = array_map(pg_escape_bytea, $USERS); |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
63 $sql .= " WHERE user_name IN ('". join("', '", array_values($USERS))."') "; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
64 $where = 1; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
65 } |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
66 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
67 if ($START_TIME) { |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
68 $START_TIME = pg_escape_string($START_TIME); |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
69 if ($where++) |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
70 $sql .= " AND "; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
71 else |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
72 $sql .= " WHERE "; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
73 $sql .= "sess_start >= '".$START_TIME."'"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
74 } |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
75 if ($END_TIME) { |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
76 $END_TIME = pg_escape_string($END_TIME); |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
77 if ($where++) |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
78 $sql .= " AND "; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
79 else |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
80 $sql .= " WHERE "; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
81 $sql .= "sess_start <= '".$END_TIME."'"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
82 } |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
83 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
84 $sql .= " ORDER BY sess_start, sess_duration"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
85 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
86 if ($LIMIT) |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
87 $sql .= " LIMIT $LIMIT"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
88 if ($LIMIT_OFFSET) |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
89 $sql .= " OFFSET $LIMIT_OFFSET"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
90 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
91 /* Execute the query */ |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
92 $result = pg_query($dbconn, $sql) or die('Query failed: ' . pg_last_error() . "\n"); |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
93 $recs = pg_num_rows($result); |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
94 if ($recs == 0) { |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
95 echo "<p><em>Sorry, no data is available in this selection.</em></p>\n"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
96 } else { |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
97 echo "<p><strong>$recs</strong> records found.</p>\n"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
98 ?> |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
99 <table> |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
100 <tr> |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
101 <th>Device identifier</th> |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
102 <th>Access Device information</th> |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
103 <th>Session started on</th> |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
104 <th>Duration</th> |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
105 <th>Downloaded</th> |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
106 <th>Uploaded</th> |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
107 </tr> |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
108 <?php |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
109 while ($record = pg_fetch_array($result, null, PGSQL_ASSOC)) { |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
110 echo " <tr title='".htmlentities(pg_unescape_bytea($record["user_name"]))."'>\n"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
111 echo " <td>"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
112 echo htmlentities(pg_unescape_bytea($record["user_device"])); |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
113 echo "</td>\n"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
114 echo " <td>"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
115 echo htmlentities(pg_unescape_bytea($record["nas_info"])); |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
116 echo "</td>\n"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
117 echo " <td>"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
118 echo $record["fmt_sess_start"]; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
119 echo "</td>\n"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
120 echo " <td>"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
121 echo htmlentities($record["sess_duration"]); |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
122 echo "</td>\n"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
123 echo " <td>"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
124 echo human_readable( $record["downl_bytes"] )." (".$record["downl_packets"]."pckts)"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
125 echo "</td>\n"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
126 echo " <td>"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
127 echo human_readable( $record["upl_bytes"] )." (".$record["upl_packets"]."pckts)"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
128 echo "</td>\n"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
129 echo " </tr>\n"; |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
130 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
131 } |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
132 } |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
133 pg_free_result($result); |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
134 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
135 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
136 /* Closing connection */ |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
137 pg_close($dbconn); |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
138 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
139 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
140 |
4cdf146f11d5
Added a set of example PHP scripts to parse the app_acct.fdx data.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
141 ?> |