Line 1... |
Line 1... |
1 |
<?php
|
1 |
<?php
|
2 |
//gestion de la langue
|
2 |
//gestion de la langue
|
3 |
if (is_file("../lib/langues.php"))
|
3 |
if (is_file("../lib/langues.php"))
|
4 |
include("../lib/langues.php");
|
4 |
include("../lib/langues.php");
|
5 |
require('/etc/freeradius-web/config.php');
|
5 |
require('/etc/freeradius-web/config.php');
|
- |
|
6 |
if(!isset($clear_sessions)) $clear_sessions = 0;
|
6 |
if (is_file("../lib/$config[general_lib_type]/user_info.php"))
|
7 |
if (is_file("../lib/$config[general_lib_type]/user_info.php"))
|
7 |
include("../lib/$config[general_lib_type]/user_info.php");
|
8 |
include("../lib/$config[general_lib_type]/user_info.php");
|
8 |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
|
9 |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
|
9 |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
|
10 |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
|
10 |
else{
|
11 |
else{
|
Line 69... |
Line 70... |
69 |
# close active sessions
|
70 |
# close active sessions
|
70 |
exec ("sudo /usr/local/sbin/alcasar-logout.sh $login");
|
71 |
exec ("sudo /usr/local/sbin/alcasar-logout.sh $login");
|
71 |
# delete open accounting sessions
|
72 |
# delete open accounting sessions
|
72 |
$now = time();
|
73 |
$now = time();
|
73 |
$today_now = date("Y-m-d H:i:s",$now);
|
74 |
$today_now = date("Y-m-d H:i:s",$now);
|
74 |
$link = @da_sql_pconnect($config);
|
75 |
$link = da_sql_pconnect($config);
|
75 |
if ($link)
|
76 |
if ($link)
|
76 |
{
|
77 |
{
|
77 |
$res = @da_sql_query($link,$config,
|
78 |
$res = da_sql_query($link,$config,
|
78 |
"UPDATE $config[sql_accounting_table] SET acctstoptime = '$today_now', acctterminatecause='Admin-Reset'
|
79 |
"UPDATE $config[sql_accounting_table] SET acctstoptime = '$today_now', acctterminatecause='Admin-Reset'
|
79 |
WHERE username='$login' AND acctstoptime IS NULL;");
|
80 |
WHERE username='$login' AND acctstoptime IS NULL;");
|
80 |
if (! $res)
|
81 |
if (! $res)
|
81 |
echo "<b>Error deleting open sessions for user" . da_sql_error($link,$config) . "</b><br>\n";
|
82 |
echo "<b>Error deleting open sessions for user" . da_sql_error($link,$config) . "</b><br>\n";
|
82 |
}
|
83 |
}
|
83 |
else
|
84 |
else
|
84 |
echo "<b>Could not connect to SQL database</b><br>\n";
|
85 |
echo "<b>Could not connect to SQL database</b><br>\n";
|
85 |
}
|
86 |
}
|
86 |
# Count of accounting open sessions (in database)
|
87 |
# Count of accounting open sessions (in database)
|
87 |
$open_accnt_sessions = 0;
|
88 |
$open_accnt_sessions = 0;
|
88 |
$link = @da_sql_pconnect($config);
|
89 |
$link = da_sql_pconnect($config);
|
89 |
if ($link){
|
90 |
if ($link){
|
90 |
$search = @da_sql_query($link,$config,
|
91 |
$search = da_sql_query($link,$config,
|
91 |
"SELECT COUNT(*) AS counter FROM $config[sql_accounting_table]
|
92 |
"SELECT COUNT(*) AS counter FROM $config[sql_accounting_table]
|
92 |
WHERE username = '$login' AND acctstoptime IS NULL;");
|
93 |
WHERE username = '$login' AND acctstoptime IS NULL;");
|
93 |
if ($search){
|
94 |
if ($search){
|
94 |
if ($row = @da_sql_fetch_array($search,$config))
|
95 |
if ($row = da_sql_fetch_array($search,$config))
|
95 |
$open_accnt_sessions = $row['counter'];
|
96 |
$open_accnt_sessions = $row['counter'];
|
96 |
}
|
97 |
}
|
97 |
else
|
98 |
else
|
98 |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
|
99 |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
|
99 |
}
|
100 |
}
|