Subversion Repositories ALCASAR

Rev

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

Rev 2191 Rev 2222
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: user_stats.php 2191 2017-04-28 22:00:32Z tom.houdayer $
2
# $Id: user_stats.php 2222 2017-05-14 06:54:33Z richard $
3
 
3
 
4
require('/etc/freeradius-web/config.php');
4
require('/etc/freeradius-web/config.php');
5
require('../lib/functions.php');
5
require('../lib/functions.php');
6
require('../lib/sql/nas_list.php');
6
require('../lib/sql/nas_list.php');
7
require_once('../lib/xlat.php');
7
require_once('../lib/xlat.php');
8
?>
8
?>
-
 
9
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
9
<html>
10
<html>
10
<?php
11
<?php
11
 
-
 
12
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
12
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
13
	include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
13
	include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
14
else{
14
else{
15
	echo <<<EOM
15
	echo <<<EOM
16
<title>Statistiques utilisateurs</title>
16
<title>Statistiques utilisateurs</title>
Line 23... Line 23...
23
</body>
23
</body>
24
</html>
24
</html>
25
EOM;
25
EOM;
26
	exit();
26
	exit();
27
}
27
}
-
 
28
# Choice of language
-
 
29
$Language = 'en';
-
 
30
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
-
 
31
	$Langue		= explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
-
 
32
	$Language	= strtolower(substr(chop($Langue[0]),0,2)); }
-
 
33
if($Language == 'fr'){
-
 
34
	$l_title		= "Statistiques de connexion des utilisateurs";
-
 
35
	$l_start_date		= "Dates de début";
-
 
36
	$l_end_date		= "Dates de fin";
-
 
37
	$l_number_result	= "Nb. résultat / page";
-
 
38
	$l_order_by		= "Trié par";
-
 
39
	$l_sorted_order		= "Classé par ordre";
-
 
40
	$l_all			= "Tous";
-
 
41
	$l_con_number		= "Nombre de connexions";
-
 
42
	$l_con_length		= "Durée de connexions";
-
 
43
	$l_ascending		= "Croissant";
-
 
44
	$l_descending		= "Décroissant";
-
 
45
	$l_server		= "Sur le serveur";
-
 
46
	$l_user			= "Filtrer pour un utilisateur (laissez vide pour tous)";
-
 
47
	$l_show			= "Montrer";
-
 
48
	$l_from			= "Du";
-
 
49
	$l_to			= "au";
-
 
50
} else {
-
 
51
	$l_title		= "Statistics of users connexions";
-
 
52
	$l_start_date		= "Start date";
-
 
53
	$l_end_date		= "End date";
-
 
54
	$l_number_result	= "Nb results / page";
-
 
55
	$l_order_by		= "Sorted by";
-
 
56
	$l_sorted_order		= "Sorted order";
-
 
57
	$l_all			= "All";
-
 
58
	$l_con_number		= "Connections number";
-
 
59
	$l_con_length		= "Connection length";
-
 
60
	$l_ascending		= "Ascending";
-
 
61
	$l_descending		= "Descending";
-
 
62
	$l_server		= "On server";
-
 
63
	$l_user			= "Filter for a user (let empty for all)";
-
 
64
	$l_show			= "Show";
-
 
65
	$l_from			= "From";
-
 
66
	$l_to			= "to";
28
 
67
}
29
if (!isset($start) && !isset($stop)){
68
if (!isset($start) && !isset($stop)){
30
//if($start == '' && $stop == ''){
-
 
31
	$now = time();
69
	$now = time();
32
	$stop = date($config['sql_date_format'],$now);
70
	$stop = date($config['sql_date_format'],$now);
33
	$now -= 604800;
71
	$now -= 604800;
34
	$start = date($config['sql_date_format'],$now);
72
	$start = date($config['sql_date_format'],$now);
35
}
73
}
36
$start = da_sql_escape_string($link,$start);
74
$start = da_sql_escape_string($link,$start);
37
$stop = da_sql_escape_string($link,$stop);
75
$stop = da_sql_escape_string($link,$stop);
38
 
-
 
39
 
-
 
40
?>
76
?>
41
 
-
 
42
<head>
77
<head>
43
<title>Statistiques utilisateurs</title>
78
<title><?php echo "$l_title";?></title>
44
<link rel="stylesheet" href="style.css">
79
<link rel="stylesheet" href="/css/style.css" type="text/css">
45
</head>
80
</head>
46
<body>
81
<body>
47
<center>
82
<center>
48
<table border=0 width=550 cellpadding=0 cellspacing=0>
-
 
49
<tr valign=top>
-
 
50
<!--<td align=center><img src="images/title2.gif"></td>-->
-
 
51
</tr>
-
 
52
</table>
-
 
53
</table>
-
 
54
<br>
-
 
55
<tr valign=top>
-
 
56
<td width=65%></td>
-
 
57
<td bgcolor="black" width=35%>
-
 
58
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
-
 
59
	<tr bgcolor="#666666"align=center><td>
-
 
60
<table width="100%" border="0" cellspacing="0" cellpadding="0">
83
<table width="100%" border="0" cellspacing="0" cellpadding="0">
-
 
84
	<tr><th>
61
	<font color="white">Statistiques utilisateurs</font>&nbsp;
85
	<font color="white"><?echo "$l_title";?></font>
62
	<tr><th></th></tr>
86
	</th></tr>
63
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
87
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
64
</table>
88
</table>
-
 
89
<table width="100%" border="1" cellspacing="0" cellpadding="0">
65
<?php
90
<?php
66
if(isset($pagesize))
91
if(isset($pagesize))
67
{	
92
{	
68
echo <<<EOM
93
echo <<<EOM
-
 
94
<tr align="center"><td colspan="9">
69
De <b>$start</b> &agrave;  <b>$stop</b>
95
$l_from $start $l_to $stop
70
 
96
</td></tr>
71
<p>
97
<tr>
72
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
-
 
73
	<tr bgcolor="#d0ddb0">
-
 
74
	<th>#</th><th>Identifiant</th><th>Date</th><th>Serveur</th><th>Nombres de connections</th><th>Dur&eacute;e des connections</th><th>Upload</th><th>Download</th><th>Serveur</th>
98
<th>#</th><th>Identifiant</th><th>Date</th><th>Serveur</th><th>Nombres de connections</th><th>Dur&eacute;e des connections</th><th>Upload</th><th>Download</th><th>Serveur</th>
75
	</tr>
99
</tr>
76
EOM;
100
EOM;
77
 
101
 
78
$pagesize = ($pagesize) ? $pagesize : 10;
102
$pagesize = ($pagesize) ? $pagesize : 10;
79
 
103
 
80
 
104
 
Line 211... Line 235...
211
 
235
 
212
 
236
 
213
}
237
}
214
echo <<<EOM
238
echo <<<EOM
215
<tr><td align="left">
239
<tr><td align="left">
216
	<form action="user_stats.php" method="post" name="master">
240
<form action="user_stats.php" method="post" name="master">
217
	<table border=0>
241
		<table border="0">
218
		<tr valign="bottom">
242
		<tr valign="bottom" align="center">
219
			<td><small><b>date d&eacute;but</td><td><small><b>date fin</td><td><small><b>nbr./page</td><td><small><b>tri&eacute; par</td><td><small><b>class&eacute; par ordre </td>
243
		<td><small><b>$l_start_date</b></small></td><td><small><b>$l_end_date</b></small></td><td><small><b>$l_number_result</b></small></td><td><small><b>$l_order_by</b></small></td><td><small><b>$l_sorted_order</b></small></td></tr>
220
	<tr valign="middle"><td>
244
	<tr valign="middle"><td>
221
<input type="hidden" name="show" value="0">
245
<input type="hidden" name="show" value="0">
222
<input type="text" name="start" size="11" value="$start"></td>
246
<input type="text" name="start" size="11" value="$start"></td>
223
<td><input type="text" name="stop" size="11" value="$stop"></td>
247
<td><input type="text" name="stop" size="11" value="$stop"></td>
224
<td><select name="pagesize">
248
<td><select name="pagesize">
225
 
-
 
226
<option $selected[5] value="5" >5
249
<option $selected[5] value="5" >5
227
<option $selected[10] value="10">10
250
<option $selected[10] value="10">10
228
<option $selected[15] value="15">15
251
<option $selected[15] value="15">15
229
<option $selected[20] value="20">20
252
<option $selected[20] value="20">20
230
<option $selected[40] value="40">40
253
<option $selected[40] value="40">40
231
<option $selected[80] value="80">80
254
<option $selected[80] value="80">80
232
<option $selected[all] value="all">tous
255
<option $selected[all] value="all">$l_all
233
</select>
256
</select>
234
</td>
257
</td>
235
<td>
258
<td>
236
<select name="sortby">
259
<select name="sortby">
237
<option $selected[num] value="num">Nombre de connexions
260
<option $selected[num] value="num">$l_con_number
238
<option $selected[time] value="time">Dur&eacute;e des connexions
261
<option $selected[time] value="time">$l_con_length
239
</select>
262
</select>
240
</td>
263
</td>
241
<td><select name="order">
264
<td><select name="order">
242
<option $selected[asc] value="asc">croissant
265
<option $selected[asc] value="asc">$l_ascending
243
<option $selected[desc] value="desc">d&eacute;croissant
266
<option $selected[desc] value="desc">$l_descending
244
</select>
267
</select>
245
</td>
268
</td>
246
EOM;
269
EOM;
247
 
-
 
248
?>
270
?>
249
 
-
 
250
<td><input type="submit" class=button value="show"></td></tr>
271
	<td><input type="submit" class=button value="<?php echo "$l_show";?>"></td>
251
<tr><td>
272
</tr>
-
 
273
<tr align="center">
252
<b>Sur le serveur d'acc&egrave;s :</b>
274
<td><small><b><?php echo "$l_server";?></b></small></td>
-
 
275
<td><small><b><?php echo "$l_user";?></b></small></td>
253
</td>
276
</tr>
254
<td><b>Utilisateur</b></td></tr>
-
 
255
<tr><td>
277
<tr><td>
256
<select name="server">
278
<select name="server">
257
<?php
279
<?php
258
foreach ($nas_list as $nas){
280
foreach ($nas_list as $nas){
259
	$name = $nas['name'];
281
	$name = $nas['name'];
Line 275... Line 297...
275
?>
297
?>
276
</select>
298
</select>
277
</td>
299
</td>
278
<td><input type="text" name="login" size="11" value="<?php if(!isset($login)){echo "";}else{ echo $login;} ?>"></td>
300
<td><input type="text" name="login" size="11" value="<?php if(!isset($login)){echo "";}else{ echo $login;} ?>"></td>
279
</tr>
301
</tr>
280
</table></td></tr></form>
-
 
281
</table>
-
 
282
</tr>
-
 
283
</table>
302
</table>
-
 
303
</form>
-
 
304
</td></tr></table>
284
</body>
305
</body>
285
</html>
306
</html>