Subversion Repositories ALCASAR

Rev

Rev 2266 | Rev 2858 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2266 Rev 2856
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: stats.php 2266 2017-06-03 22:02:19Z tom.houdayer $
2
# $Id: stats.php 2856 2020-07-21 22:11:44Z rexy $
3
 
3
 
4
require('/etc/freeradius-web/config.php');
4
require('/etc/freeradius-web/config.php');
-
 
5
require('../lib/functions.php');
5
require('../lib/sql/nas_list.php');
6
require('../lib/sql/nas_list.php');
6
require_once('../lib/xlat.php');
7
require_once('../lib/xlat.php');
7
?>
8
?>
-
 
9
<!DOCTYPE html>
8
<html>
10
<html>
9
<head>
11
<head>
10
<title>Analyse des comptes</title>
-
 
11
<meta http-equiv="Content-Type" content="text/html; charset=<?= $config['general_charset'] ?>">
-
 
12
<link rel="stylesheet" href="style.css">
-
 
13
</head>
-
 
14
<body>
-
 
15
<center>
-
 
16
 
-
 
17
<?php
12
<?php
-
 
13
# Choice of language
-
 
14
$Language = 'en';
-
 
15
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
-
 
16
	$Langue		= explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
-
 
17
	$Language	= strtolower(substr(chop($Langue[0]),0,2)); }
-
 
18
if($Language == 'fr'){
-
 
19
	$l_title		= "Analyse journalière";
-
 
20
	$l_sessions		= "Sessions";
18
require_once('../lib/functions.php');
21
	$l_usage		= "temps d'utilisation total";
-
 
22
	$l_uploads		= "Données sortantes";
-
 
23
	$l_downloads	= "Données entrantes";
-
 
24
} else if($Language == 'es') {
-
 
25
	$l_title		= "SAnálisis diario";
-
 
26
	$l_sessions		= "sesiones";
-
 
27
	$l_usage		= "total usage time";
-
 
28
	$l_uploads		= "Datos de salida";
-
 
29
	$l_downloads	= "Datos entrantes";
-
 
30
} else {
-
 
31
	$l_title		= "Daily analysis";
-
 
32
	$l_sessions		= "Sessions";
-
 
33
	$l_usage		= "tiempo total de uso";
-
 
34
	$l_uploads		= "Uploads";
-
 
35
	$l_downloads	= "Downloads";
19
 
36
}
20
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
37
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
21
	include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
38
	include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
22
else{
39
else{
23
	echo <<<EOM
40
	echo <<<EOM
-
 
41
<title>$l_title</title>
-
 
42
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
-
 
43
<link rel="stylesheet" href="/css/acc.css">
-
 
44
</head>
-
 
45
<body>
24
<b>Could not include SQL library functions. Aborting</b>
46
<center><b>Could not include SQL library functions. Aborting</b></center>
25
</body>
47
</body>
26
</html>
48
</html>
27
EOM;
49
EOM;
28
	exit();
50
	exit();
29
}
51
}
30
 
52
?>
-
 
53
<title><?= $l_title ?></title>
-
 
54
<meta http-equiv="Content-Type" content="text/html; charset=<?= $config['general_charset'] ?>">
-
 
55
<link rel="stylesheet" href="/css/acc.css" type="text/css">
-
 
56
</head>
-
 
57
<body>
-
 
58
<?php
31
$stats_num = array();
59
$stats_num = array();
32
 
-
 
33
$date = strftime('%A, %e %B %Y, %T %Z');
60
$date = strftime('%A, %e %B %Y, %T %Z');
34
$now = time();
61
$now = time();
35
 
-
 
36
if (!isset($before))
62
if (!isset($before))
37
{
63
{
38
	$before = date($config['sql_date_format'], $now + 86400);
64
	$before = date($config['sql_date_format'], $now + 86400);
39
}
65
}
40
if (!isset($after))
66
if (!isset($after))
Line 63... Line 89...
63
 
89
 
64
$column3 = (isset($column3)) ? "$column3" : 'download';
90
$column3 = (isset($column3)) ? "$column3" : 'download';
65
$column[3] = "$column3";
91
$column[3] = "$column3";
66
$selected3["$column3"] = 'selected';
92
$selected3["$column3"] = 'selected';
67
 
93
 
68
$message['sessions'] = 'sessions';
94
$message['sessions'] = $l_sessions;
69
$message['usage'] = 'total usage time';
95
$message['usage'] = $l_usage;
70
$message['usage'] = 'temps d\'utilisation total ';
-
 
71
$message['upload'] = 'uploads';
96
$message['upload'] = $l_uploads;
72
$message['download'] = 'downloads';
97
$message['download'] = $l_downloads;
73
if ($config['general_stats_use_totacct'] == 'yes'){
98
if ($config['general_stats_use_totacct'] == 'yes'){
74
	$sql_val['sessions'] = 'connnum';
99
	$sql_val['sessions'] = 'connnum';
75
	$sql_val['usage'] = 'conntotduration';
100
	$sql_val['usage'] = 'conntotduration';
76
	$sql_val['upload'] = 'outputoctets'; # invert with 'inputoctets' in order to display it more logically
101
	$sql_val['upload'] = 'outputoctets'; # invert with 'inputoctets' in order to display it more logically
77
	$sql_val['download'] = 'inputoctets';
102
	$sql_val['download'] = 'inputoctets';