Subversion Repositories ALCASAR

Rev

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

Rev 2817 Rev 2818
Line -... Line 1...
-
 
1
<!DOCTYPE html>
1
<?php
2
<?php
2
 
-
 
3
require('/etc/freeradius-web/config.php');
3
require('/etc/freeradius-web/config.php');
4
require('../lib/functions.php');
4
require('../lib/functions.php');
5
require('../lib/sql/functions.php');
5
require('../lib/sql/functions.php');
6
require('../lib/acctshow.php');
6
require('../lib/acctshow.php');
7
 
-
 
8
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
7
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
9
	include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
8
	include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
10
else{
9
else{
11
	echo <<<EOM
10
	echo <<<EOM
12
<html>
11
<html>
13
<head>
12
<head>
14
<title>G&eacute;n&eacute;rateur de rapports de comptes</title>
-
 
15
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
13
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-
 
14
<title>$l_title</title>
16
<link rel="stylesheet" href="/css/acc.css">
15
<link rel="stylesheet" href="/css/acc.css">
17
</head>
16
</head>
18
<body>
17
<body>
19
<center>
18
<center>
20
<b>Could not include SQL library functions. Aborting</b>
19
<b>Could not include SQL library functions. Aborting</b>
21
</body>
20
</body>
22
</html>
21
</html>
23
EOM;
22
EOM;
24
	exit();
23
	exit();
25
}
24
}
-
 
25
$Language = 'en';
-
 
26
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
-
 
27
	$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
-
 
28
	$Language = strtolower(substr(chop($Langue[0]), 0, 2)); 
-
 
29
}
-
 
30
if ($Language === 'fr') {
-
 
31
	$l_title	= "Journal des connexions";
-
 
32
} else {
-
 
33
	$l_title	= "Connections log";
-
 
34
}
26
 
35
 
27
$operators=array( '=','<', '>', '<=', '>=', 'regexp', 'like' );
36
$operators=array( '=','<', '>', '<=', '>=', 'regexp', 'like' );
28
if ($config['sql_type'] == 'pg'){
37
if ($config['sql_type'] == 'pg'){
29
	$operators=array( '=','<', '>', '<=', '>=', '~', 'like', '~*', '~~*', '<<=' );
38
	$operators=array( '=','<', '>', '<=', '>=', '~', 'like', '~*', '~~*', '<<=' );
30
}
39
}
31
$link = da_sql_pconnect ($config) or die('cannot connect to sql databse');
40
$link = da_sql_pconnect ($config) or die('cannot connect to sql databse');
32
$fields = da_sql_list_fields($config['sql_accounting_table'],$link,$config);
41
$fields = da_sql_list_fields($config['sql_accounting_table'],$link,$config);
33
 
-
 
34
 
-
 
35
unset($items);
42
unset($items);
36
 
-
 
37
while($row = $fields->fetch_array())
43
while($row = $fields->fetch_array())
38
{
44
{
39
	$key = strtolower($row[0]);
45
	$key = strtolower($row[0]);
40
	$val = $sql_attrs[$key]['desc'];
46
	$val = $sql_attrs[$key]['desc'];
41
	if ($val == '')
47
	if ($val == '')
Line 105... Line 111...
105
}
111
}
106
 
112
 
107
?>
113
?>
108
<html>
114
<html>
109
<head>
115
<head>
110
<title>Journal des connexions</title>
-
 
111
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>">
116
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-
 
117
	<title><?= $l_title ?></title>
112
<link rel="stylesheet" href="/css/acc.css">
118
	<link rel="stylesheet" href="/css/acc.css">
113
</head>
119
</head>
114
<body>
120
<body>
115
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
121
<div class="panel">
116
	<tr><th>Journal des connexions</th></tr>
122
	<div class="panel-header"><?= $l_title ?></div>
117
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2">
-
 
118
	</td></tr>
123
	<div class="panel-row">
119
</TABLE>
-
 
120
<TABLE width="100%" border="1" cellspacing="0" cellpadding="1">
-
 
121
<tr><td>
-
 
122
<?php
124
<?php
123
if(!isset($queryflag))
125
if(!isset($queryflag))
124
{
126
{
125
	$queryflag = 0;
127
	$queryflag = 0;
126
}
128
}
Line 205... Line 207...
205
<br><input type=submit class=button onclick="this.form.queryflag.value=1">
207
<br><input type=submit class=button onclick="this.form.queryflag.value=1">
206
</td>
208
</td>
207
</tr>
209
</tr>
208
</table>
210
</table>
209
</form>
211
</form>
210
</table>
-
 
211
</body>
-
 
212
</html>
-
 
213
EOM;
212
EOM;
214
 
-
 
215
}
213
}
216
 
214
 
217
if ($queryflag == 1){
215
if ($queryflag == 1){
218
	if(!isset($where))
216
	if(!isset($where))
219
		$where = "";
217
		$where = "";
Line 267... Line 265...
267
	" ORDER BY $order DESC " . da_sql_limit($maxresults,2,$config) . ";";
265
	" ORDER BY $order DESC " . da_sql_limit($maxresults,2,$config) . ";";
268
 
266
 
269
echo <<<EOM
267
echo <<<EOM
270
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
268
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
271
	<tr><td>
269
	<tr><td>
272
<p>
-
 
273
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
270
		<table border=1 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
274
	<tr bgcolor="#d0ddb0">
271
		<tr bgcolor="#d0ddb0">
275
	</tr>
-
 
276
EOM;
272
EOM;
277
 
273
 
278
 
-
 
279
foreach($accounting_show_attrs as $val){
274
foreach($accounting_show_attrs as $val){
280
	$desc = $sql_attrs[$val]['desc'];
275
	$desc = $sql_attrs[$val]['desc'];
281
	if($val == 'acctoutputoctets')
276
	if($val == 'acctoutputoctets')
282
		$desc = "Upload";
277
		$desc = "Upload";
283
	if($val == 'acctinputoctets')
278
	if($val == 'acctinputoctets')
Line 299... Line 294...
299
					$info = time2strclock($info);
294
					$info = time2strclock($info);
300
				if ($info == '')
295
				if ($info == '')
301
					$info = '-';
296
					$info = '-';
302
				if ($val == 'username'){
297
				if ($val == 'username'){
303
					$Info = urlencode($info);
298
					$Info = urlencode($info);
304
					$info = "<a href=\"user_admin.php?login=$Info\" title=\"Edit user $info\">$info<a/>";
299
					$info = "<a href=\"user_admin.php?login=$Info\" title=\"Edit user $info\">$info</a>";
305
				}
300
				}
306
				echo <<<EOM
301
				echo <<<EOM
307
			<td>$info</td>
302
			<td>$info</td>
308
EOM;
303
EOM;
309
			}
304
			}
310
			echo "</tr>\n";
305
			echo "</tr>\n";
311
		}
306
		}
312
	}
307
	}
313
	else
308
	else
314
		echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
309
		echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
315
echo <<<EOM
310
		echo <<<EOM
316
	</table>
311
		</table>
317
	</td></tr>
312
	</td></tr>
318
	</table>
313
	</table>\n
319
</td></tr>
-
 
320
</table>
-
 
321
</table>
-
 
322
</body>
-
 
323
</html>
-
 
324
EOM;
314
EOM;
325
}
315
}
326
?>
316
?>
-
 
317
	</div>
-
 
318
</div>
-
 
319
</body>
-
 
320
</html>