/web/acc/manager/htdocs/user_info.php |
---|
0,0 → 1,124 |
<?php |
require('/etc/freeradius-web/config.php'); |
?> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<title>Page d'information personnelle</title> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>Gestion des usagers</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1> |
<tr bgcolor="#666666"><td> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=2> |
<tr><td valign="middle" align="left"> |
<center> |
<table border=0 width=550 cellpadding=0 cellspacing=0> |
<tr valign=top> |
<!--<td align=center><img src="images/title2.gif"></td>--> |
</tr> |
</table> |
<table border=0 width=400 cellpadding=0 cellspacing=2> |
<?php |
include("../html/user_toolbar.html.php"); |
?> |
</table> |
<?php |
if ($change == 1){ |
if (is_file("../lib/$config[general_lib_type]/user_info.php")) |
include("../lib/$config[general_lib_type]/user_info.php"); |
if (is_file("../lib/$config[general_lib_type]/change_info.php")) |
include("../lib/$config[general_lib_type]/change_info.php"); |
} |
if (is_file("../lib/$config[general_lib_type]/user_info.php")) |
include("../lib/$config[general_lib_type]/user_info.php"); |
?> |
<br> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor="black" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">Page d'information personnelle de <?php echo "$login ($cn)"?></font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<form method=post> |
<input type=hidden name=login value="<?php echo $login?>"> |
<input type=hidden name=change value="0"> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<?php |
echo <<<EOM |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
Nom complet (NOM Prénom) |
</td><td> |
<input type=text name="Fcn" value="$cn" size=35> |
</td> |
</tr> |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
</td><td> |
<input type=text name="Fmail" value="$mail" size=35> |
</td> |
</tr> |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
Service |
</td><td> |
<input type=text name="Fou" value="$ou" size=35> |
</td> |
</tr> |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
Téléphone personnel |
</td><td> |
<input type=text name="Fhomephone" value="$homephone" size=35> |
</td> |
</tr> |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
Téléphone bureau |
</td><td> |
<input type=text name="Ftelephonenumber" value="$telephonenumber" size=35> |
</td> |
</tr> |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
Téléphone mobile |
</td><td> |
<input type=text name="Fmobile" value="$mobile" size=35> |
</td> |
</tr> |
EOM; |
?> |
</table> |
<br> |
<input type=submit class=button value="Modifier" OnClick="this.form.change.value=1"> |
</form> |
</td></tr> |
</table> |
</tr> |
</table> |
</TD></TR> |
</TABLE> |
</td></tr> |
</TABLE> |
</body> |
</html> |
/web/acc/manager/htdocs/accounting.php |
---|
0,0 → 1,298 |
<?php |
require('/etc/freeradius-web/config.php'); |
require('../lib/functions.php'); |
require('../lib/sql/functions.php'); |
require('../lib/acctshow.php'); |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php")) |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php"); |
else{ |
echo <<<EOM |
<html> |
<head> |
<title>Générateur de rapports de comptes</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
<body> |
<center> |
<b>Could not include SQL library functions. Aborting</b> |
</body> |
</html> |
EOM; |
exit(); |
} |
$operators=array( '=','<', '>', '<=', '>=', 'regexp', 'like' ); |
if ($config[sql_type] == 'pg'){ |
$operators=array( '=','<', '>', '<=', '>=', '~', 'like', '~*', '~~*', '<<=' ); |
} |
$link = @da_sql_pconnect ($config) or die('cannot connect to sql databse'); |
$fields = @da_sql_list_fields($config[sql_accounting_table],$link,$config); |
$no_fields = @da_sql_num_fields($fields,$config); |
unset($items); |
for($i=0;$i<$no_fields;$i++){ |
$key = strtolower(@da_sql_field_name($fields,$i,$config)); |
$val = $sql_attrs[$key][desc]; |
if ($val == '') |
continue; |
$show = $sql_attrs[$key][show]; |
$selected[$key] = ($show == 'yes') ? 'selected' : ''; |
$items[$key] = "$val"; |
} |
asort($items); |
class Qi { |
var $name; |
var $item; |
var $_item; |
var $operator; |
var $type; |
var $typestr; |
var $value; |
function Qi($name,$item,$operator) { |
$this->name=$name; |
$this->item=$item; |
$this->operator=$operator; |
} |
function show() { global $operators; |
global $items; |
$nam = $this->item; |
echo <<<EOM |
<tr><td align=left> |
<i>$items[$nam]</i> |
<input type=hidden name="item_of_$this->name" value="$this->item"> |
</td><td align=left> |
<select name=operator_of_$this->name> |
EOM; |
foreach($operators as $operator){ |
if($this->operator == $operator) |
$selected=" selected "; |
else |
$selected=''; |
print("<option value=\"$operator\" $selected>$operator</option>\n"); |
} |
echo <<<EOM |
</select> |
</td><td align=left> |
<input name="value_of_$this->name" type=text value="$this->value"> |
</td><td align=left> |
<input type=hidden name="delete_$this->name" value=0> |
<input type=submit class=button size=5 value=del onclick="this.form.delete_$this->name.value=1"> |
</td></tr> |
EOM; |
} |
function get($designator) { global ${"item_of_$designator"}; |
global ${"value_of_$designator"}; |
global ${"operator_of_$designator"}; |
if(${"item_of_$designator"}){ |
$this->value= ${"value_of_$designator"}; |
$this->operator=${"operator_of_$designator"}; |
$this->item=${"item_of_$designator"}; |
} |
} |
function query(){ |
global $operators; |
global $items; |
return $items[$this->item]." $this->operator '$this->value'"; |
} |
} |
?> |
<html> |
<head> |
<title>Journal des connexions</title> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>Journal des connexions</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<?php |
if(!$queryflag) { |
echo <<<EOM |
<form method=post> |
<table border=0 width=740 cellpadding=1 cellspacing=1> |
<tr> |
<td> |
<b>Afficher les attributs suivants :</b><br> |
<select name="accounting_show_attrs[]" size=5 multiple> |
EOM; |
foreach($items as $key => $val) |
echo <<<EOM |
<option $selected[$key] value="$key">$val</option> |
EOM; |
echo <<<EOM |
</select> |
<br><br> |
<b>Classé par :</b><br> |
<select name="order_by"> |
EOM; |
foreach($items as $key => $val) |
if ($val == 'username') |
echo <<<EOM |
<option selected value="$key">$val</option> |
EOM; |
else |
echo <<<EOM |
<option value="$key">$val</option> |
EOM; |
echo <<<EOM |
</select> |
<br><br> |
<b>Nbr. Max. de résultats retournés :</b><br> |
<input name=maxresults value=$config[sql_row_limit] size=5> |
</td> |
<td valign=top> |
<input type=hidden name=add value=0> |
<table border=0 width=340 cellpadding=1 cellspacing=1> |
<tr><td> |
<b>Critère de sélection :</b> |
</td></tr> |
<tr><td> |
<select name=item_name onchange="this.form.add.value=1;this.form.submit()"> |
<option>--Attribute--</option> |
EOM; |
foreach($items as $key => $val) |
print("<option value=\"$key\">$val</option>"); |
echo <<<EOM |
</select> |
</td></tr> |
EOM; |
$number=1; |
$offset=0; |
while (${"item_of_w$number"}) { |
if(${"delete_w$number"}==1) {$offset=1;$number++;} |
else { |
$designator=$number-$offset; |
${"w$designator"} = new Qi("w$designator","",""); |
${"w$designator"}->get("w$number"); |
${"w$designator"}->show(); |
$number++; |
} |
} |
if($add==1) { |
${"w$number"} = new Qi("w$number","$item_name","$operators[0]"); |
${"w$number"}->show(); |
} |
echo <<<EOM |
</table> |
</td> |
<tr> |
<td> |
<input type=hidden name=queryflag value=0> |
<br><input type=submit class=button onclick="this.form.queryflag.value=1"> |
</td> |
</tr> |
</table> |
</form> |
</body> |
</html> |
EOM; |
} |
if ($queryflag == 1){ |
$i = 1; |
while (${"item_of_w$i"}){ |
$op_found = 0; |
foreach ($operators as $operator){ |
if (${"operator_of_w$i"} == $operator){ |
$op_found = 1; |
break; |
} |
} |
if (!$op_found) |
die("L'opération demandé n'est pas valide. Sortie anormale."); |
${"item_of_w$i"} = preg_replace('/\s/','',${"item_of_w$i"}); |
${"value_of_w$i"} = da_sql_escape_string(${"value_of_w$i"}); |
$where .= ($i == 1) ? ' WHERE ' . ${"item_of_w$i"} . ' ' . ${"operator_of_w$i"} . " '" . ${"value_of_w$i"} . "'" : |
' AND ' . ${"item_of_w$i"} . ' ' . ${"operator_of_w$i"} . " '" . ${"value_of_w$i"} . "'" ; |
$i++; |
} |
$order = ($order_by != '') ? "$order_by" : 'username'; |
if (preg_match("/[\s;]/",$order)) |
die("ORDER BY pattern is illegal. Exiting abnornally."); |
if (!is_numeric($maxresults)) |
die("Max Results is not in numeric form. Exiting abnormally."); |
unset($query_view); |
foreach ($accounting_show_attrs as $val) |
$query_view .= $val . ','; |
$query_view = ereg_replace(',$','',$query_view); |
unset($sql_extra_query); |
if ($config[sql_accounting_extra_query] != '') |
$sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config); |
$sql_extra_query = da_sql_escape_string($sql_extra_query); |
$query="SELECT " . da_sql_limit($maxresults,0,$config) . " $query_view FROM $config[sql_accounting_table] |
$where $sql_extra_query " . da_sql_limit($maxresults,1,$config) . |
" ORDER BY $order " . da_sql_limit($maxresults,2,$config) . ";"; |
echo <<<EOM |
<table border="0" width="100%" cellpadding="1" cellspacing="1"> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<p> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr bgcolor="#d0ddb0"> |
</tr> |
EOM; |
foreach($accounting_show_attrs as $val){ |
$desc = $sql_attrs[$val][desc]; |
echo "<th>$desc</th>\n"; |
} |
echo "</tr>\n"; |
$search = @da_sql_query($link,$config,$query); |
if ($search){ |
while( $row = @da_sql_fetch_array($search,$config) ){ |
$num++; |
echo "<tr align=center>\n"; |
foreach($accounting_show_attrs as $val){ |
$info = $row[$val]; |
if ($info == '') |
$info = '-'; |
$info = $sql_attrs[$val][func]($info); |
if ($val == 'username'){ |
$Info = urlencode($info); |
$info = "<a href=\"user_admin.php?login=$Info\" title=\"Edit user $info\">$info<a/>"; |
} |
echo <<<EOM |
<td>$info</td> |
EOM; |
} |
echo "</tr>\n"; |
} |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
echo <<<EOM |
</table> |
</td></tr> |
</table> |
</td></tr> |
</table> |
</body> |
</html> |
EOM; |
} |
?> |
/web/acc/manager/htdocs/user_stats.php |
---|
0,0 → 1,234 |
<?php |
require('/etc/freeradius-web/config.php'); |
require('../lib/functions.php'); |
require('../lib/sql/nas_list.php'); |
require_once('../lib/xlat.php'); |
?> |
<html> |
<?php |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php")) |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php"); |
else{ |
echo <<<EOM |
<title>Statistiques utilisateurs</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
<center> |
<b>Could not include SQL library functions. Aborting</b> |
</body> |
</html> |
EOM; |
exit(); |
} |
if ($start == '' && $stop == ''){ |
$now = time(); |
$stop = date($config[sql_date_format],$now); |
$now -= 604800; |
$start = date($config[sql_date_format],$now); |
} |
$start = da_sql_escape_string($start); |
$stop = da_sql_escape_string($stop); |
$pagesize = ($pagesize) ? $pagesize : 10; |
if (!is_numeric($pagesize) && $pagesize != 'all') |
$pagezise = 10; |
if ($pagesize > 100) |
$pagesize = 100; |
$limit = ($pagesize == 'all') ? '100' : "$pagesize"; |
$selected[$pagesize] = 'selected'; |
$order = ($order) ? $order : $config[general_accounting_info_order]; |
if ($order != 'desc' && $order != 'asc') |
$order = 'desc'; |
if ($sortby != '') |
$order_attr = ($sortby == 'num') ? 'connnum' : 'conntotduration'; |
else |
$order_attr = 'connnum'; |
if ($server != '' && $server != 'all'){ |
$server = da_sql_escape_string($server); |
$server_str = "AND nasipaddress = '$server'"; |
} |
$login_str = ($login) ? "AND username = '$login' " : ''; |
$selected[$order] = 'selected'; |
$selected[$sortby] = 'selected'; |
$sql_extra_query = ''; |
if ($config[sql_accounting_extra_query] != ''){ |
$sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config); |
$sql_extra_query = da_sql_escape_string($sql_extra_query); |
} |
unset($da_name_cache); |
if (isset($_SESSION['da_name_cache'])) |
$da_name_cache = $_SESSION['da_name_cache']; |
?> |
<head> |
<title>Statistiques utilisateurs</title> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
<center> |
<table border=0 width=550 cellpadding=0 cellspacing=0> |
<tr valign=top> |
<!--<td align=center><img src="images/title2.gif"></td>--> |
</tr> |
</table> |
<table border=0 width=400 cellpadding=0 cellspacing=2> |
</table> |
<br> |
<table border=0 width=840 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=65%></td> |
<td bgcolor="black" width=35%> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">Statistiques utilisateurs</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<?php |
echo <<<EOM |
De <b>$start</b> à <b>$stop</b> |
EOM; |
?> |
<p> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr bgcolor="#d0ddb0"> |
<th>#</th><th>Identifiant</th><th>Date</th><th>Serveur</th><th>Nombres de connections</th><th>Durée des connections</th><th>Upload</th><th>Download</th> |
</tr> |
<?php |
$link = @da_sql_pconnect($config); |
if ($link){ |
$search = @da_sql_query($link,$config, |
"SELECT " . da_sql_limit($limit,0,$config) . " * FROM $config[sql_total_accounting_table] |
WHERE acctdate >= '$start' AND acctdate <= '$stop' $server_str $login_str $sql_extra_query " . da_sql_limit($limit,1,$config) |
. " ORDER BY $order_attr $order " . da_sql_limit($limit,2,$config) . " ;"); |
if ($search){ |
while( $row = @da_sql_fetch_array($search,$config) ){ |
$num++; |
$acct_login = $row[username]; |
if ($acct_login == '') |
$acct_login = '-'; |
else{ |
$Acct_login = urlencode($acct_login); |
$acct_login = "<a href=\"user_admin.php?login=$Acct_login\" title=\"Editer l'utilisateur $acct_login\">$acct_login</a>"; |
} |
$acct_time = $row[conntotduration]; |
$acct_time = time2str($acct_time); |
$acct_conn_num = $row[connnum]; |
$acct_date = $row[acctdate]; |
$acct_upload = $row[inputoctets]; |
$acct_download = $row[outputoctets]; |
$acct_upload = bytes2str($acct_upload); |
$acct_download = bytes2str($acct_download); |
$acct_server = $da_name_cache[$row[nasipaddress]]; |
if (!isset($acct_server)){ |
$acct_server = @gethostbyaddr($row[nasipaddress]); |
if (!isset($da_name_cache) && $config[general_use_session] == 'yes'){ |
$da_name_cache[$row[nasipaddress]] = $acct_server; |
session_register('da_name_cache'); |
} |
else |
$da_name_cache[$row[nasipaddress]] = $acct_server; |
} |
if ($acct_server == '') |
$acct_server = '-'; |
echo <<<EOM |
<tr align=center bgcolor="white"> |
<td>$num</td> |
<td>$acct_login</td> |
<td>$acct_date</td> |
<td>$acct_server</td> |
<td>$acct_conn_num</td> |
<td>$acct_time</td> |
<td>$acct_upload</td> |
<td>$acct_download</td> |
</tr> |
EOM; |
} |
} |
} |
echo <<<EOM |
</table> |
<tr><td> |
<hr> |
<tr><td align="left"> |
<form action="user_stats.php" method="post" name="master"> |
<table border=0> |
<tr valign="bottom"> |
<td><small><b>date début</td><td><small><b>date fin</td><td><small><b>nbr./page</td><td><small><b>trié par</td><td><small><b>classé par ordre </td> |
<tr valign="middle"><td> |
<input type="hidden" name="show" value="0"> |
<input type="text" name="start" size="11" value="$start"></td> |
<td><input type="text" name="stop" size="11" value="$stop"></td> |
<td><select name="pagesize"> |
<option $selected[5] value="5" >05 |
<option $selected[10] value="10">10 |
<option $selected[15] value="15">15 |
<option $selected[20] value="20">20 |
<option $selected[40] value="40">40 |
<option $selected[80] value="80">80 |
<option $selected[all] value="all">tous |
</select> |
</td> |
<td> |
<select name="sortby"> |
<option $selected[num] value="num">Nombre de connexions |
<option $selected[time] value="time">Durée des connexions |
</select> |
</td> |
<td><select name="order"> |
<option $selected[asc] value="asc">croissant |
<option $selected[desc] value="desc">décroissant |
</select> |
</td> |
EOM; |
?> |
<td><input type="submit" class=button value="show"></td></tr> |
<tr><td> |
<b>Sur le serveur d'accès :</b> |
</td> |
<td><b>Utilisateur</b></td></tr> |
<tr><td> |
<select name="server"> |
<?php |
foreach ($nas_list as $nas){ |
$name = $nas[name]; |
if ($nas[ip] == '') |
continue; |
$servers[$name] = $nas[ip]; |
} |
ksort($servers); |
foreach ($servers as $name => $ip){ |
if ($server == $ip) |
echo "<option selected value=\"$ip\">$name\n"; |
else |
echo "<option value=\"$ip\">$name\n"; |
} |
if ($server == '' || $server == 'all') |
echo "<option selected value=\"all\">tous\n"; |
else |
echo "<option value=\"all\">tous\n"; |
?> |
</select> |
</td> |
<td><input type="text" name="login" size="11" value="<?php echo $login ?>"></td> |
</tr> |
</table></td></tr></form> |
</table> |
</tr> |
</table> |
</body> |
</html> |
/web/acc/manager/htdocs/clear_opensessions.php |
---|
0,0 → 1,193 |
<?php |
require('/etc/freeradius-web/config.php'); |
require_once('../lib/xlat.php'); |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php")) |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php"); |
else{ |
echo <<<EOM |
<title>Fermeture des sessions ouvertes pour l'utilisateur $login</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
<center> |
<b>Could not include SQL library functions. Aborting</b> |
</body> |
</html> |
EOM; |
exit(); |
} |
echo <<<EOM |
<html> |
<head> |
<title>Fermeture des sessions ouvertes pour l'usager : $login</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>Gestion des usagers</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1> |
<tr bgcolor="#666666"><td> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=2> |
<tr><td valign="middle" align="left"> |
<center> |
<table border=0 width=550 cellpadding=0 cellspacing=0> |
<tr valign=top> |
<!--<td align=center><img src="images/title2.gif"></td>--> |
</tr> |
</table> |
<table border=0 width=400 cellpadding=0 cellspacing=2> |
EOM; |
include("../html/user_toolbar.html.php"); |
$open_sessions = 0; |
$sql_extra_query = ''; |
if ($config[sql_accounting_extra_query] != ''){ |
$sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config); |
$sql_extra_query = da_sql_escape_string($sql_extra_query); |
} |
print <<<EOM |
</table> |
<br> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor="black" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">Fermeture des sessions ouvertes pour l'usager : $login</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
EOM; |
if ($drop_conns == 1){ |
$method = 'snmp'; |
$nastype = 'cisco'; |
if ($config[general_sessionclear_method] != '') |
$method = $config[general_sessionclear_method]; |
if ($config[general_nas_type] != '') |
$nastype = $config[general_nas_type]; |
if ($config[general_ld_library_path] != '') |
putenv("LD_LIBRARY_PATH=$config[general_ld_library_path]"); |
$nas_by_ip = array(); |
$meth_by_ip = array(); |
$nastype_by_ip = array(); |
foreach ($nas_list as $nas){ |
if ($nas[ip] != ''){ |
$ip = $nas[ip]; |
$nas_by_ip[$ip] = $nas[community]; |
$meth_by_ip[$ip] = $nas[sessionclear_method]; |
$nastype_by_ip[$ip] = $nas[nas_type]; |
} |
} |
$link = @da_sql_pconnect($config); |
if ($link){ |
$search = @da_sql_query($link,$config, |
"SELECT nasipaddress,acctsessionid FROM $config[sql_accounting_table] |
WHERE username = '$login' AND acctstoptime IS NULL;"); |
if ($search){ |
while($row = @da_sql_fetch_array($search,$config)){ |
$sessionid = $row[acctsessionid]; |
$sessionid = hexdec($sessionid); |
$nas = $row[nasipaddress]; |
$port = $row[nasportid]; |
$meth = $meth_by_ip[$nas]; |
$nastype = ($nastype_by_ip[$nas] != '') ? $nastype_by_ip[$nas] : $nastype; |
$comm = $nas_by_ip[$nas]; |
if ($meth == '') |
$meth = $method; |
if ($meth == 'snmp' && $comm != '') |
exec("$config[general_sessionclear_bin] $nas snmp $nastype $login $sessionid $comm"); |
if ($meth == 'telnet') |
exec("$config[general_sessionclear_bin] $nas telnet $nastype $login $sessionid $port"); |
} |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
} |
if ($clear_sessions == 1) |
{ |
exec ("sudo /usr/local/sbin/alcasar-logout.sh $login"); |
$sql_servers = array(); |
if ($config[sql_extra_servers] != '') |
$sql_servers = explode(' ',$config[sql_extra_servers]); |
$quer = '= 0'; |
if ($config[sql_type] == 'pg') |
$quer = 'IS NULL'; |
$sql_servers[] = $config[sql_server]; |
foreach ($sql_servers as $server) |
{ |
$link = @da_sql_host_connect($server,$config); |
if ($link) |
{ |
$res = @da_sql_query($link,$config, |
"DELETE FROM $config[sql_accounting_table] |
WHERE username='$login' AND acctstoptime $quer $sql_extra_query;"); |
if ($res) |
echo "<b>La comptabilité des sessions pour cet usager a été arrétée</b><br>\n"; |
else |
echo "<b>Error deleting open sessions for user" . da_sql_error($link,$config) . "</b><br>\n"; |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
} |
} |
$link = @da_sql_pconnect($config); |
if ($link){ |
$search = @da_sql_query($link,$config, |
"SELECT COUNT(*) AS counter FROM $config[sql_accounting_table] |
WHERE username = '$login' AND acctstoptime IS NULL $sql_extra_query;"); |
if ($search){ |
if ($row = @da_sql_fetch_array($search,$config)) |
$open_sessions = $row[counter]; |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
?> |
<form method=post> |
<input type=hidden name=login value=<?php print $login ?>> |
<input type=hidden name=clear_sessions value="0"> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr> |
<td align=center> |
<? |
if ($open_sessions == 0) |
{ |
echo "L'usager $login n'a pas de session ouverte"; |
} |
else { |
echo "L'usager $login a <i>$open_sessions</i> session(s) ouverte(s)<br><br>"; |
echo "Êtes-vous certain de vouloir "; |
if ($open_sessions == 1) { echo "la"; } else {echo "les"; } |
echo " fermer ? "; |
echo "<input type=submit class=button value=\"Oui, Fermer\" OnClick=\"this.form.clear_sessions.value=1\">"; |
} |
?> |
</form> |
</td></tr></table> |
<!--<input type=submit class=button value="Oui, poubelliser les connexions" OnClick="this.form.drop_conns.value=1">--> |
</td></tr></table> |
</TD></TR></TABLE> |
</body> |
</html> |
/web/acc/manager/htdocs/stats.php |
---|
0,0 → 1,186 |
<?php |
require('/etc/freeradius-web/config.php'); |
require('../lib/sql/nas_list.php'); |
require_once('../lib/xlat.php'); |
?> |
<html> |
<head> |
<title>Analyse des comptes</title> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
<center> |
<?php |
require_once('../lib/functions.php'); |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php")) |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php"); |
else{ |
echo <<<EOM |
<b>Could not include SQL library functions. Aborting</b> |
</body> |
</html> |
EOM; |
exit(); |
} |
$stats_num = array(); |
$date = strftime('%A, %e %B %Y, %T %Z'); |
$now = time(); |
if ($before == '') |
$before = date($config[sql_date_format], $now + 86400); |
$after = ($after != '') ? "$after" : date($config[sql_date_format], $now - 604800 ); |
$after_time = date2time($after); |
$before_time = date2time($before); |
$days[0] = $after; |
$counter = $after_time + 86400; |
$i = 1; |
while($counter < $before_time){ |
$days[$i++] = date($config[sql_date_format],$counter); |
$counter += 86400; |
} |
$days[$i] = $before; |
$num_days = $i; |
$column1 = ($column1 != '') ? "$column1" : 'sessions'; |
$column2 = ($column2 != '') ? "$column2" : 'usage'; |
$column3 = ($column3 != '') ? "$column3" : 'download'; |
$column[1] = "$column1"; |
$column[2] = "$column2"; |
$column[3] = "$column3"; |
$selected1["$column1"] = 'selected'; |
$selected2["$column2"] = 'selected'; |
$selected3["$column3"] = 'selected'; |
$message['sessions'] = 'sessions'; |
$message['usage'] = 'total usage time'; |
$message['usage'] = 'temps d\'utilisation total '; |
$message['upload'] = 'uploads'; |
$message['download'] = 'downloads'; |
if ($config[general_stats_use_totacct] == 'yes'){ |
$sql_val['sessions'] = 'connnum'; |
$sql_val['usage'] = 'conntotduration'; |
$sql_val['upload'] = 'inputoctets'; |
$sql_val['download'] = 'outputoctets'; |
} |
else{ |
$sql_val['usage'] = 'acctsessiontime'; |
$sql_val['upload'] = 'acctinputoctets'; |
$sql_val['download'] = 'acctoutputoctets'; |
} |
$fun['sessions'] = nothing; |
$fun['usage'] = time2strclock; |
$fun['upload'] = bytes2str; |
$fun['download'] = bytes2str; |
$sql_val['user'] = ($login == '') ? "WHERE username LIKE '%'" : "WHERE username = '$login'"; |
for ($j = 1; $j <= 3; $j++){ |
$tmp = "{$sql_val[$column[$j]]}"; |
$res[$j] = ($tmp == "") ? "COUNT(radacctid) AS res_$j" : "sum($tmp) AS res_$j"; |
} |
$i = 1; |
$servers[all] = 'all'; |
foreach ($nas_list as $nas){ |
$name = $nas[name]; |
if ($nas[ip] == '') |
continue; |
$servers[$name] = $nas[ip]; |
$i++; |
} |
ksort($servers); |
if ($server != 'all' && $server != ''){ |
$server = da_sql_escape_string($server); |
$s = "AND nasipaddress = '$server'"; |
} |
$sql_extra_query = ''; |
if ($config[sql_accounting_extra_query] != '') |
$sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config); |
$link = @da_sql_pconnect($config); |
if ($link){ |
for ($i = $num_days;$i > -1; $i--){ |
$day = "$days[$i]"; |
if ($config[general_stats_use_totacct] == 'yes') |
$search = @da_sql_query($link,$config, |
"SELECT $res[1],$res[2],$res[3] FROM $config[sql_total_accounting_table] |
$sql_val[user] AND acctdate = '$day' $s $sql_extra_query;"); |
else |
$search = @da_sql_query($link,$config, |
"SELECT $res[1],$res[2],$res[3] FROM $config[sql_accounting_table] |
$sql_val[user] AND acctstoptime >= '$day 00:00:00' |
AND acctstoptime <= '$day 23:59:59' $s $sql_extra_query;"); |
if ($search){ |
$row = @da_sql_fetch_array($search,$config); |
$data[$day][1] = $row[res_1]; |
$data[sum][1] += $row[res_1]; |
$stats_num[1] = ($data[$day][1]) ? $stats_num[1] + 1 : $stats_num[1]; |
$data[$day][2] = $row[res_2]; |
$data[sum][2] += $row[res_2]; |
$stats_num[2] = ($data[$day][2]) ? $stats_num[2] + 1 : $stats_num[2]; |
$data[$day][3] = $row[res_3]; |
$data[sum][3] += $row[res_3]; |
$stats_num[3] = ($data[$day][3]) ? $stats_num[3] + 1 : $stats_num[3]; |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
$stats_num[1] = ($stats_num[1]) ? $stats_num[1] : 1; |
$stats_num[2] = ($stats_num[2]) ? $stats_num[2] : 1; |
$stats_num[3] = ($stats_num[3]) ? $stats_num[3] : 1; |
$data['avg'][1] = ceil($data['sum'][1] / $stats_num[1]); |
$data['avg'][2] = ceil($data['sum'][2] / $stats_num[2]); |
$data['avg'][3] = ceil($data['sum'][3] / $stats_num[3]); |
$data['avg'][1] = $fun[$column[1]]($data['avg'][1]); |
$data['avg'][2] = $fun[$column[2]]($data['avg'][2]); |
$data['avg'][3] = $fun[$column[3]]($data['avg'][3]); |
$data['sum'][1] = $fun[$column[1]]($data['sum'][1]); |
$data['sum'][2] = $fun[$column[2]]($data['sum'][2]); |
$data['sum'][3] = $fun[$column[3]]($data['sum'][3]); |
for ($i = 0; $i <= $num_days; $i++){ |
$day = "$days[$i]"; |
$max[1] = ($max[1] > $data[$day][1] ) ? $max[1] : $data[$day][1]; |
$max[2] = ($max[2] > $data[$day][2] ) ? $max[2] : $data[$day][2]; |
$max[3] = ($max[3] > $data[$day][3] ) ? $max[3] : $data[$day][3]; |
} |
for ($i = 0; $i <= $num_days; $i++){ |
$day = "$days[$i]"; |
for ($j = 1; $j <= 3; $j++){ |
$tmp = $data[$day][$j]; |
if (!$max[$j]) |
$p = $w = $c = 0; |
else{ |
$p = floor(100 * ($tmp / $max[$j])); |
$w = floor(70 * ($tmp / $max[$j])); |
$c = hexdec('f0e9e2') - (258 * $p); |
$c = dechex($c); |
} |
if (!$w) |
$w++; |
$perc[$day][$j] = $p . "%"; |
$width[$day][$j] = $w; |
$color[$day][$j] = $c; |
} |
$data[$day][1] = $fun[$column[1]]($data[$day][1]); |
$data[$day][2] = $fun[$column[2]]($data[$day][2]); |
$data[$day][3] = $fun[$column[3]]($data[$day][3]); |
} |
$data[max][1] = $fun[$column[1]]($max[1]); |
$data[max][2] = $fun[$column[2]]($max[2]); |
$data[max][3] = $fun[$column[3]]($max[3]); |
require('../html/stats.html.php'); |
?> |
/web/acc/manager/htdocs/failed_logins.php |
---|
0,0 → 1,236 |
<?php |
require('/etc/freeradius-web/config.php'); |
require('../lib/attrshow.php'); |
require('../lib/sql/nas_list.php'); |
require_once('../lib/xlat.php'); |
?> |
<html> |
<?php |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php")) |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php"); |
else{ |
echo <<<EOM |
<title>Failed logins</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
<center> |
<b>Could not include SQL library functions. Aborting</b> |
</body> |
</html> |
EOM; |
exit(); |
} |
$now = time(); |
if (!isset($last)) |
$last = ($config[general_most_recent_fl]) ? $config[general_most_recent_fl] : 5; |
if (!is_numeric($last)) |
$last = 5; |
$start = $now - ($last*60); |
$now_str = date($config[sql_full_date_format],$now); |
$prev_str = date($config[sql_full_date_format],$start); |
$now_str = da_sql_escape_string($now_str); |
$prev_str = da_sql_escape_string($prev_str); |
$pagesize = ($pagesize) ? $pagesize : 10; |
if (!is_numeric($pagesize) && $pagesize != 'all') |
$pagesize = 10; |
$limit = ($pagesize == 'all') ? '' : "$pagesize"; |
$selected[$pagesize] = 'selected'; |
$order = ($order != '') ? $order : $config[general_accounting_info_order]; |
if ($order != 'desc' && $order != 'asc') |
$order = 'desc'; |
$selected[$order] = 'selected'; |
if ($callerid != ''){ |
$callerid = da_sql_escape_string($callerid); |
$callerid_str = "AND callingstationid = '$callerid'"; |
} |
if ($server != '' && $server != 'all'){ |
$server = da_sql_escape_string($server); |
$server_str = "AND nasipaddress = '$server'"; |
} |
unset($da_name_cache); |
if (isset($_SESSION['da_name_cache'])) |
$da_name_cache = $_SESSION['da_name_cache']; |
?> |
<head> |
<title>Authentifications manquées</title> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
<center> |
<table border=0 width=550 cellpadding=0 cellspacing=0> |
<tr valign=top> |
<!--<td align=center><img src="images/title2.gif"></td>--> |
</tr> |
</table> |
<table border=0 width=400 cellpadding=0 cellspacing=2> |
</table> |
<br> |
<table border=0 width=840 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=65%></td> |
<td bgcolor="black" width=35%> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">Authentificatins manquées</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<?php |
echo <<<EOM |
<b>$prev_str</b> up to <b>$now_str</b> |
EOM; |
?> |
<p> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr bgcolor="#d0ddb0"> |
<th>#</th><th>login</th> |
<?php |
if ($acct_attrs['fl'][2] != '') echo "<th>" . $acct_attrs['fl'][2] . "</th>\n"; |
if ($acct_attrs['fl'][7] != '') echo "<th>" . $acct_attrs['fl'][7] . "</th>\n"; |
if ($acct_attrs['fl'][8] != '') echo "<th>" . $acct_attrs['fl'][8] . "</th>\n"; |
if ($acct_attrs['fl'][9] != '') echo "<th>" . $acct_attrs['fl'][9] . "</th>\n"; |
unset($sql_extra_query); |
if ($config[sql_accounting_extra_query] != ''){ |
$sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config); |
$sql_extra_query = da_sql_escape_string($sql_extra_query); |
} |
?> |
</tr> |
<?php |
$link = @da_sql_pconnect($config); |
if ($link){ |
$search = @da_sql_query($link,$config, |
"SELECT " . da_sql_limit($limit,0,$config) . " acctstoptime,username,nasipaddress,nasportid,acctterminatecause,callingstationid |
FROM $config[sql_accounting_table] |
WHERE acctstoptime <= '$now_str' AND acctstoptime >= '$prev_str' |
AND (acctterminatecause LIKE 'Login-Incorrect%' OR |
acctterminatecause LIKE 'Invalid-User%' OR |
acctterminatecause LIKE 'Multiple-Logins%') $callerid_str $server_str $sql_extra_query " . da_sql_limit($limit,1,$config) . |
" ORDER BY acctstoptime $order " . da_sql_limit($limit,2,$config) . " ;"); |
if ($search){ |
while( $row = @da_sql_fetch_array($search,$config) ){ |
$num++; |
$acct_login = $row[username]; |
if ($acct_login == '') |
$acct_login = '-'; |
else |
$acct_login = "<a href=\"user_admin.php?login=$acct_login\" title=\"Editer l'utilisateur $acct_login\">$acct_login</a>"; |
$acct_time = $row[acctstoptime]; |
$acct_server = $row[nasipaddress]; |
if ($acct_server != ''){ |
$acct_server = $da_name_cache[$acct_server]; |
if (!isset($acct_server)){ |
$acct_server = $row[nasipaddress]; |
$acct_server = @gethostbyaddr($acct_server); |
if (!isset($da_name_cache) && $config[general_use_session] == 'yes'){ |
$da_name_cache[$row[nasipaddress]] = $acct_server; |
session_register('da_name_cache'); |
} |
else |
$da_name_cache[$row[nasipaddress]] = $acct_server; |
} |
} |
else |
$acct_server = '-'; |
$acct_server = "$acct_server:$row[nasportid]"; |
$acct_terminate_cause = "$row[acctterminatecause]"; |
if ($acct_terminate_cause == '') |
$acct_terminate_cause = '-'; |
$acct_callerid = "$row[callingstationid]"; |
if ($acct_callerid == '') |
$acct_callerid = '-'; |
echo <<<EOM |
<tr align=center bgcolor="white"> |
<td>$num</td> |
<td>$acct_login</td> |
EOM; |
if ($acct_attrs['fl'][2] != '') echo "<td>$acct_time</td>\n"; |
if ($acct_attrs['fl'][2] != '') echo "<td>$acct_server</td>\n"; |
if ($acct_attrs['fl'][2] != '') echo "<td>$acct_terminate_cause</td>\n"; |
if ($acct_attrs['fl'][2] != '') echo "<td>$acct_callerid</td>\n"; |
echo "</tr>\n"; |
} |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
echo <<<EOM |
</table> |
<tr><td> |
<hr> |
<tr><td align="left"> |
<form action="failed_logins.php" method="get" name="master"> |
<table border=0> |
<tr valign="bottom"> |
<td><small><b>time back (mins)</td><td><small><b>pagesize</td><td><small><b>caller id</td><td><b>order</td> |
<tr valign="middle"><td> |
<input type="text" name="last" size="11" value="$last"></td> |
<td><select name="pagesize"> |
<option $selected[5] value="5" >05 |
<option $selected[10] value="10">10 |
<option $selected[15] value="15">15 |
<option $selected[20] value="20">20 |
<option $selected[40] value="40">40 |
<option $selected[80] value="80">80 |
<option $selected[all] value="all">all |
</select> |
</td> |
<td> |
<input type="text" name="callerid" size="11" value="$callerid"></td> |
<td><select name="order"> |
<option $selected[asc] value="asc">older first |
<option $selected[desc] value="desc">recent first |
</select> |
</td> |
EOM; |
?> |
<td><input type="submit" class=button value="show"></td></tr> |
<tr><td> |
<b>Sur le serveur d'acc&eagrave; :</b> |
</td></tr><tr><td> |
<select name="server"> |
<?php |
foreach ($nas_list as $nas){ |
$name = $nas[name]; |
if ($nas[ip] == '') |
continue; |
$servers[$name] = $nas[ip]; |
} |
ksort($servers); |
foreach ($servers as $name => $ip){ |
if ($server == $ip) |
echo "<option selected value=\"$ip\">$name\n"; |
else |
echo "<option value=\"$ip\">$name\n"; |
} |
if ($server == '' || $server == 'all') |
echo "<option selected value=\"all\">all\n"; |
else |
echo "<option value=\"all\">all\n"; |
?> |
</select> |
</td></tr> |
</table></td></tr></form> |
</table> |
</tr> |
</table> |
</body> |
</html> |
/web/acc/manager/htdocs/user_delete.php |
---|
0,0 → 1,131 |
<?php |
require('/etc/freeradius-web/config.php'); |
if ($type != 'group') |
if (is_file("../lib/$config[general_lib_type]/user_info.php")) |
include("../lib/$config[general_lib_type]/user_info.php"); |
else |
if (is_file("../lib/$config[general_lib_type]/group_info.php")) |
include("../lib/$config[general_lib_type]/group_info.php"); |
$whatis = ($user_type == 'group') ? 'le groupe' : 'l\'usager'; |
$whatisL = ($user_type == 'group') ? 'de groupe' : 'd\'usager'; |
echo <<<EOM |
<html> |
<head> |
EOM; |
if ($user_type != 'group'){ |
echo "<title>delete user $login ($cn)</title>\n"; |
$util = "usagers";} |
else{ |
echo "<title>delete group $login</title>\n"; |
$util = "groupes";} |
echo <<<EOM |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>Gestion des $util</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1> |
<tr bgcolor="#666666"><td> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=2> |
<tr><td valign="middle" align="left"> |
<center> |
<table border=0 width=550 cellpadding=0 cellspacing=0> |
<tr valign=top> |
<!--<td align=center><img src="images/title2.gif"></td>--> |
</tr> |
</table> |
<table border=0 width=400 cellpadding=0 cellspacing=2> |
EOM; |
if ($user_type != 'group') |
include("../html/user_toolbar.html.php"); |
else |
include("../html/group_toolbar.html.php"); |
print <<<EOM |
</table> |
<br> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor="black" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">Suppression $whatisL</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
EOM; |
if ($delete_user == 1){ |
if ($user_type != 'group'){ |
if (is_file("../lib/$config[general_lib_type]/delete_user.php")) |
include("../lib/$config[general_lib_type]/delete_user.php"); |
} |
else{ |
if ($delete_users_of_group == 1){ |
unset($group_members); |
$tmp_group_name=$login; |
if (is_file("../lib/$config[general_lib_type]/group_info.php")){ |
include("../lib/$config[general_lib_type]/group_info.php"); |
} |
foreach ($group_members as $member){ |
$login=$member; |
if (is_file("../lib/$config[general_lib_type]/delete_user.php")) |
include("../lib/$config[general_lib_type]/delete_user.php"); |
} |
$login=$tmp_group_name; |
} |
if (is_file("../lib/$config[general_lib_type]/delete_group.php")) |
include("../lib/$config[general_lib_type]/delete_group.php"); |
} |
echo <<<EOM |
</td></tr> |
</table> |
</tr> |
</table> |
</body> |
</html> |
EOM; |
exit(); |
} |
?> |
<form method=post> |
<input type=hidden name=login value=<?php print $login ?>> |
<input type=hidden name=delete_user value="0"> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr> |
<td align=center> |
<?php |
if ($user_type == 'group'){ |
echo "Suppression automatique des membres du groupe : "; |
echo "<input type=checkbox name=delete_users_of_group value=\"1\">"; |
} |
echo "<br>"; |
echo "Etes-vous certain de vouloir supprimer $whatis $login ? "; |
?> |
<input type=submit class=button value="Oui supprimer" OnClick="this.form.delete_user.value=1"> |
</form> |
</td></tr></table></td></tr> |
</table> |
</tr> |
</table> |
</TD></TR> |
</TABLE> |
</td></tr> |
</TABLE> |
</body> |
</html> |
/web/acc/manager/htdocs/style.css |
---|
0,0 → 1,38 |
td {font-family:verdana,sans-serif;text-decoration:none;font-size:11px} |
th {font-family:verdana,sans-serif;text-decoration:none;font-size:11px} |
A {FONT-FAMILY: verdana,sans-serif; FONT-SIZE: 11px; TEXT-DECORATION: none} |
H1 {FONT-FAMILY: lucida,sans-serif; FONT-SIZE: 24px; TEXT-DECORATION: none} |
INPUT{ |
BACKGROUND-COLOR: #EEEEEE; |
BORDER-BOTTOM: #3333CC 1px solid; |
BORDER-LEFT: #3333CC 1px solid; |
BORDER-RIGHT: #3333CC 1px solid; |
BORDER-TOP: #3333CC 1px solid; |
COLOR: #000000; |
FONT-FAMILY: Verdana |
} |
INPUT.button{ |
BACKGROUND-COLOR: #999999; |
BORDER-BOTTOM: #3333CC 1px solid; |
BORDER-LEFT: #3333CC 1px solid; |
BORDER-RIGHT: #3333CC 1px solid; |
BORDER-TOP: #3333CC 1px solid; |
COLOR: #000000; |
FONT-FAMILY: Verdana |
} |
body |
{ |
BACKGROUND-COLOR: #EFEFEF; |
} |
a:link { |
color: #000000; |
} |
a:visited { |
color:#000000; |
} |
a:hover { |
color:#000000; |
} |
a:active { |
color:#000000; |
} |
/web/acc/manager/htdocs/group_admin.php |
---|
0,0 → 1,141 |
<?php |
require('/etc/freeradius-web/config.php'); |
if ($show == 1 && isset($del_members)){ |
header("Location: user_admin.php?login=$del_members[0]"); |
exit; |
} |
if ($config[general_lib_type] != 'sql'){ |
echo <<<EOM |
<title>Page de gestion des groupes</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
<center> |
<b>This page is only available if you are using sql as general library type</b> |
</body> |
</html> |
EOM; |
exit(); |
} |
unset($group_members); |
if (is_file("../lib/$config[general_lib_type]/group_info.php")){ |
include("../lib/$config[general_lib_type]/group_info.php"); |
if ($group_exists == 'no'){ |
echo <<<EOM |
<title>Page de gestion des groupes</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
<center> |
<form action="group_admin.php" method=get> |
<b>Le groupe </b> |
<input type="text" size=10 name="login" value="$login"> |
<b> n'existe pas</b><br> |
<input type=submit class=button value="Show Group"> |
</body> |
</html> |
EOM; |
exit(); |
} |
} |
?> |
<html> |
<head> |
<title>Page de gestion des groupes</title> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>Gestion des groupes</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1> |
<tr bgcolor="#666666"><td> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=2> |
<tr><td valign="middle" align="left"> |
<center> |
<table border=0 width=550 cellpadding=0 cellspacing=0> |
<tr valign=top> |
<!--<td align=center><img src="images/title2.gif"></td>--> |
</tr> |
</table> |
<table border=0 width=400 cellpadding=0 cellspacing=2> |
<?php |
include("../html/group_toolbar.html.php"); |
?> |
</table> |
<br> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor="black" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">Gestion du groupe <?php echo $login ?></font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<?php |
if ($do_changes == 1){ |
if (is_file("../lib/$config[general_lib_type]/group_admin.php")) |
include("../lib/$config[general_lib_type]/group_admin.php"); |
if (is_file("../lib/$config[general_lib_type]/group_info.php")) |
include("../lib/$config[general_lib_type]/group_info.php"); |
} |
?> |
<form method=post> |
<input type=hidden name=login value=<?php echo $login ?>> |
<input type=hidden name=do_changes value=0> |
<input type=hidden name=show value=0> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
<b>Membre(s) à effacer</b><br> (les membres sélectionnés seront effacés du groupe<br>utilisez 'shift' ou 'Ctrl' pour une sélection multiple) |
</td> |
<td> |
<select name=del_members[] multiple size=5> |
<?php |
foreach ($group_members as $member){ |
echo "<option value=\"$member\">$member\n"; |
} |
?> |
</select> |
</td> |
</tr> |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
<b>Membre(s) à ajouter</b><br>(séparez les membres par un espace ou un 'retour chariot') |
</td> |
<td> |
<textarea name=new_members cols="15" wrap="PHYSICAL" rows=5></textarea> |
</td> |
</tr> |
</table> |
<br> |
<input type=submit class=button value="Effectuer les changements" OnClick="this.form.do_changes.value=1"> |
<br><br> |
<input type=submit class=button value="Gérer l'utilisateur sélectionné" OnClick="this.form.show.value=1"> |
</form> |
</td></tr> |
</table> |
</tr> |
</table> |
</TD></TR> |
</TABLE> |
</td></tr> |
</TABLE> |
</body> |
</html> |
/web/acc/manager/htdocs/group_new.php |
---|
0,0 → 1,252 |
<?php |
# Choice of language |
$Language = 'en'; |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){ |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); |
$Language = strtolower(substr(chop($Langue[0]),0,2)); } |
if($Language == 'fr'){ |
$l_title = "Création d'un groupe"; |
$l_frame_top = "Gestion des groupes"; |
$l_frame = "Gestion des groupes"; |
$l_group_create = "Créer un groupe"; |
} |
else { |
$l_title = "Create a group"; |
$l_frame_top = "Groups admin"; |
$l_frame = "Groups admin"; |
$l_group_create = "Create a group"; |
} |
require('/etc/freeradius-web/config.php'); |
if ($show == 1){ |
header("Location: group_admin.php?login=$login"); |
exit; |
} |
if ($config[general_lib_type] != 'sql'){ |
echo <<<EOM |
<title>$l_title</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
<center> |
<b>This page is only available if you are using sql as general library type</b> |
</body> |
</html> |
EOM; |
exit(); |
} |
require('../lib/attrshow.php'); |
require('../lib/defaults.php'); |
require("../lib/$config[general_lib_type]/group_info.php"); |
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){ |
$colspan=2; |
$show_ops=1; |
}else{ |
$show_ops = 0; |
$colspan=1; |
} |
echo "<html><head><title>$l_title</title>"; |
?> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<link rel="stylesheet" href="/css/style.css"> |
<script language="javascript" type="text/javascript"> |
function formControl(){ |
var myregex = /[\S]+/gi; //un ou plusieurs caractères non blanc" (tous les caractères sauf espace, retour chariot, tabulation, saut de ligne, saut de page). |
if (myregex.test(document.newgroup.login.value)){ |
document.newgroup.create.value=1; |
return true; |
} else { |
alert("Nom du groupe invalide.");//non internationnalisé |
return false; |
} |
} |
</script> |
</head> |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th><? echo "$l_frame_top"; ?></th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1> |
<tr bgcolor="#666666"><td> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=2> |
<tr><td valign="middle" align="left"> |
<center> |
<table border=0 width=550 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor="black" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white"><? echo "$l_group_create"; ?></font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<?php |
if (is_file("../lib/$config[general_lib_type]/group_info.php")) |
include("../lib/$config[general_lib_type]/group_info.php"); |
if ($create == 1){ |
if ($group_exists != "no"){ |
echo <<<EOM |
<b>Le groupe <i>$login</i> existe déjà.</b> |
EOM; |
} |
else{ |
if (is_file("../lib/$config[general_lib_type]/create_group.php")) |
include("../lib/$config[general_lib_type]/create_group.php"); |
if (is_file("../lib/$config[general_lib_type]/group_info.php")) |
include("../lib/$config[general_lib_type]/group_info.php"); |
} |
} |
?> |
<form name="newgroup" method=post> |
<input type=hidden name=create value="0"> |
<input type=hidden name=show value="0"> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<?php |
echo <<<EOM |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
Groupe(s) déjà créé(s) |
</td><td> |
EOM; |
if (!isset($existing_groups)) |
echo "<b>Aucun groupe déjà créé</b>\n"; |
else{ |
echo "<select name=\"existing_groups\">\n"; |
foreach ($existing_groups as $group => $count) |
echo "<option value=\"$group\">$group\n"; |
echo "</select>\n"; |
} |
echo <<<EOM |
</td> |
</tr> |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
Nom du groupe |
</td><td> |
<input type=text name="login" value="$login" size=35> |
</td> |
</tr> |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
Membres du groupe : séparés par un espace ou un 'retour chariot'. |
</td><td> |
<textarea name=members cols="15" wrap="PHYSICAL" rows=5></textarea> |
</td> |
</tr> |
EOM; |
foreach($show_attrs as $key => $desc){ |
$name = $attrmap["$key"]; |
if ($name == 'none') |
continue; |
$oper_name = $name . '_op'; |
$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0]; |
print <<<EOM |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
$desc |
</td> |
EOM; |
if ($show_ops){ |
switch ($key) |
{ |
case 'Simultaneous-Use' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Login-Time' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Expiration' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Session-Timeout' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'Max-Daily-Session' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Max-Weekly-Session' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Max-Monthly-Session' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'ChilliSpot-Max-Input-Octets' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'ChilliSpot-Max-Output-Octets' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'ChilliSpot-Max-Total-Octets' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'ChilliSpot-Bandwidth-Max-Up' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'ChilliSpot-Bandwidth-Max-Down' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'WISPr-Redirection-URL' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
default : |
print <<<EOM |
<td> |
<select name=$oper_name> |
<option $selected[$op_eq] value="=">= |
<option $selected[$op_set] value=":=">:= |
<option $selected[$op_add] value="+=">+= |
<option $selected[$op_eq2] value="==">== |
<option $selected[$op_ne] value="!=">!= |
<option $selected[$op_gt] value=">">> |
<option $selected[$op_ge] value=">=">>= |
<option $selected[$op_lt] value="<">< |
<option $selected[$op_le] value="<="><= |
<option $selected[$op_regeq] value="=~">=~ |
<option $selected[$op_regne] value="!~">!~ |
<option $selected[$op_exst] value="=*">=* |
<option $selected[$op_nexst] value="!*">!* |
</select> |
</td> |
EOM; |
break; |
} |
} |
print <<<EOM |
<td> |
<input type=text name="$name" value="$val" size=35> |
</td> |
</tr> |
EOM; |
} |
echo "</table><BR>"; |
if ($create == 1) |
echo "<input type=submit class=button value=\"Afficher le groupe\" OnClick=\"this.form.show.value=1\">"; |
else |
echo "<input type=submit class=button value=\"Créer\" OnClick=\"return formControl();\">"; |
?> |
<br><br> |
</form> |
</td></tr> |
</table> |
</tr> |
</table> |
</TD></TR> |
</TABLE> |
</td></tr> |
</TABLE> |
</body> |
</html> |
/web/acc/manager/htdocs/import_user.php |
---|
0,0 → 1,289 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
<HTML><!-- Written by Rexy, Romero P. & 3abTux --> |
<HEAD> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<TITLE>Users import</TITLE> |
<link rel="stylesheet" href="/css/style.css" type="text/css"> |
</HEAD> |
<body> |
<? |
# Choice of language |
$Language = 'en'; |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){ |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); |
$Language = strtolower(substr(chop($Langue[0]),0,2)); } |
if($Language == 'fr'){ |
$l_title = "Import d'usagers"; |
$l_database_state = "État actuel de la base : nombre de groupes ="; |
$l_number_of_users = "Nombre d'usagers"; |
$l_text_import = "Importer à partir d'un fichier texte ('.txt')"; |
$l_text_import_help = "Ce fichier ne doit contenir que des noms d'usager écrit les uns sous les autres."; |
$l_file = "Fichier"; |
$l_users_service = "Définissez leur service (facultatif)"; |
$l_users_group = "Définissez leur groupe (conseillé)"; |
$l_send = "Envoyer"; |
$l_imported_files = "Fichiers des identifiants/mot_de_passe importés durant les dernières 24h :"; |
$l_db_import = "Importer à partir d'une sauvegarde de la base d'usagers (format SQL)"; |
$l_db_import_help = "Afin de pouvoir imputer les dernière traces de connexion, une sauvegarde de la base actuelle sera automatiquement réalisée."; |
$l_db_reset = "Remise à zéro de la base usagers"; |
} |
else { |
$l_title = "Users import"; |
$l_database_state ="State of the database : number of groups ="; |
$l_number_of_users = "Number of users"; |
$l_text_import = "Import from a text file ('.txt')"; |
$l_text_import_help = "In this file, you must write only the user login one below the other."; |
$l_file = "File"; |
$l_users_service = "Define their service (optional)"; |
$l_users_group = "Define their group (advisable)"; |
$l_send = "Send"; |
$l_imported_files = "Logins/passwords file imported during the last 24h :"; |
$l_db_import = "Import from a saved users database file (SQL format)"; |
$l_db_import_help = "In order to impute the last connections, the actual users database will be automaticly saved."; |
$l_db_reset = "Reset the users database"; |
} |
function getImportFileList(){ |
$importFile = array(); |
if ($handle = opendir('/tmp')) { |
while (false !== ($file = readdir($handle))) { |
if ($file != "." && $file != "..") { |
$ext = pathinfo($file ,PATHINFO_EXTENSION); |
$name = substr($file, 0, -(strlen($ext)+1)); //Retirer les lettres de l'extension ET le point |
if ($ext=="pwd"){ |
$importFile[] = $name; |
} |
} |
} |
closedir($handle); |
} |
return $importFile; |
} |
function creatlog ($login,$password,$service,$RS_out) |
{ |
/* génère un fichier en sortie avec les info de connexion en clair */ |
fputs($RS_out," --- Accès à Internet via ALCASAR --- "."\r\n\r\n"); |
fputs($RS_out,"Service : $service"."\r\n\r\n"); |
fputs($RS_out,"Nom de connexion : $login | Mot de passe : $password\r\n\r\n"); |
fputs($RS_out,"Pensez à changer votre mot de passe (lien sur la page d'authentification)"."\r\n\r\n"); |
fputs($RS_out,"--------------------------------------------------------------------------------"."\r\n\r\n"); |
} |
function GenPassword($nb_car="8") |
{ |
/* generation aléatoire du mot de passe */ |
$password = ""; |
$chaine = "aAzZeErRtTyYuUIopP152346897mMLkK"; |
$chaine .= "jJhHgGfFdDsSqQwWxXcCvVbBnN152346897"; |
while($nb_car != 0) |
{ |
$i = rand(0,71); |
$password .= $chaine[$i]; |
$nb_car --; |
} |
return $password ; |
} |
?> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th><? echo "$l_title"; ?></th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1> |
<tr><td valign="middle" align="left"> |
<CENTER><H3> |
<?php |
echo "$l_database_state"; |
$LIBpath = "../lib/"; |
require('/etc/freeradius-web/config.php'); |
if (is_file($LIBpath."sql/drivers/$config[sql_type]/functions.php")) |
{ |
include_once($LIBpath."sql/drivers/$config[sql_type]/functions.php"); |
} |
else |
{ |
echo "<b>Could not include SQL library</b><br>\n"; |
exit(); |
} |
include_once($LIBpath.'functions.php'); |
if ($config[sql_use_operators] == 'true') |
{ |
include($LIBpath."operators.php"); |
$text = ',op'; |
$passwd_op = ",':='"; |
} |
$link = @da_sql_pconnect($config); |
$choix = $_POST ['choix']; |
if ($choix == "raz") |
{ |
exec ("sudo /usr/local/sbin/alcasar-mysql.sh -raz"); |
} |
# un fichier est importé |
if(isset($_FILES['import-users'])) |
{ |
unset($result); |
$service = $_POST['service']; |
$group = $_POST ['groupe']; |
$destination = '/tmp/import_file.txt'; |
list($name_file , $extension) = explode("." , $_FILES['import-users']['name']); |
$extension = strstr($_FILES['import-users']['name'], '.'); |
$tmpdate = date("Ymd-hms"); |
$file_out = "/tmp/$tmpdate-$name_file.pwd" ; |
if ($choix == "csv") |
//import d'un fichier txt |
{ |
if (($extension != '.csv') && ($extension != '.txt')) $result = 'Veuillez sélectionner un fichier de type csv ou txt !'; |
else |
{ |
exec ("sudo /usr/local/sbin/alcasar-mysql.sh -dump"); |
move_uploaded_file($_FILES['import-users']['tmp_name'], $destination); |
$RS_in = file ($destination); |
$da_abort=0; |
if ($link) |
{ |
if (is_file($LIBpath."crypt/$config[general_encryption_method].php")) |
{ |
include($LIBpath."crypt/$config[general_encryption_method].php"); |
$RS_out = fopen ("$file_out", "wb"); |
foreach ($RS_in as $no => $ligne) |
{ |
$tligne = split(" ",$ligne); |
$login = str_replace("%0D","",str_replace("%0A","",urlencode ($tligne[0]))); |
$password = GenPassword(); |
$passwd = da_encrypt($password); |
$passwd = da_sql_escape_string($passwd); |
/* insertion (login + password) dans la table "radcheck" (si l'usager existe --> changement de mot de passe) */ |
$res = @da_sql_query($link,$config,"INSERT INTO $config[sql_check_table] (attribute,value,username $text) VALUES ('$config[sql_password_attribute]','$passwd','$login' $passwd_op);"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)) |
{ |
echo "<b>Unable to add user $login: " . da_sql_error($link,$config) . "</b><br>\n"; |
$da_abort=1; |
} |
else |
{ |
creatlog ($login,$password,$service,$RS_out); |
/*echo $login." : ".$password." , ";*/ |
} |
/* insertion de l'usager dans la table "userinfo" */ |
if ($config[sql_use_user_info_table] == 'true' && !$da_abort) |
{ |
$res = @da_sql_query($link,$config, "SELECT username FROM $config[sql_user_info_table] WHERE username = '$login';"); |
if ($res) |
{ |
if (!@da_sql_num_rows($res,$config)) |
{ |
$res = @da_sql_query($link,$config,"INSERT INTO $config[sql_user_info_table] (username,department) VALUES ('$login','$service');"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)) |
echo "<b>Could not add user information in user info table: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
else |
echo "<b>User already exists in user info table.</b><br>\n"; |
} |
else |
echo "<b>Could not add user information in user info table: " . da_sql_error($link,$config) . "</b><br>\n"; |
if ($group != '') |
{ |
$group = da_sql_escape_string($group); |
$res = @da_sql_query($link,$config,"SELECT username FROM $config[sql_usergroup_table] WHERE username = '$login' AND groupname = '$group';"); |
if ($res) |
{ |
if (!@da_sql_num_rows($res,$config)) |
{ |
$res = @da_sql_query($link,$config,"INSERT INTO $config[sql_usergroup_table] (username,groupname) VALUES ('$login','$group');"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)) |
echo "<b>Could not add user to group $group. SQL Error</b><br>\n"; |
} # end if |
else |
echo "<b>User already is a member of group $group</b><br>\n"; |
} # end if |
else |
echo "<b>Could not add user to group $group: " . da_sql_error($link,$config) . "</b><br>\n"; |
} # end if ($group) |
} # end if ($config) |
} # end foreach |
fclose($RS_out); |
} |
} # end if (is_file ... |
} |
} |
else if ($choix == "bdd") |
//import d'une Bdd |
{ |
echo $extention; |
if ($extension != '.sql') $result = 'Veuillez sélectionner un fichier de type sql !'; |
else |
{ |
exec ("sudo /usr/local/sbin/alcasar-mysql.sh -dump"); |
move_uploaded_file($_FILES['import-users']['tmp_name'], $destination); |
exec ("sudo /usr/local/sbin/alcasar-mysql.sh -import $destination"); |
} |
} |
} |
if ($link) |
{ |
$res = @da_sql_query($link,$config,"SELECT GroupName FROM radusergroup GROUP BY GroupName"); |
if ($res) |
{ |
$nb_group = @da_sql_num_rows($res,$config); |
echo $nb_group; |
} |
} |
echo ", $l_number_of_users = "; |
if ($link) |
{ |
$res = @da_sql_query($link,$config,"SELECT UserName FROM userinfo"); |
if ($res) |
{ |
$nb_user = @da_sql_num_rows($res,$config); |
echo "$nb_user"; |
} |
} |
echo "</td></tr><tr><td>"; |
echo "<TABLE width=\"100%\" border=0 cellspacing=0 cellpadding=1>"; |
echo "<tr><td valign=\"middle\" align=\"left\" colspan=\"2\">"; |
echo "<CENTER><H3>$l_text_import</H3></CENTER></td></tr>"; |
echo "<tr><td valign=\"middle\" align=\"left\">"; |
echo "$l_text_import_help<br>"; |
echo "<tr><td valign=\"middle\" align=\"left\">"; |
echo "<br><FORM action='$_SERVER[PHP_SELF]' method=POST ENCTYPE=\"multipart/form-data\">"; |
echo "$l_file (.txt) : <input type=\"file\" name=\"import-users\"><br>"; |
echo "$l_users_service : <input type=\"input\" name=\"service\" value=\"\"><br>"; |
echo "$l_users_group : <input type=\"input\" name=\"groupe\" value=\"\"><br>"; |
echo "<input type='hidden' name='choix' value='csv'>"; |
if (($choix == "csv") && isset($result)) echo $result."<BR>"; |
echo "<input type=\"submit\" value=\"$l_send\">"; |
echo "</FORM></td>"; |
echo "<td>"; |
$ImportFileList = getImportFileList(); |
if (count($ImportFileList) > 0){ |
echo "$l_imported_files"; |
echo "<ul>"; |
foreach ( $ImportFileList as $ImportFile ) //on parcours le tableau |
{ |
echo "<li>".$ImportFile." ( <a href=\"import_file.php?file=$ImportFile\">txt</a> - <a href=\"import_file.php?file=$ImportFile&format=pdf\">pdf</a> )</li>"; |
} |
echo "</ul>"; |
} else { |
echo "<br>"; |
} |
echo "</td></tr></table>"; |
echo "<tr><td valign=\"middle\" align=\"left\">"; |
echo "<H3><CENTER>$l_db_import</CENTER></H3>"; |
echo "$l_db_import_help <br><br>"; |
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST ENCTYPE=\"multipart/form-data\">"; |
echo "$l_file (.sql) : <input type=\"file\" name=\"import-users\"><br>"; |
echo "<input type='hidden' name='choix' value='bdd'>"; |
if (($choix == "bdd") && isset($result)) echo $result."<BR>"; |
echo "<input type=\"submit\" value=\"$l_send\">"; |
echo "</FORM>"; |
echo "</td></tr>"; |
echo "<tr><td valign=\"middle\" align=\"left\">"; |
echo "<H3><CENTER>$l_db_reset</CENTER></H3>"; |
echo "$l_db_import_help<br><br>"; |
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>"; |
echo "<input type='hidden' name='choix' value='raz'>"; |
echo "<input type=\"submit\" value=\"$l_send\">"; |
echo "</FORM>"; |
echo "</TD></TR></TABLE>"; |
?> |
</BODY> |
</HTML> |
<?php |
/web/acc/manager/htdocs/user_finger.php |
---|
0,0 → 1,236 |
<?php |
require('/etc/freeradius-web/config.php'); |
require('../lib/attrshow.php'); |
require('../lib/sql/nas_list.php'); |
if (!isset($usage_summary)){ |
echo <<<EOM |
<html> |
<head> |
<META HTTP-EQUIV="Refresh" CONTENT="50"> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<title>Usagers connectées</title> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
EOM; |
} |
if ($config[general_decode_normal_attributes] == 'yes'){ |
if (is_file("../lib/lang/$config[general_prefered_lang]/utf8.php")) |
include_once("../lib/lang/$config[general_prefered_lang]/utf8.php"); |
else |
include_once('../lib/lang/default/utf8.php'); |
$k = init_decoder(); |
$decode_normal = 1; |
} |
require_once('../lib/functions.php'); |
require("../lib/$config[general_lib_type]/functions.php"); |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php")) |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php"); |
else{ |
echo <<<EOM |
<body> |
<center> |
<b>Could not include SQL library functions. Aborting</b> |
</body> |
</html> |
EOM; |
exit(); |
} |
setlocale (LC_ALL, 'fr_FR'); |
$date = strftime('%A, %e %B %Y, %T %Z'); |
$sql_extra_query = ''; |
if ($config[sql_accounting_extra_query] != ''){ |
$sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config); |
$sql_extra_query = da_sql_escape_string($sql_extra_query); |
} |
$link = @da_sql_pconnect($config); |
$link2 = connect2db($config); |
$tot_in = $tot_rem = 0; |
if ($link){ |
$h = 21; |
$servers_num = 0; |
if ($config[general_ld_library_path] != '') |
putenv("LD_LIBRARY_PATH=$config[general_ld_library_path]"); |
foreach($nas_list as $nas){ |
$j = 0; |
$num = 0; |
if ($server != ''){ |
if ($nas[name] == $server) |
$servers_num++; |
else |
continue; |
} |
else |
$servers_num++; |
if ($nas[ip] == '') |
continue; |
$name_data = $nas[ip]; |
$community_data = $nas[community]; |
$server_name[$servers_num] = $nas[name]; |
$server_model[$servers_num] = $nas[model]; |
$extra = ""; |
$finger_type = $config[general_finger_type]; |
if ($nas[finger_type] != '') |
$finger_type = $nas[finger_type]; |
if ($finger_type == 'snmp'){ |
$nas_type = ($nas[type] != '') ? $nas[type] : $config[general_nas_type]; |
if ($nas_type == '') |
$nas_type = 'cisco'; |
$users=exec("$config[general_snmpfinger_bin] $name_data $community_data $nas_type"); |
if (strlen($users)){ |
$extra = "AND username IN ($users)"; |
if ($config[general_strip_realms] == 'yes'){ |
if ($config[general_realm_format] == 'prefix') |
$match = "'[^']+" . $config[general_realm_delimiter]; |
else |
$match = $config[general_realm_delimiter] . "[^']+'"; |
$extra = preg_replace("/$match/","'",$extra); |
} |
} |
} |
$search = @da_sql_query($link,$config, |
"SELECT COUNT(*) AS onlineusers FROM $config[sql_accounting_table] WHERE |
acctstoptime IS NULL AND nasipaddress = '$name_data' $extra $sql_extra_query;"); |
if ($search){ |
if (($row = @da_sql_fetch_array($search,$config))) |
$num = $row[onlineusers]; |
} |
$search = @da_sql_query($link,$config, |
"SELECT DISTINCT username,acctstarttime,framedipaddress,callingstationid |
FROM $config[sql_accounting_table] WHERE |
acctstoptime IS NULL AND nasipaddress = '$name_data' $extra $sql_extra_query |
GROUP BY username,acctstarttime,framedipaddress,callingstationid |
ORDER BY acctstarttime;"); |
if ($search){ |
$now = time(); |
while($row = @da_sql_fetch_array($search,$config)){ |
$j++; |
$h += 21; |
$user = $row['username']; |
$finger_info[$servers_num][$j]['ip'] = $row['framedipaddress']; |
if ($finger_info[$servers_num][$j]['ip'] == '') |
$finger_info[$servers_num][$j]['ip'] = '-'; |
$session_time = $row['acctstarttime']; |
$session_time = date2timediv($session_time,$now); |
$finger_info[$servers_num][$j]['session_time'] = time2strclock($session_time); |
$finger_info[$servers_num][$j]['user'] = $user; |
$finger_info[$servers_num][$j]['callerid'] = $row['callingstationid']; |
if ($finger_info[$servers_num][$j]['callerid'] == '') |
$finger_info[$servers_num][$j]['callerid'] = '-'; |
if ($user_info["$user"] == ''){ |
$user_info["$user"] = get_user_info($link2,$user,$config,$decode_normal,$k); |
if ($user_info["$user"] == '' || $user_info["$user"] == ' ') |
$user_info["$user"] = 'Unknown User'; |
} |
} |
$height[$servers_num] = $h; |
} |
$server_counting[$servers_num] = $j; |
$server_loggedin[$servers_num] = $num; |
$server_rem[$servers_num] = ($config[$portnum]) ? ($config[$portnum] - $num) : 'unknown'; |
$tot_in += $num; |
if (is_numeric($server_rem[$servers_num])) |
$tot_rem += $server_rem[$servers_num]; |
} |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
if (isset($usage_summary)){ |
echo "Online: $tot_in Free: $tot_rem\n"; |
exit(); |
} |
?> |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>Gestion des usagers</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1> |
<tr bgcolor="#666666"><td> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=2> |
<tr><td valign="middle" align="left"> |
<center> |
<table border=0 width=550 cellpadding=0 cellspacing=0> |
<tr valign=top> |
<!--<td align=center><img src="images/title2.gif"></td>--> |
</tr> |
</table> |
<br> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor="black" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">Usagers en ligne</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<?php |
echo <<<EOM |
<center><b>$date</b></center> |
EOM; |
for($j = 1; $j <= $servers_num; $j++){ |
echo <<<EOM |
<p> |
<table width=100% cellpadding=0 height=30><tr> |
<th align=left>$server_name[$j]</th><th align=right><font color="red">$server_loggedin[$j] usager(s) connecté(s)</font></th><th>$server_model[$j]</th> |
</tr> |
</table> |
<div height="$height[$j]" style="height:$height[$j]"> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr bgcolor="#d0ddb0"> |
<th>#</th><th>usager</th> |
EOM; |
if ($acct_attrs['uf'][4] != '') echo "<th>" . $acct_attrs[uf][4] . "</th>\n"; |
if ($acct_attrs['uf'][9] != '') echo "<th>" . $acct_attrs[uf][9] . "</th>\n"; |
echo <<<EOM |
<th>nom</th><th>durée</th> |
</tr> |
EOM; |
for( $k = 1; $k <= $server_counting[$j]; $k++){ |
$user = $finger_info[$j][$k][user]; |
if ($user == '') |
$user = ' '; |
$User = urlencode($user); |
$time = $finger_info[$j][$k][session_time]; |
$ip = $finger_info[$j][$k][ip]; |
$cid = $finger_info[$j][$k][callerid]; |
$inf = $user_info[$user]; |
echo <<<EOM |
<tr align=center> |
<td>$k</td><td><a href="user_admin.php?login=$User" title="Editer l'utilisateur $user">$user</a></td> |
EOM; |
if ($acct_attrs['uf'][4] != '') echo "<td>$ip</td>\n"; |
if ($acct_attrs['uf'][9] != '') echo "<td>$cid</td>\n"; |
echo <<<EOM |
<td>$inf</td><td>$time</td> |
</tr> |
EOM; |
} |
echo <<<EOM |
</table> |
</div> |
EOM; |
} |
?> |
</td></tr> |
</table> |
</td></tr> |
</table> |
</TD></TR> |
</TABLE> |
</td></tr> |
</TABLE><p> |
</html> |
/web/acc/manager/htdocs/import_file.php |
---|
0,0 → 1,83 |
<?php |
require('../../lib/fpdf16/fpdf.php'); |
class fichePDF extends FPDF { |
function Header() |
{ |
} |
function Footer() |
{ |
//Positionnement à 1,5 cm du bas |
$this->SetY(-15); |
//Arial italique 8 |
$this->SetFont('Arial','I',8); |
//Couleur du texte en gris |
$this->SetTextColor(128); |
//Numéro de page |
$this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C'); |
} |
function lirefichier($fichier) |
{ |
$this->AddPage(); |
//Lecture des lignes du fichier |
$lines = file($fichier); |
$n = 1; |
foreach($lines as $line){ |
//Times 12 |
$this->SetFont('Times','',10); |
//Sortie du texte justifié |
$this->Cell(0,5,utf8_decode($line)); |
$this->Ln(); |
++$n; |
if ($n > (50)){ // on affiche 50 ligne par page soit 5 fiches usagers |
$this->AddPage(); |
$n = 1; |
} |
} |
} |
} |
function getImportFile($importFileName, $format = "txt"){ |
$importFile = "/tmp/$importFileName.pwd"; |
if(is_file($importFile)&&is_readable($importFile)){ |
if ($format=="txt"){ |
//telechargement |
$taille=filesize($importFile); |
header("Content-Type: application/x-download"); |
header("Content-Length: $taille"); |
header("Content-Disposition: attachment; filename=\"$importFileName.txt\""); |
header("Cache-Control: private, max-age=0, must-revalidate"); |
header("Pragma: public"); |
header("Content-Type: application/force-download; filename=\"$importFileName.txt\""); |
ini_set("zlib.output_compression","0"); |
readfile($importFile); |
exit(); |
}elseif ($format=="pdf"){ |
$pdf=new fichePDF(); |
$pdf->lirefichier($importFile); |
$pdf->Output($importFileName.".pdf","D"); |
}else{ |
getImportFile($importFileName,"txt"); |
} |
} else { |
return false; |
} |
} |
if (isset($_GET['file']) && $_GET['file']){ |
if (isset($_GET['format'])){ |
$format = $_GET['format']; |
} else { |
$format = "txt"; |
} |
if (getImportFile($_GET['file'], $format)){ |
//fichier en cour de téléchargement |
} else { |
echo "erreur 2 "; |
} |
} else { |
echo "erreur 1 "; |
} |
?> |
/web/acc/manager/htdocs/user_test.php |
---|
0,0 → 1,208 |
<?php |
require('/etc/freeradius-web/config.php'); |
if ($login == 'da_server_test'){ |
$login = $config[general_test_account_login]; |
$test_login=1; |
} |
echo <<<EOM |
<html> |
<head> |
<title>Test de l'utilisateur $login</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
<center> |
<table border=0 width=550 cellpadding=0 cellspacing=0> |
<tr valign=top> |
<!--<td align=center><img src="images/title2.gif"></td>--> |
</tr> |
</table> |
<table border=0 width=400 cellpadding=0 cellspacing=2> |
EOM; |
if (!$test_login) |
include("../html/user_toolbar.html.php"); |
print <<<EOM |
</table> |
<br> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor="black" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
EOM; |
if ($test_login){ |
print <<<EOM |
<font color="white">Page de Test du serveur Radius</font> |
EOM; |
}else{ |
print <<<EOM |
<font color="white">Page de Test de l'utilisateur $login</font> |
EOM; |
} |
?> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<?php |
if ($server == '' || !preg_match('/^[\w\.]+$/',$server)) |
$server = $config[general_radius_server]; |
if ($port == 0 || !is_numeric($port)) |
$port = $config[general_radius_server_port]; |
if ($auth_proto == '') |
$auth_proto = $config[general_radius_server_auth_proto]; |
$selected[$auth_proto] = 'selected'; |
if ($test_user == 1){ |
$tmp_file = tempnam("$config[general_tmp_dir]",'DA'); |
$req=file($config[general_auth_request_file]); |
if ($config[general_ld_library_path] != '') |
putenv("LD_LIBRARY_PATH=$config[general_ld_library_path]"); |
$comm = $config[general_radclient_bin] . " $server:$port" . ' auth ' . $config[general_radius_server_secret] |
. ' >' . $tmp_file; |
$fp = popen("$comm","w"); |
if ($fp){ |
foreach ($req as $val){ |
// Ignore comments |
if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val)) |
continue; |
fwrite($fp,$val); |
} |
if ($test_login){ |
$test=1; |
fwrite($fp, "User-Name = \"$config[general_test_account_login]\"\n"); |
fwrite($fp, "User-Password = \"$config[general_test_account_password]\"\n"); |
pclose($fp); |
} |
else{ |
fwrite($fp, "User-Name = \"$login\"\n"); |
if ($auth_proto == 'chap') |
fwrite($fp, "CHAP-Password = \"$passwd\"\n"); |
else |
fwrite($fp, "User-Password = \"$passwd\"\n"); |
if (strlen($extra)) |
fwrite($fp,$extra); |
pclose($fp); |
} |
$reply = file($tmp_file); |
unlink($tmp_file); |
$msg = "<b>" . strftime('%A, %e %B %Y, %T %Z') . "</b><br>\n"; |
$msg .= "<b>Server: </b><i>$server:$port</i><br><br>\n"; |
if (ereg('code 2', $reply[0])) |
$msg .= "<b>L'authentification a <font color=green>réussie</font>"; |
else if (ereg('code 3',$reply[0])) |
$msg .= "<b>L'authentification a <font color=red>échouée</font>"; |
else if (ereg('no response from server', $reply[0])) |
$msg .= "<b><font color=red>Pas de réponse du serveur</font>"; |
else if (ereg('Connection refused',$reply[0])) |
$msg .= "<b><font color=red>La connection a été refusée</font>"; |
if ($test_login) |
$msg .= "</b><i> (test de l'utilisateur $login)</i><br>\n"; |
else |
$msg .= "</b><br>\n"; |
array_shift($reply); |
if (count($reply)){ |
$msg .= "<br><b>Réponse du serveur :</b><br>\n"; |
foreach ($reply as $val){ |
$msg .= "<i>$val</i><br>\n"; |
} |
} |
if ($test_login){ |
print <<<EOM |
$msg |
<br> |
</td></tr> |
</table> |
</tr> |
</table> |
</body> |
</html> |
EOM; |
exit(); |
} |
} |
} |
?> |
<form method=post> |
<input type=hidden name=login value=<?php print $login ?>> |
<input type=hidden name=test_user value="0"> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
Mot de passe utilisateur |
</td> |
<td> |
<input type=password name=passwd value="<?php print $passwd ?>" size=25> |
</td> |
</tr> |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
Serveur Radius |
</td> |
<td> |
<input type=text name=server value="<?php print $server ?>" size=25> |
</td> |
</tr> |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
Port du serveur Radius |
</td> |
<td> |
<input type=text name=port value="<?php print $port ?>" size=25> |
</td> |
</tr> |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
Attributs supplémentaires |
</td> |
<td> |
<textarea name="extra" cols="35" wrap="PHYSICAL" rows="4"><?php print $extra ?></textarea> |
</td> |
</tr> |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
Protocole d'authentification |
</td> |
<td> |
<?php |
echo <<<EOM |
<select name="auth_proto" editable> |
<option $selected[pap] value="pap">PAP |
<option $selected[chap] value="chap">CHAP |
EOM |
?> |
</select> |
</td> |
</tr> |
</table> |
<br> |
<input type=submit class=button value="Lancement du Test" OnClick="this.form.test_user.value=1"> |
</form> |
<?php |
if ($test_user == 1){ |
echo <<<EOM |
<br> |
$msg |
EOM; |
} |
?> |
</td></tr> |
</table> |
</tr> |
</table> |
</body> |
</html> |
/web/acc/manager/htdocs/show_groups.php |
---|
0,0 → 1,124 |
<?php |
# Choice of language |
$Language = 'en'; |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){ |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); |
$Language = strtolower(substr(chop($Langue[0]),0,2)); } |
if($Language == 'fr'){ |
$l_title = "Liste des groupes d'usagers"; |
$l_frame_top = "Gestion des groupes"; |
$l_frame = "Liste des groupes"; |
$l_group = "groupe"; |
$l_nb_users = "Nombre d'usagers"; |
$l_empty_list = "La liste des groupes est vide"; |
} |
else { |
$l_title = "Create a group"; |
$l_frame_top = "Groups admin"; |
$l_frame = "Groups list"; |
$l_group = "group"; |
$l_nb_users = "Number of users"; |
$l_empty_list = "The groups list is empty"; |
} |
require('/etc/freeradius-web/config.php'); |
?> |
<html> |
<?php |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php")) |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php"); |
else{ |
echo <<<EOM |
<title>$l_title</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
<body> |
<center> |
<b>Could not include SQL library functions. Aborting</b> |
</body> |
</html> |
EOM; |
exit(); |
} |
if ($config[general_lib_type] != 'sql'){ |
echo <<<EOM |
<title>$l_title</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
<center> |
<b>This page is only available if you are using sql as general library type</b> |
</body> |
</html> |
EOM; |
exit(); |
} |
?> |
<head> |
<title><?php echo "$l_title"; ?></title> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th><?php echo "$l_frame_top"; ?></th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1> |
<tr bgcolor="#666666"><td> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=2> |
<tr><td valign="middle" align="left"> |
<center> |
<table border=0 width=550 cellpadding=0 cellspacing=0> |
<tr valign=top> |
</tr> |
</table> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=55%></td> |
<td bgcolor="black" width=45%> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white"><?php echo "$l_frame"; ?></font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<?php |
unset($login); |
$num = 0; |
include_once("../lib/$config[general_lib_type]/group_info.php"); |
if (isset($existing_groups)){ |
echo "<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor=\"#ffffe0\" valign=top>"; |
echo "<tr bgcolor=\"#d0ddb0\">"; |
echo "<th>#</th><th>$l_group </th><th>$l_nb_users</th></tr>"; |
foreach ($existing_groups as $group => $num_members){ |
$num++; |
$Group = urlencode($group); |
echo <<<EOM |
<tr align=center> |
<td>$num</td> |
<td><a href="group_admin.php?login=$Group" title="Editer le groupe $group">$group</a></td> |
<td>$num_members</td> |
</tr> |
EOM; |
} |
} |
else |
echo "<b>$l_empty_list</b>\n"; |
?> |
</table> |
</table> |
</tr> |
</table> |
</TD></TR> |
</TABLE> |
</td></tr> |
</TABLE> |
</body> |
</html> |
/web/acc/manager/htdocs/find.php |
---|
0,0 → 1,155 |
<?php |
require('/etc/freeradius-web/config.php'); |
if (isset($search_IN)) $selected[$search_IN] = 'selected'; |
if (isset ($radius_attr)) $selected[$radius_attr] = 'selected'; |
if (isset ($max_results)){ $max = ($max_results) ? $max_results : 40;} |
?> |
<html> |
<head> |
<title>Gestion des usager</title> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>"> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>Gestion des usagers</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1> |
<tr bgcolor="#666666"><td> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=2> |
<tr><td valign="middle" align="left"> |
<center> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor="black" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">Filtre de recherche</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<?php |
if (isset($find_user)){ |
if ($find_user == 1){ |
unset($found_users); |
if (is_file("../lib/$config[general_lib_type]/find.php")) |
include("../lib/$config[general_lib_type]/find.php"); |
if (isset($found_users)){ |
$num = 0; |
$msg .= <<<EOM |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr bgcolor="#d0ddb0"> |
<th>#</th><th>Usager</th><th>Actions</th> |
</tr> |
EOM; |
foreach ($found_users as $user){ |
if ($user == '') |
$user = '-'; |
$User = urlencode($user); |
$num++; |
$msg .= <<<EOM |
<tr align=center> |
<td>$num</td> |
<td>$user</td> |
<td><a href="user_admin.php?login=$User" title="État"><img src=/images/info.gif></a> |
<a href="user_edit.php?login=$User" title="Attributs"><img src=/images/create.gif></a> |
<a href="user_info.php?login=$User" title="Informations personnelles"><img src=/images/tpf.gif></a> |
<a href="user_accounting.php?login=$User" title="Connexions effectuées"><img src=/images/graph.gif></a> |
<a href="clear_opensessions.php?login=$User" title="Sessions ouvertes"><img src=/images/state_ok.gif></a> |
<a href="user_delete.php?login=$User" title="Supprimer"><img src=/images/state_error.gif></a></td> |
</tr> |
EOM; |
} |
$msg .= "</table>\n"; |
} |
else |
$msg = "<b>Pas d'usagers trouvés</b><br>\n"; |
} |
} |
?> |
<form method=post> |
<input type=hidden name=find_user value="0"> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
Critère de recherche |
</td> |
<td> |
<?php |
echo <<<EOM |
<select name="search_IN" editable onChange="this.form.submit();"> |
<option $selected[username] value="username">Identifiant (login) |
<option $selected[name] value="name">Nom complet (NOM Prenom) |
<option $selected[department] value="department">Service |
<option $selected[radius] value="radius">Attribut particulier |
EOM; |
?> |
</select> |
</td> |
</tr> |
<?php |
if (isset($search_IN)){ |
if ($search_IN == 'radius'){ |
require('../lib/attrshow.php'); |
echo <<<EOM |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
Attributs RADIUS |
</td> |
<td> |
<select name="radius_attr" editable> |
EOM; |
foreach($show_attrs as $key => $desc) |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
echo <<<EOM |
</select> |
</td> |
</tr> |
EOM; |
} |
} |
?> |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
qui contient<BR> |
(champ vide = tous) |
</td> |
<td> |
<input type=text name="search" value="<?php if (isset($search)) echo $search ;?>" size=25> |
</td> |
</tr> |
<!--<tr> |
<td align=right bgcolor="#d0ddb0"> |
Nombre de résultats Max. |
</td> |
<td> |
<input type=text name="max_results" value="<?php echo $max ?>" size=25> |
</td> |
</tr> --> |
</table> |
<br> |
<input type=submit class=button value="Lancer la recherche" OnClick="this.form.find_user.value=1"> |
</form> |
<?php |
if (isset($find_user)){ |
if ($find_user == 1){ echo $msg ;}} |
?> |
</td></tr> |
</table> |
</td></tr> |
</table> |
</td></tr> |
</TABLE> |
</td></tr> |
</TABLE> |
</body> |
</html> |
/web/acc/manager/htdocs/user_edit.php |
---|
0,0 → 1,335 |
<?php |
require('/etc/freeradius-web/config.php'); |
require('../lib/attrshow.php'); |
require('../lib/defaults.php'); |
$extra_text = ''; |
if ($user_type != 'group'){ |
if (is_file("../lib/$config[general_lib_type]/user_info.php")) |
include("../lib/$config[general_lib_type]/user_info.php"); |
if ($config[general_lib_type] == 'sql' && $config[sql_show_all_groups] == 'true'){ |
$extra_text = "<br><font size=-2><i>(le groupe auquel apartient l'usager est surligné)</i></font>"; |
$saved_login = $login; |
$login = ''; |
if (is_file("../lib/sql/group_info.php")) |
include("../lib/sql/group_info.php"); |
$login = $saved_login; |
} |
} |
else{ |
if (is_file("../lib/$config[general_lib_type]/group_info.php")) |
include("../lib/$config[general_lib_type]/group_info.php"); |
} |
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){ |
$colspan=2; |
$show_ops = 1; |
include("../lib/operators.php"); |
} |
else{ |
$show_ops = 0; |
$colspan=1; |
} |
echo <<<EOM |
<html> |
<head> |
EOM; |
if ($user_type != 'group'){ |
echo " <title>subscription configuration for $login ($cn)</title>\n"; |
$util = "usagers";} |
else{ |
echo " <title>subscription configuration for $login</title>\n"; |
$util = "groupes";} |
?> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<link rel="stylesheet" href="/css/style.css"> |
<script language="javascript" type="text/javascript"> |
var chars='0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ' |
function password(size) |
{ |
var pass='' |
while(pass.length < size) |
{ |
pass+=chars.charAt(Math.round(Math.random() * (chars.length))) |
} |
document.edituser.passwd.value=pass |
document.edituser.pwdgene.value=pass |
} |
</script> |
</head> |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>Gestion des <?php echo $util?></th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1> |
<tr><td valign="middle" align="left"> |
<center> |
<table border=0 width=550 cellpadding=0 cellspacing=0> |
<tr valign=top> |
<!--<td align=center><img src="images/title2.gif"></td>--> |
</tr> |
</table> |
<table border=0 width=400 cellpadding=0 cellspacing=2> |
<?php |
if ($user_type != 'group') |
{ |
include("../html/user_toolbar.html.php"); |
$titre="de l'usager"; |
} |
else |
{ |
include("../html/group_toolbar.html.php"); |
$titre="du groupe"; |
} |
print <<<EOM |
</table> |
<br> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=75%> </td> |
<td bgcolor="black" width=25% align=right> |
<table border=0 width="200" cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=center valign=top><th> |
<font color="white">Attributs $titre : $login</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
EOM; |
if ($change == 1){ |
if (is_file("../lib/$config[general_lib_type]/change_attrs.php")) |
include("../lib/$config[general_lib_type]/change_attrs.php"); |
if ($user_type != 'group'){ |
if ($config[general_show_user_password] != 'no' && $passwd != '' |
&& is_file("../lib/$config[general_lib_type]/change_passwd.php")) |
include("../lib/$config[general_lib_type]/change_passwd.php"); |
if (is_file("../lib/$config[general_lib_type]/user_info.php")) |
include("../lib/$config[general_lib_type]/user_info.php"); |
if ($group_change && $config[general_lib_type] == 'sql' && $config[sql_show_all_groups] == 'true'){ |
include("../lib/sql/group_change.php"); |
include("../lib/defaults.php"); |
} |
} |
else{ |
if (is_file("../lib/$config[general_lib_type]/group_info.php")) |
include("../lib/$config[general_lib_type]/group_info.php"); |
} |
} |
else if ($badusers == 1){ |
if (is_file("../lib/add_badusers.php")) |
include("../lib/add_badusers.php"); |
} |
?> |
<form name="edituser" method=post> |
<input type=hidden name=login value=<?php print $login ?>> |
<input type=hidden name=user_type value=<?php print $user_type ?>> |
<input type=hidden name=change value="0"> |
<input type=hidden name=add value="0"> |
<input type=hidden name=badusers value="0"> |
<input type=hidden name=group_change value="0"> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<?php |
if ($user_type != 'group' && $config[general_show_user_password] != 'no'){ |
echo <<<EOM |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
Nouveau mot de passe<br> |
EOM; |
if ($user_password_exists == 'yes') |
echo "<font size=-2>Le mot de passe <font color=\"green\"><b>existe</b></font></font>\n"; |
else |
echo "<font size=-2>Le mot de passe <font color=\"red\"><b> n'existe pas</b></font></font>\n"; |
echo <<<EOM |
</td> |
<td> |
<input type=password name=passwd value="" size=40> |
<br /><input type="button" value="générer" onclick="password(8)"> |
<input type="text" value="" name="pwdgene" size=20 readonly> |
</td> |
</tr> |
EOM; |
} |
foreach($show_attrs as $key => $desc){ |
$name = $attrmap["$key"]; |
$generic = $attrmap[generic]["$key"]; |
if ($name == 'none') |
continue; |
unset($vals); |
unset($selected); |
unset($ops); |
$def_added = 0; |
if ($item_vals["$key"][count]){ |
for($i=0;$i<$item_vals["$key"][count];$i++){ |
$vals[] = $item_vals["$key"][$i]; |
$ops[] = $item_vals["$key"][operator][$i]; |
} |
} |
else{ |
if ($default_vals["$key"][count]){ |
for($i=0;$i<$default_vals["$key"][count];$i++){ |
$vals[] = $default_vals["$key"][$i]; |
$ops[] = $default_vals["$key"][operator][$i]; |
} |
} |
else{ |
$vals[] = ''; |
$ops[] = '='; |
} |
$def_added = 1; |
} |
if ($generic == 'generic' && $def_added == 0){ |
for($i=0;$i<$default_vals["$key"][count];$i++){ |
$vals[] = $default_vals["$key"][$i]; |
$ops[] = $default_vals["$key"][operator][$i]; |
} |
} |
if ($add && $name == $add_attr){ |
$vals[] = $default_vals["$key"][0]; |
$ops[] = ($default_vals["$key"][operator][0] != '') ? $default_vals["$key"][operator][0] : '='; |
} |
$i = 0; |
foreach($vals as $val){ |
$name1 = $name . $i; |
$val = ereg_replace('"','"',$val); |
$oper_name = $name1 . '_op'; |
$oper = $ops[$i]; |
$selected[$oper] = 'selected'; |
$i++; |
print <<<EOM |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
EOM; |
$desc = addslashes($desc); |
eval("\$desc = \"$desc\";"); |
$desc = stripslashes($desc); |
if ($i == 1) |
echo "$desc\n"; |
else |
echo "$desc ($i)\n"; |
echo "</td>"; |
if ($show_ops){ |
switch ($key) |
{ |
case 'Simultaneous-Use' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>"; |
break; |
case 'Login-Time' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>"; |
break; |
case 'Expiration' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>"; |
break; |
case 'Session-Timeout' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>"; |
break; |
case 'Max-Daily-Session' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>"; |
break; |
case 'Max-Weekly-Session' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>"; |
break; |
case 'Max-Monthly-Session' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>"; |
break; |
case 'ChilliSpot-Max-Input-Octets' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>"; |
break; |
case 'ChilliSpot-Max-Output-Octets' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>"; |
break; |
case 'ChilliSpot-Max-Total-Octets' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>"; |
break; |
case 'ChilliSpot-Bandwidth-Max-Up' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>"; |
break; |
case 'ChilliSpot-Bandwidth-Max-Down' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>"; |
break; |
case 'WISPr-Redirection-URL' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>"; |
break; |
default : |
print <<<EOM |
<td> |
<select name=$oper_name> |
<option $selected[$op_eq] value="=">= |
<option $selected[$op_set] value=":=">:= |
<option $selected[$op_add] value="+=">+= |
<option $selected[$op_eq2] value="==">== |
<option $selected[$op_ne] value="!=">!= |
<option $selected[$op_gt] value=">">> |
<option $selected[$op_ge] value=">=">>= |
<option $selected[$op_lt] value="<">< |
<option $selected[$op_le] value="<="><= |
<option $selected[$op_regeq] value="=~">=~ |
<option $selected[$op_regne] value="!~">!~ |
<option $selected[$op_exst] value="=*">=* |
<option $selected[$op_nexst] value="!*">!* |
</select> |
</td> |
<td><input type=text name="$name1" value="$val" size=40></td> |
EOM; |
break; |
} |
} |
print <<<EOM |
</tr> |
EOM; |
} |
} |
if ($user_type != 'group'){ |
echo <<<EOM |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
Membre de $extra_text |
</td> |
<td> |
EOM; |
if (isset($member_groups)){ |
echo "<select size=5 name=\"edited_groups[]\" multiple OnChange=\"this.form.group_change.value=1\">"; |
if ($config[sql_show_all_groups] == 'true'){ |
foreach ($existing_groups as $group => $count){ |
if ($member_groups[$group] == $group) |
echo "<option selected value=\"$group\">$group\n"; |
else |
echo "<option value=\"$group\">$group\n"; |
} |
}else{ |
foreach ($member_groups as $group) |
echo "<option value=\"$group\">$group\n"; |
} |
echo "</select></td></tr>"; |
} |
else{ |
echo "aucun group</td></tr>"; |
} |
} |
echo "</table><br>"; |
echo "<input type=submit class=button value=Change OnClick=\"this.form.change.value=1\">"; |
//if ($user_type != 'group'){ |
// echo <<<EOM |
//<br><br> |
//<input type=submit class=button value="Add to Badusers" OnClick="this.form.badusers.value=1"> |
//<a href="help/badusers_help.html" target=bu_help onclick=window.open("help/badusers_help.html","bu_help","width=600,height=210,toolbar=no,scrollbars=no,resizable=yes") title="BADUSERS Help Page"><font color="blue"><--Help</font></a> |
//EOM; |
//} |
?> |
</form> |
</td></tr> |
</table> |
</tr> |
</table> |
</td></tr> |
</TABLE> |
</body> |
</html> |
/web/acc/manager/htdocs/user_admin.php |
---|
0,0 → 1,323 |
<?php |
require('/etc/freeradius-web/config.php'); |
?> |
<html> |
<head> |
<?php |
require('../lib/functions.php'); |
require('../lib/defaults.php'); |
$date = strftime('%A, %e %B %Y, %T %Z'); |
if (is_file("../lib/$config[general_lib_type]/user_info.php")){ |
include("../lib/$config[general_lib_type]/user_info.php"); |
if ($user_exists == 'no'){ |
echo <<<EOM |
<title>Page d'information d'utilisateur</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
<body> |
<center> |
<form action="user_admin.php" method=get> |
<b>User Name </b> |
<input type="text" size=10 name="login" value="$login"> |
<b> does not exist</b><br> |
<input type=submit class=button value="Show User"> |
</body> |
</html> |
EOM; |
exit(); |
} |
} |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php")) |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php"); |
else{ |
echo <<<EOM |
<title>Page d'information d'utilisateur</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
<center> |
<b>Could not include SQL library functions. Aborting</b> |
</body> |
</html> |
EOM; |
exit(); |
} |
$monthly_limit = ($item_vals['Max-Monthly-Session'][0] != '') ? $item_vals['Max-Monthly-Session'][0] : $default_vals['Max-Monthly-Session'][0]; |
$monthly_limit = ($monthly_limit) ? $monthly_limit : $config[counter_default_monthly]; |
$weekly_limit = ($item_vals['Max-Weekly-Session'][0] != '') ? $item_vals['Max-Weekly-Session'][0] : $default_vals['Max-Weekly-Session'][0]; |
$weekly_limit = ($weekly_limit) ? $weekly_limit : $config[counter_default_weekly]; |
$daily_limit = ($item_vals['Max-Daily-Session'][0] != '') ? $item_vals['Max-Daily-Session'][0] : $default_vals['Max-Daily-Session'][0]; |
$daily_limit = ($daily_limit) ? $daily_limit : $config[counter_default_daily]; |
$session_limit = ($item_vals['Session-Timeout'][0] != '') ? $item_vals['Session-Timeout'][0] : $default_vals['Session-Timeout'][0]; |
$session_limit = ($session_limit) ? $session_limit : 'none'; |
$remaining = 'unlimited time'; |
$log_color = 'green'; |
$now = time(); |
$week = $now - 604800; |
$now_str = date("$config[sql_date_format]",$now + 86400); |
$week_str = date("$config[sql_date_format]",$week); |
$day = date('w'); |
$week_start = date($config[sql_date_format],$now - ($day)*86400); |
$month_start = date($config[sql_date_format],$now - date('j')*86400); |
$today = $day; |
$now_tmp = $now; |
for ($i = $day; $i >-1; $i--){ |
$days[$i] = date($config[sql_date_format],$now_tmp); |
$now_tmp -= 86400; |
} |
$day++; |
//$now -= ($day * 86400); |
$now -= 604800; |
$now += 86400; |
for ($i = $day; $i <= 6; $i++){ |
$days[$i] = date($config[sql_date_format],$now); |
// $now -= 86400; |
$now += 86400; |
} |
$daily_used = $weekly_used = $monthly_used = $lastlog_session_time = '-'; |
$extra_msg = ''; |
$used = array('-','-','-','-','-','-','-'); |
$link = @da_sql_pconnect($config); |
if ($link){ |
$search = @da_sql_query($link,$config, |
"SELECT sum(acctsessiontime) AS sum_sess_time, |
sum(acctinputoctets) AS sum_in_octets, |
sum(acctoutputoctets) AS sum_out_octets, |
avg(acctsessiontime) AS avg_sess_time, |
avg(acctinputoctets) AS avg_in_octets, |
avg(acctoutputoctets) AS avg_out_octets, |
COUNT(*) as counter FROM |
$config[sql_accounting_table] WHERE username = '$login' |
AND acctstarttime >= '$week_str' AND acctstarttime <= '$now_str';"); |
if ($search){ |
$row = @da_sql_fetch_array($search,$config); |
$tot_time = time2str($row[sum_sess_time]); |
$tot_input = bytes2str($row[sum_in_octets]); |
$tot_output = bytes2str($row[sum_out_octets]); |
$avg_time = time2str($row[avg_sess_time]); |
$avg_input = bytes2str($row[avg_in_octets]); |
$avg_output = bytes2str($row[avg_out_octets]); |
$tot_conns = $row[counter]; |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
$search = @da_sql_query($link,$config, |
"SELECT sum(acctsessiontime) AS sum_sess_time FROM $config[sql_accounting_table] WHERE username = '$login' |
AND acctstarttime >= '$week_start' AND acctstarttime <= '$now_str';"); |
if ($search){ |
$row = @da_sql_fetch_array($search,$config); |
$weekly_used = $row[sum_sess_time]; |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
if ($monthly_limit != 'none' || $config[counter_monthly_calculate_usage] == 'true'){ |
$search = @da_sql_query($link,$config, |
"SELECT sum(acctsessiontime) AS sum_sess_time FROM $config[sql_accounting_table] WHERE username = '$login' |
AND acctstarttime >= '$month_start' AND acctstarttime <= '$now_str';"); |
if ($search){ |
$row = @da_sql_fetch_array($search,$config); |
$monthly_used = $row[sum_sess_time]; |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
$search = @da_sql_query($link,$config, |
"SELECT COUNT(*) AS counter FROM $config[sql_accounting_table] WHERE username = '$login' |
AND acctstoptime >= '$week_str' AND acctstoptime <= '$now_str' |
AND (acctterminatecause LIKE 'Login-Incorrect%' OR |
acctterminatecause LIKE 'Invalid-User%' OR |
acctterminatecause LIKE 'Multiple-Logins%');"); |
if ($search){ |
$row = @da_sql_fetch_array($search,$config); |
$tot_badlogins = $row[counter]; |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
for($i = 0; $i <=6; $i++){ |
if ($days[$i] == '') |
continue; |
$search = @da_sql_query($link,$config, |
"SELECT sum(acctsessiontime) AS sum_sess_time FROM $config[sql_accounting_table] WHERE |
username = '$login' AND acctstoptime >= '$days[$i] 00:00:00' |
AND acctstoptime <= '$days[$i] 23:59:59';"); |
if ($search){ |
$row = @da_sql_fetch_array($search,$config); |
$used[$i] = $row[sum_sess_time]; |
if ($daily_limit != 'none' && $used[$i] > $daily_limit) |
$used[$i] = "<font color=red>" . time2str($used[$i]) . "</font>"; |
else |
$used[$i] = time2str($used[$i]); |
if ($today == $i){ |
$daily_used = $row[sum_sess_time]; |
if ($daily_limit != 'none'){ |
$remaining = $daily_limit - $daily_used; |
if ($remaining <=0) |
$remaining = 0; |
$log_color = ($remaining) ? 'green' : 'red'; |
if (!$remaining) |
$extra_msg = '(Out of daily quota)'; |
} |
$daily_used = time2str($daily_used); |
if ($daily_limit != 'none' && !$remaining) |
$daily_used = "<font color=red>$daily_used</font>"; |
} |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
if ($weekly_limit != 'none'){ |
$tmp = $weekly_limit - $weekly_used; |
if ($tmp <=0){ |
$tmp = 0; |
$extra_msg .= '(Out of weekly quota)'; |
} |
if (!is_numeric($remaining)) |
$remaining = $tmp; |
if ($remaining > $tmp) |
$remaining = $tmp; |
$log_color = ($remaining) ? 'green' : 'red'; |
} |
$weekly_used = time2str($weekly_used); |
if ($weekly_limit != 'none' && !$tmp) |
$weekly_used = "<font color=red>$weekly_used</font>"; |
if ($monthly_limit != 'none'){ |
$tmp = $monthly_limit - $monthly_used; |
if ($tmp <=0){ |
$tmp = 0; |
$extra_msg .= '(Out of monthly quota)'; |
} |
if (!is_numeric($remaining)) |
$remaining = $tmp; |
if ($remaining > $tmp) |
$remaining = $tmp; |
$log_color = ($remaining) ? 'green' : 'red'; |
} |
if ($monthly_limit != 'none' || $config[counter_monthly_calculate_usage] == 'true'){ |
$monthly_used = time2str($monthly_used); |
if ($monthly_limit != 'none' && !$tmp) |
$monthly_used = "<font color=red>$monthly_used</font>"; |
} |
if ($session_limit != 'none'){ |
if (!is_numeric($remaining)) |
$remaining = $session_limit; |
if ($remaining > $session_limit) |
$remaining = $session_limit; |
} |
$search = @da_sql_query($link,$config, |
"SELECT " . da_sql_limit(1,0,$config) . " * FROM $config[sql_accounting_table] |
WHERE username = '$login' AND acctstoptime IS NULL " . da_sql_limit(1,1,$config) . " |
ORDER BY acctstarttime DESC " . da_sql_limit(1,2,$config). " ;"); |
if ($search){ |
if (@da_sql_num_rows($search,$config)){ |
$logged_now = 1; |
$row = @da_sql_fetch_array($search,$config); |
$lastlog_time = $row['acctstarttime']; |
$lastlog_server_ip = $row['nasipaddress']; |
$lastlog_server_port = $row['nasportid']; |
$lastlog_session_time = date2timediv($lastlog_time,0); |
if ($daily_limit != 'none'){ |
$remaining = $remaining - $lastlog_session_time; |
if ($remaining < 0) |
$remaining = 0; |
$log_color = ($remaining) ? 'green' : 'red'; |
} |
$lastlog_session_time_jvs = 1000 * $lastlog_session_time; |
$lastlog_session_time = time2strclock($lastlog_session_time); |
$lastlog_client_ip = $row['framedipaddress']; |
$lastlog_server_name = @gethostbyaddr($lastlog_server_ip); |
$lastlog_client_name = @gethostbyaddr($lastlog_client_ip); |
$lastlog_callerid = $row['callingstationid']; |
if ($lastlog_callerid == '') |
$lastlog_callerid = 'not available'; |
$lastlog_input = $row['acctinputoctets']; |
if ($lastlog_input) |
$lastlog_input = bytes2str($lastlog_input); |
else |
$lastlog_input = 'not available'; |
$lastlog_output = $row['acctoutputoctets']; |
if ($lastlog_output) |
$lastlog_output = bytes2str($lastlog_output); |
else |
$lastlog_output = 'not available'; |
} |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
if (! $logged_now){ |
$search = @da_sql_query($link,$config, |
"SELECT " . da_sql_limit(1,0,$config) . " * FROM $config[sql_accounting_table] |
WHERE username = '$login' AND acctsessiontime != '0' " . da_sql_limit(1,1,$config) . " |
ORDER BY acctstoptime DESC " . da_sql_limit(1,2,$config). " ;"); |
if ($search){ |
if (@da_sql_num_rows($search,$config)){ |
$row = @da_sql_fetch_array($search,$config); |
$lastlog_time = $row['acctstarttime']; |
$lastlog_server_ip = $row['nasipaddress']; |
$lastlog_server_port = $row['nasportid']; |
$lastlog_session_time = time2str($row['acctsessiontime']); |
$lastlog_client_ip = $row['framedipaddress']; |
$lastlog_server_name = ($lastlog_server_ip != '') ? @gethostbyaddr($lastlog_server_ip) : '-'; |
$lastlog_client_name = ($lastlog_client_ip != '') ? @gethostbyaddr($lastlog_client_ip) : '-'; |
$lastlog_callerid = $row['callingstationid']; |
if ($lastlog_callerid == '') |
$lastlog_callerid = 'not available'; |
$lastlog_input = $row['acctinputoctets']; |
$lastlog_input = bytes2str($lastlog_input); |
$lastlog_output = $row['acctoutputoctets']; |
$lastlog_output = bytes2str($lastlog_output); |
} |
else |
$not_known = 1; |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
$monthly_limit = (is_numeric($monthly_limit)) ? time2str($monthly_limit) : $monthly_limit; |
$weekly_limit = (is_numeric($weekly_limit)) ? time2str($weekly_limit) : $weekly_limit; |
$daily_limit = (is_numeric($daily_limit)) ? time2str($daily_limit) : $daily_limit; |
$session_limit = (is_numeric($session_limit)) ? time2str($session_limit) : $session_limit; |
$remaining = (is_numeric($remaining)) ? time2str($remaining) : $remaining; |
if ($item_vals['Dialup-Access'][0] == 'FALSE' || (!isset($item_vals['Dialup-Access'][0]) && $attrmap['Dialup-Access'] != '' && $attrmap['Dialup-Access'] != 'none')) |
$msg =<<<EON |
<font color=red><b> Le compte de l'utilisateur est verrouillé </b></font> |
EON; |
else |
$msg =<<<EON |
L'utilisateur peut s'identifier pendant <font color="$log_color"> <b>$remaining $extra_msg</font> |
EON; |
$lock_msg = $item_vals['Dialup-Lock-Msg'][0]; |
if ($lock_msg != '') |
$descr =<<<EON |
<font color=red><b>$lock_msg </b</font> |
EON; |
else |
$descr = '-'; |
$expiration = $default_vals['Expiration'][0]; |
if ($item_vals['Expiration'][0] != '') |
$expiration = $item_vals['Expiration'][0]; |
if ($expiration != ''){ |
$expiration = strtotime($expiration); |
if ($expiration != -1 && $expiration < time()) |
$descr = <<<EOM |
<font color=red><b>Le compte de l'utilisateur a expiré</b></font> |
EOM; |
} |
require('../html/user_admin.html.php'); |
?> |
/web/acc/manager/htdocs/user_new.php |
---|
0,0 → 1,318 |
<?php |
# Choice of language |
$Language = 'en'; |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){ |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); |
$Language = strtolower(substr(chop($Langue[0]),0,2)); } |
if($Language == 'fr'){ |
$l_title = "Création d'un usager"; |
$l_frame_top = "Gestion des usagers"; |
$l_frame = "Création d'un usager"; |
$l_user_exist = "existe déjà"; |
$l_login = "Identifiant"; |
$l_password = "Mot de passe"; |
$l_passwd_gen = "générer"; |
$l_group = "Groupe"; |
$l_group_empty = "La liste des groupes est vide"; |
$l_name = "Nom et prénom"; |
$l_email = "Adresse de couriel"; |
} |
else { |
$l_title = "Create a user"; |
$l_frame_top = "Users admin"; |
$l_frame = "Create a user"; |
$l_user_exist = "already exist"; |
$l_login = "Login"; |
$l_password = "Password"; |
$l_passwd_gen = "generate"; |
$l_group = "Group"; |
$l_group_empty = "The group list is empty"; |
$l_name = "Surname and name"; |
$l_email = "Email Address"; |
} |
require('/etc/freeradius-web/config.php'); |
if ($show == 1){ |
header("Location: user_admin.php?login=$login"); |
exit; |
} |
require('../lib/attrshow.php'); |
require('../lib/defaults.php'); |
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){ |
$colspan=2; |
$show_ops=1; |
}else{ |
$show_ops = 0; |
$colspan=1; |
} |
echo "<html><head><title>$l_title</title>"; |
?> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<link rel="stylesheet" href="/css/style.css"> |
<script language="javascript" type="text/javascript"> |
var chars='0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ' |
function password(size) |
{ |
var pass='' |
while(pass.length < size) |
{ |
pass+=chars.charAt(Math.round(Math.random() * (chars.length))) |
} |
document.newuser.passwd.value=pass |
document.newuser.pwdgene.value=pass |
} |
function formControl(){ |
var myregex = /[\S]+/gi; //un ou plusieurs caract�res non blanc" (tous les caract�res sauf espace, retour chariot, tabulation, saut de ligne, saut de page). |
if (myregex.test(document.newuser.login.value)){ |
document.newuser.create.value=1; |
return true; |
} else { |
alert("Votre identifiant est invalide.");//non internationnalis� |
return false; |
} |
} |
</script> |
</head> |
<body> |
<?php |
include("password_generator.jsc"); |
echo "<TABLE width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; |
echo "<tr><th>$l_frame_top</th></tr>"; |
?> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1> |
<tr bgcolor="#666666"><td> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=2> |
<tr><td valign="middle" align="left"> |
<center> |
<table border=0 width=550 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor="black" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white"><? echo "$l_frame"; ?></font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<?php |
if ($create == 1){ |
if (is_file("../lib/$config[general_lib_type]/user_info.php")) |
include("../lib/$config[general_lib_type]/user_info.php"); |
if ($user_exists != "no"){ |
echo <<<EOM |
<b><i>$login</i> $l_user_exist</b> |
EOM; |
} |
else{ |
if (is_file("../lib/$config[general_lib_type]/create_user.php")) |
include("../lib/$config[general_lib_type]/create_user.php"); |
require("../lib/defaults.php"); |
if (is_file("../lib/$config[general_lib_type]/user_info.php")) |
include("../lib/$config[general_lib_type]/user_info.php"); |
} |
} |
?> |
<form name="newuser" method=post> |
<input type=hidden name=create value="0"> |
<input type=hidden name=show value="0"> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<?php |
echo <<<EOM |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
$l_login |
</td><td> |
<input type=text name="login" value="$login" size=35> |
</td> |
</tr> |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
$l_password |
</td><td> |
<input type=password name="passwd" size=35> |
<br /><input type="button" value="$l_passwd_gen" onclick="password(8)"> |
<input type="text" value="" name="pwdgene" size=20 readonly> |
</td> |
</tr> |
EOM; |
if ($config[general_lib_type] == 'sql'){ |
if (isset($member_groups)) |
$selected[$member_groups[0]] = 'selected'; |
echo <<<EOM |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
$l_group |
</td><td> |
EOM; |
include_once("../lib/$config[general_lib_type]/group_info.php"); |
if (isset($existing_groups)){ |
echo "<select name=\"Fgroup\">"; |
echo "<option value=\"\">"; |
foreach ($member_groups as $group) |
echo "<option value=\"$group\" $selected[$group]>$group\n"; |
echo " </select>"; |
} |
else echo "$l_group_empty"; |
echo "</td></tr>"; |
} |
if ($config[general_lib_type] == 'ldap' || |
($config[general_lib_type] == 'sql' && $config[sql_use_user_info_table] == 'true')){ |
echo <<<EOM |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
$l_name |
</td><td> |
<input type=text name="Fcn" value="$cn" size=35> |
</td> |
</tr> |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
$l_email |
</td><td> |
<input type=text name="Fmail" value="$mail" size=35> |
</td> |
</tr> |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
Service |
</td><td> |
<input type=text name="Fou" value="$ou" size=35> |
</td> |
</tr> |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
Nro TPH personnel |
</td><td> |
<input type=text name="Fhomephone" value="$homephone" size=35> |
</td> |
</tr> |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
Nro TPH bureau |
</td><td> |
<input type=text name="Ftelephonenumber" value="$telephonenumber" size=35> |
</td> |
</tr> |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
Nro TPH mobile |
</td><td> |
<input type=text name="Fmobile" value="$mobile" size=35> |
</td> |
</tr> |
EOM; |
} |
foreach($show_attrs as $key => $desc){ |
$name = $attrmap["$key"]; |
if ($name == 'none') |
continue; |
$oper_name = $name . '_op'; |
$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0]; |
print <<<EOM |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
$desc |
</td> |
EOM; |
if ($show_ops){ |
switch ($key) |
{ |
case 'Simultaneous-Use' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Login-Time' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Expiration' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Session-Timeout' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'Max-Daily-Session' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Max-Weekly-Session' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Max-Monthly-Session' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'ChilliSpot-Max-Input-Octets' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'ChilliSpot-Max-Output-Octets' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'ChilliSpot-Max-Total-Octets' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'ChilliSpot-Bandwidth-Max-Up' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'ChilliSpot-Bandwidth-Max-Down' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'WISPr-Redirection-URL' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
default : |
print <<<EOM |
<td> |
<select name=$oper_name> |
<option $selected[$op_eq] value="=">= |
<option $selected[$op_set] value=":=">:= |
<option $selected[$op_add] value="+=">+= |
<option $selected[$op_eq2] value="==">== |
<option $selected[$op_ne] value="!=">!= |
<option $selected[$op_gt] value=">">> |
<option $selected[$op_ge] value=">=">>= |
<option $selected[$op_lt] value="<">< |
<option $selected[$op_le] value="<="><= |
<option $selected[$op_regeq] value="=~">=~ |
<option $selected[$op_regne] value="!~">!~ |
<option $selected[$op_exst] value="=*">=* |
<option $selected[$op_nexst] value="!*">!* |
</select> |
</td> |
EOM; |
break; |
} |
} |
print <<<EOM |
<td> |
<input type=text name="$name" value="$val" size=35> |
</td> |
</tr> |
EOM; |
} |
echo "</table><BR>"; |
if ($create == 1) |
echo "<input type=submit class=button value=\"Afficher le profil de l'utilisateur\" OnClick=\"this.form.show.value=1\">"; |
else{ |
//echo "<input type=submit class=button value=\"Créer\" OnClick=\"this.form.create.value=1\">";} |
echo "<input type=submit class=button value=\"Créer\" OnClick=\"return formControl();\">";} |
?> |
</form> |
</td></tr> |
</table> |
</tr> |
</table> |
</TD></TR> |
</TABLE> |
</td></tr> |
</TABLE> |
</body> |
</html> |
/web/acc/manager/htdocs/user_accounting.php |
---|
0,0 → 1,249 |
<?php |
require('/etc/freeradius-web/config.php'); |
?> |
<html> |
<?php |
require('../lib/functions.php'); |
require('../lib/sql/functions.php'); |
require('../lib/attrshow.php'); |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php")) |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php"); |
else{ |
echo <<<EOM |
<title>Analyse pour $login</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
<center> |
<b>Could not include SQL library functions. Aborting</b> |
</body> |
</html> |
EOM; |
exit(); |
} |
$now = time(); |
$now_str = ($now_str != '') ? "$now_str" : date($config[sql_date_format],$now + 86400); |
$prev_str = ($prev_str != '') ? "$prev_str" : date($config[sql_date_format], $now - 604800 ); |
$num = 0; |
$pagesize = ($pagesize) ? $pagesize : 10; |
if (!is_numeric($pagesize) && $pagesize != 'all') |
$pagesize = 10; |
$limit = ($pagesize == 'all') ? '' : "$pagesize"; |
$selected[$pagesize] = 'selected'; |
$order = ($order != '') ? $order : $config[general_accounting_info_order]; |
if ($order != 'desc' && $order != 'asc') |
$order = 'desc'; |
$selected[$order] = 'selected'; |
$now_str = da_sql_escape_string($now_str); |
$prev_str = da_sql_escape_string($prev_str); |
unset($da_name_cache); |
if (isset($_SESSION['da_name_cache'])) |
$da_name_cache = $_SESSION['da_name_cache']; |
echo <<<EOM |
<head> |
<title>Analyse pour $login</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>Statistique des connexions</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1> |
<tr bgcolor="#666666"><td> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=2> |
<tr><td valign="middle" align="left"> |
<center> |
<table border=0 width=550 cellpadding=0 cellspacing=0> |
<tr valign=top> |
<!--<td align=center><img src="images/title2.gif"></td>--> |
</tr> |
</table> |
<table border=0 width=400 cellpadding=0 cellspacing=2> |
EOM; |
include("../html/user_toolbar.html.php"); |
print <<<EOM |
</table> |
<br> |
<table border=0 width=840 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=65%></td> |
<td bgcolor="black" width=35%> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">Analyse pour $login</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
Dates du <b>$prev_str</b> au <b>$now_str</b> |
EOM; |
?> |
<p> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr bgcolor="#d0ddb0"> |
<th>#</th> |
<?php |
for($i=1;$i<=9;$i++){ |
if ($acct_attrs['ua']["$i"] != '') |
echo "<th>" . $acct_attrs['ua']["$i"] . "</th>\n"; |
} |
$sql_extra_query = ''; |
if ($config[sql_accounting_extra_query] != '') |
$sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config); |
?> |
</tr> |
<?php |
$link = @da_sql_pconnect($config); |
if ($link){ |
$search = @da_sql_query($link,$config, |
"SELECT " . da_sql_limit($limit,0,$config) . " * FROM $config[sql_accounting_table] |
WHERE username = '$login' AND acctstarttime <= '$now_str' |
AND acctstarttime >= '$prev_str' $sql_extra_query " . da_sql_limit($limit,1,$config) . |
" ORDER BY acctstarttime $order " . da_sql_limit($limit,2,$config). " ;"); |
if ($search){ |
while( $row = @da_sql_fetch_array($search,$config) ){ |
$tr_color='white'; |
$num++; |
$acct_type = "$row[framedprotocol]/$row[nasporttype]"; |
if ($acct_type == '') |
$acct_type = '-'; |
$acct_logedin = $row[acctstarttime]; |
$acct_sessiontime = $row[acctsessiontime]; |
$acct_sessiontime_sum += $acct_sessiontime; |
$acct_sessiontime = time2str($acct_sessiontime); |
$acct_ip = $row[framedipaddress]; |
if ($acct_ip == '') |
$acct_ip = '-'; |
$acct_upload = $row[acctinputoctets]; |
$acct_upload_sum += $acct_upload; |
$acct_upload = bytes2str($acct_upload); |
$acct_download = $row[acctoutputoctets]; |
$acct_download_sum += $acct_download; |
$acct_download = bytes2str($acct_download); |
$acct_server = $row[nasipaddress]; |
if ($acct_server != ''){ |
$acct_server = $da_name_cache[$row[nasipaddress]]; |
if (!isset($acct_server)){ |
$acct_server = @gethostbyaddr($row[nasipaddress]); |
if (!isset($da_name_cache) && $config[general_use_session] == 'yes'){ |
$da_name_cache[$row[nasipaddress]] = $acct_server; |
session_register('da_name_cache'); |
} |
else |
$da_name_cache[$row[nasipaddress]] = $acct_server; |
} |
} |
else |
$acct_server = '-'; |
$acct_server = "$acct_server:$row[nasportid]"; |
$acct_terminate_cause = "$row[acctterminatecause]"; |
if ($acct_terminate_cause == '') |
$acct_terminate_cause = '-'; |
if (ereg('Login-Incorrect',$acct_terminate_cause) || |
ereg('Multiple-Logins', $acct_terminate_cause) || ereg('Invalid-User',$acct_terminate_cause)) |
$tr_color='#ffe8e0'; |
$acct_callerid = "$row[callingstationid]"; |
if ($acct_callerid == '') |
$acct_callerid = '-'; |
echo <<<EOM |
<tr align=center bgcolor="$tr_color"> |
<td>$num</td> |
EOM; |
if ($acct_attrs[ua][1] != '') echo "<td>$acct_type</td>\n"; |
if ($acct_attrs[ua][2] != '') echo "<td>$acct_logedin</td>\n"; |
if ($acct_attrs[ua][3] != '') echo "<td>$acct_sessiontime</td>\n"; |
if ($acct_attrs[ua][4] != '') echo "<td>$acct_ip</td>\n"; |
if ($acct_attrs[ua][5] != '') echo "<td>$acct_upload</td>\n"; |
if ($acct_attrs[ua][6] != '') echo "<td>$acct_download</td>\n"; |
if ($acct_attrs[ua][7] != '') echo "<td>$acct_server</td>\n"; |
if ($acct_attrs[ua][8] != '') echo "<td>$acct_terminate_cause</td>\n"; |
if ($acct_attrs[ua][9] != '') echo "<td>$acct_callerid</td>\n"; |
echo "</tr>\n"; |
} |
$acct_sessiontime_sum = time2str($acct_sessiontime_sum); |
$acct_upload_sum = bytes2str($acct_upload_sum); |
$acct_download_sum = bytes2str($acct_download_sum); |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
$colspan = 3; |
if ($acct_attrs[ua][1] == '') |
$colspan--; |
if ($acct_attrs[ua][2] == '') |
$colspan--; |
echo <<<EOM |
<tr bgcolor="lightyellow"> |
<td colspan=$colspan align="right">Total pages</td> |
EOM; |
if ($acct_attrs[ua][3] != '') echo "<td align=\"center\"><b>$acct_sessiontime_sum</td>\n"; |
if ($acct_attrs[ua][4] != '') echo "<td> </td>\n"; |
if ($acct_attrs[ua][5] != '') echo "<td align=\"right\" nowrap><b>$acct_upload_sum</td>\n"; |
if ($acct_attrs[ua][6] != '') echo "<td align=\"right\" nowrap><b>$acct_download_sum</td>\n"; |
if ($acct_attrs[ua][7] != '') echo "<td> </td>\n"; |
if ($acct_attrs[ua][8] != '') echo "<td> </td>\n"; |
if ($acct_attrs[ua][9] != '') echo "<td> </td>\n"; |
?> |
</tr> |
</table> |
<tr><td> |
<hr> |
<tr><td align="center"> |
<form action="user_accounting.php" method="get" name="master"> |
<table border=0> |
<tr><td colspan=6></td> |
</tr> |
<tr valign="bottom"> |
<td><small><b>Utilisateur</td><td><small><b>début date</td><td><small><b>fin date</td><td><small><b>nbr./page</td><td><b>classé le</td> |
<tr valign="middle"><td> |
<?php |
echo <<<EOM |
<input type="text" name="login" size="11" value="$login"></td> |
<td><input type="text" name="prev_str" size="11" value="$prev_str"></td> |
<td><input type="text" name="now_str" size="11" value="$now_str"></td> |
<td><select name="pagesize"> |
<option $selected[5] value="5" >05 |
<option $selected[10] value="10">10 |
<option $selected[15] value="15">15 |
<option $selected[20] value="20">20 |
<option $selected[40] value="40">40 |
<option $selected[80] value="80">80 |
<option $selected[all] value="all">tous |
</select> |
</td> |
<td><select name="order"> |
<option $selected[asc] value="asc">plus ancien en premier |
<option $selected[desc] value="desc">plus récent en premier |
</select> |
</td> |
EOM; |
?> |
<td><input type="submit" class=button value="show"></td></tr> |
</table></td></tr></form> |
</table> |
</tr> |
</table> |
</TD></TR> |
</TABLE> |
</td></tr> |
</TABLE> |
</body> |
</html> |
/web/acc/manager/html/user_admin.html.php |
---|
0,0 → 1,432 |
<?php |
echo <<<EOM |
<title>Informations de l'utilisateur $cn</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
</head> |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>Gestion des usagers</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1> |
<tr bgcolor="#666666"><td> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=2> |
<tr><td valign="middle" align="left"> |
<link rel="stylesheet" href="/css/style.css"> |
EOM; |
if ($logged_now) |
print <<<EOM |
<script Language="JavaScript"> |
<!-- |
var start; |
var our_time; |
function startcounter() |
{ |
var start_date = new Date(); |
start = start_date.getTime(); |
our_time = $lastlog_session_time_jvs; |
showcounter(); |
} |
function showcounter () |
{ |
var now_date = new Date(); |
var diff = now_date.getTime() - start + our_time; |
var hours = parseInt(diff / 3600000); |
if(isNaN(hours)) hours = 0; |
var minutes = parseInt((diff % 3600000) / 60000); |
if(isNaN(minutes)) minutes = 0; |
var seconds = parseInt(((diff % 3600000) % 60000) / 1000); |
if(isNaN(seconds)) seconds = 0; |
var timeValue = " " ; |
timeValue += ((hours < 10) ? "0" : "") + hours; |
timeValue += ((minutes < 10) ? ":0" : ":") + minutes; |
timeValue += ((seconds < 10) ? ":0" : ":") + seconds; |
document.online.status.value = timeValue; |
setTimeout("showcounter()", 1000); |
} |
//--> |
</script> |
EOM; |
print <<<EOM |
<center> |
<table border=0 width=550 cellpadding=0 cellspacing=0> |
<tr valign=top> |
<!--<td align=center><img src="images/title2.gif"></td>--> |
</tr> |
</table> |
<table border=0 width=400 cellpadding=0 cellspacing=2> |
EOM; |
include("../html/user_toolbar.html.php"); |
print <<<EOM |
</table> |
<br> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor="black" width=250> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">Etat des connexions pour $login ($cn)</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
EOM; |
if ($logged_now){ |
print <<<EOM |
<form name="online" onSubmit="return(false);"> |
<tr><td align=center bgcolor="#d0ddb0"> |
L'utilisateur est <b>en ligne</b> depuis |
</td><td> |
$lastlog_time |
</td></tr> |
<tr><td align=center bgcolor="#d0ddb0"> |
Durée des connexions |
</td><td> |
<input type="text" name="status" size=10 value="$lastlog_session_time"> |
</form> |
</td></tr> |
EOM; |
require('../html/user_admin_userinfo.html.php'); |
}else if ($not_known) print <<<EOM |
<tr><td align=center bgcolor="#d0ddb0"> |
Cet utilisateur ne s'est <b>jamais</b> connecté |
</td><td>- |
</td></tr> |
EOM; |
else{ |
print <<<EOM |
<tr><td align=center bgcolor="#d0ddb0"> |
L'utilisateur <b>n'est pas connecté</b> actuellement<br> |
</td><td>- |
</td></tr> |
<tr><td align=center bgcolor="#d0ddb0"> |
Dernière connexion |
</td><td> |
$lastlog_time |
</td></tr> |
<tr><td align=center bgcolor="#d0ddb0"> |
Durée de la connexion |
</td><td> |
$lastlog_session_time |
</td></tr> |
EOM; |
require('../html/user_admin_userinfo.html.php'); |
} |
print <<<EOM |
<tr><td align=center bgcolor="#d0ddb0"> |
Sessions autorisées |
</td><td> |
$msg |
</td></tr> |
<tr><td align=center bgcolor="#d0ddb0"> |
Description complète de l'utilisateur |
</td><td> |
$descr |
</td></tr> |
</table> |
</table> |
</table> |
EOM; |
if (is_file("../lib/$config[general_lib_type]/password_check.php")) |
include("../lib/$config[general_lib_type]/password_check.php"); |
echo <<<EOM |
<br> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor="black" width=250> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">Analyse</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr><td align=center bgcolor="#d0ddb0">-</td><td align=center bgcolor="#d0ddb0"><b>mensuel</b></td><td align=center bgcolor="#d0ddb0"><b>hebdomadaire</b></td><td align=center bgcolor="#d0ddb0"><b>journalier</b></td><td align=center bgcolor="#d0ddb0"><b>par session</b></td></tr> |
<tr><td align=center bgcolor="#d0ddb0"><b>limite</b></td><td>$monthly_limit</td><td>$weekly_limit</td><td>$daily_limit</td><td>$session_limit</td></tr> |
<tr><td align=center bgcolor="#d0ddb0"><b>durée utilisée</b></td><td>$monthly_used</td><td>$weekly_used</td><td>$daily_used</td><td>$lastlog_session_time</td></tr> |
</table> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" va |
lign=top> |
<tr><td align=center bgcolor="#d0ddb0"><b>Jour</b></td><td align=center bgcolor="#d0ddb0"><b>limite journalière</b></td><td align=center bgcolor="#d0ddb0"><b>durée utilisée</b></td><tr> |
<tr><td align=center bgcolor="#d0ddb0">dimanche</td><td>$daily_limit</td><td>$used[0]</td></tr> |
<tr><td align=center bgcolor="#d0ddb0">lundi</td><td>$daily_limit</td><td>$used[1]</td></tr> |
<tr><td align=center bgcolor="#d0ddb0">mardi</td><td>$daily_limit</td><td>$used[2]</td></tr> |
<tr><td align=center bgcolor="#d0ddb0">mercredi</td><td>$daily_limit</td><td>$used[3]</td></tr> |
<tr><td align=center bgcolor="#d0ddb0">jeudi</td><td>$daily_limit</td><td>$used[4]</td></tr> |
<tr><td align=center bgcolor="#d0ddb0">vendredi</td><td>$daily_limit</td><td>$used[5]</td></tr> |
<tr><td align=center bgcolor="#d0ddb0">samedi</td><td>$daily_limit</td><td>$used[6]</td></tr> |
</table></table> |
</table> |
<br> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor="black" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">État sur les 7 derniers jours</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr><td align=center bgcolor="#d0ddb0">Nombre de connexions</td><td> |
<b><font color="darkblue">$tot_conns</font></b></td></tr> |
<tr><td align=center bgcolor="#d0ddb0">Durée cumulée des connexions</td><td> |
<b><font color="darkblue">$tot_time</td></tr></td></tr> |
<tr><td align=center bgcolor="#d0ddb0">Identifications défectueuses</td><td> |
<b><font color="darkblue">$tot_badlogins</td></tr></td></tr> |
<tr><td align=center bgcolor="#d0ddb0">Upload</td><td> |
$tot_input</td></tr></td></tr> |
<tr><td align=center bgcolor="#d0ddb0">Download</td><td> |
$tot_output</td></tr></td></tr> |
<tr><td align=center bgcolor="#d0ddb0">Duré moyenne</td><td> |
$avg_time</td></tr></td></tr> |
<tr><td align=center bgcolor="#d0ddb0">Upload moyen</td><td> |
$avg_input</td></tr></td></tr> |
<tr><td align=center bgcolor="#d0ddb0">Download moyen</td><td> |
$avg_output</td></tr></td></tr> |
</table> |
</table> |
</table> |
<br> |
EOM; |
if ($user_info){ |
echo <<<EOM |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor="black" width=250> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">Informations personnelles</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>nom</b> |
</td> |
<td> |
$cn |
</td> |
</tr> |
EOM; |
if ($config[general_prefered_lang] != 'en'){ |
echo <<<EOM |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>nom ($config[general_prefered_lang_name])</b> |
</td> |
<td> |
$cn_lang |
</td> |
</tr> |
EOM; |
} |
echo <<<EOM |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>service</b> |
</td> |
<td> |
$ou |
</td> |
</tr> |
EOM; |
if ($config[general_prefered_lang] != 'en'){ |
echo <<<EOM |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>service ($config[general_prefered_lang_name])</b> |
</td> |
<td> |
$ou_lang |
</td> |
</tr> |
EOM; |
} |
echo <<<EOM |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>titre</b> |
</td> |
<td> |
$title |
</td> |
</tr> |
EOM; |
if ($config[general_prefered_lang] != 'en'){ |
echo <<<EOM |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>title ($config[general_prefered_lang_name])</b> |
</td> |
<td> |
$title_lang |
</td> |
</tr> |
EOM; |
} |
echo <<<EOM |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>adresse</b> |
</td> |
<td> |
$address |
</td> |
</tr> |
EOM; |
if ($config[general_prefered_lang] != 'en'){ |
echo <<<EOM |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>adresse ($config[general_prefered_lang_name])</b> |
</td> |
<td> |
$address_lang |
</td> |
</tr> |
EOM; |
} |
echo <<<EOM |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>adresse personnelle</b> |
</td> |
<td> |
$homeaddress |
</td> |
</tr> |
EOM; |
if ($config[general_prefered_lang] != 'en'){ |
echo <<<EOM |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>adresse personnelle ($config[general_prefered_lang_name])</b> |
</td> |
<td> |
$homeaddress_lang |
</td> |
</tr> |
EOM; |
} |
echo <<<EOM |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>téléphone</b> |
</td> |
<td> |
$telephonenumber |
</td> |
</tr> |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>téléphone personnel</b> |
</td> |
<td> |
$homephone |
</td> |
</tr> |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>mobile</b> |
</td> |
<td> |
$mobile |
</td> |
</tr> |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>fax</b> |
</td> |
<td> |
$fax |
</td> |
</tr> |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>home page</b> |
</td> |
<td> |
<a href="$url" target=userpage onclick=window.open("$url","userpage","width=1000,height=550,toolbar=no,scrollbars=yes,resizable=yes") title="Aller àà la page d'accueil de l'utilisateur">$url</a> |
</td> |
</tr> |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>e-mail</b> |
</td> |
<td> |
<a href="mailto: $mail" title="Envoyer un email">$mail</a> |
</td> |
</tr> |
<tr> |
<td align=center bgcolor="#d0ddb0"> |
<b>e-mail alias</b> |
</td> |
<td> |
<a href="mailto: $mailalt" title="Envoyer un email">$mailalt</a> |
</td> |
</tr> |
</table> |
</table> |
</table> |
EOM; |
} |
?> |
<tr> <td colspan=3 height=1></td></tr> |
<tr> <td colspan=3> |
</table> |
<?php |
if ($logged_now) |
print <<<EOM |
<script Language="JavaScript"> |
startcounter(); |
</script> |
EOM; |
?> |
</TD></TR> |
</TABLE> |
</td></tr> |
</TABLE> |
</body> |
</html> |
/web/acc/manager/html/group_toolbar.html.php |
---|
0,0 → 1,13 |
<?php |
$Login = urlencode($login); |
print <<<EOM |
<tr valign=top> |
<td align=center bgcolor="#FFCC66"> |
<a href="group_admin.php?login=$Login" title="Gestion des membres du groupe"><font color="black"><b>MEMBRES</b></font></a></td> |
<td align=center bgcolor="#FFCC66"> |
<a href="user_edit.php?login=$Login&user_type=group" title="Editer les propriétés du groupe"><font color="black"><b>ATTRIBUTS</b></font></a></td> |
<td align=center bgcolor="#FFCC66"> |
<a href="user_delete.php?login=$Login&user_type=group" title="Supprimer le groupe"><font color="black"><b>SUPPRIMER</b></font></a></td> |
</tr> |
EOM; |
?> |
/web/acc/manager/html/stats.html.php |
---|
0,0 → 1,270 |
<form action="stats.php" method="get"> |
<table border=0 width=600 cellpadding=2 cellspacing=0> |
<tr> |
<td align=left> |
<table border=0 cellspacing=0 cellpadding=2> |
<tr valign=bottom> |
<td><small><b>De </td> |
<td><small><b>à </td> |
<td><small><b>usager</td> |
<td><small><b>sur le serveur</td> |
<td> </td> |
</tr> |
<tr valign=middle> |
<?php |
echo <<<EOM |
<td valign=middle><input type="text" name="after" size="12" value="$after" ></td> |
<td valign=middle><input type="text" name="before" size="12" value="$before"></td> |
<td valign=middle><input type="text" name="login" size="12" value="$login" ></td> |
<td valign=middle><select name="server" size=1> |
EOM; |
foreach($servers as $key => $val) |
echo <<<EOM |
<option value="$val">$key |
EOM; |
?> |
</select></td> |
<td valign=middle><input type="submit" class=button value="Go"></td> |
</tr> |
</table> |
</td> |
</tr> |
<tr> |
<td><hr size=1 noshade></td> |
</tr> |
<tr> |
<td valign=top> |
<table border=0 width="100%"> |
<tr> <td align=center valign=top width="45%"> |
<small> |
<font color="darkblue"><b><?php echo $date ?></b></font> |
</td> |
<td align=center valign=top width="10%"> </td> |
<td align=center valign=top width="45%"><small> |
Période observée :<br> |
<?php |
echo <<<EOM |
<b>$after</b> à <b>$before</b> |
EOM; |
?> |
</td> |
</tr> |
</table> |
</td> |
</tr> |
<tr> |
<td align=center><h1><b>Statistiques d'utilisation journalière</td> |
</tr> |
<tr> |
<td valign=top> |
<table border=0 width="100%"> |
<tr> |
<td colspan=2> |
<center> |
Statistiques pour |
<?php |
if ($login == '') |
echo <<<EOM |
<b><font color="darkblue">tous</font></b> les usagers |
EOM; |
else |
echo <<<EOM |
l'usager <b><font color="darkblue">$login</font></b> |
EOM; |
?> |
</td> |
</tr> |
</table> |
</td> |
</tr> |
<tr> |
<td> |
<table border=0 cellpadding=0 cellspacing=0 width="100%"> |
<tr> <td colspan=2><hr size=1 noshade> |
</td> |
</tr> |
</table> |
</td> |
</tr> |
<tr> |
<td align="center"> |
<table border=0 cellpadding=0 cellspacing=1 width="100%"> |
<?php |
echo <<<EOM |
<tr> |
<td>Champs affichés :</td><td colspan=10 align=center nowrap><select name="column1"> |
<option $selected1[sessions] value="sessions">Nbre de sessions |
<option $selected1[usage] value="usage">Temps d'utilisation total |
<option value="upload">------------------ |
<option $selected1[upload] value="upload">uploads |
<option $selected1[download] value="download">downloads |
</select> <select name="column2"> |
<option $selected2[sessions] value="sessions">Nbre de sessions |
<option $selected2[usage] value="usage">Temps d'utilisation total |
<option value="upload">------------------ |
<option $selected2[upload] value="upload">uploads |
<option $selected2[download] value="download">downloads |
</select> <select name="column3"> |
<option $selected3[sessions] value="sessions">Nbre de sessions |
<option $selected3[usage] value="usage">Temps d'utilisation total |
<option value="upload">------------------ |
<option $selected3[upload] value="upload">uploads |
<option $selected3[download] value="download">downloads |
EOM; |
?> |
</select> |
</td> |
</tr> |
<tr> |
<td colspan=10 align=center valign=middle> |
<table border=0 width="100%"> |
<tr> |
<td width=50% align=left> |
<table border=0 cellpadding=0 cellspacing=0> |
<tr> |
<td align=right><input type="submit" class=button value="Rafraîchir"></td> |
</tr> |
</table> |
</td> |
</tr> |
</table> |
</td> |
</tr> |
</table> |
</td> |
<tr> |
<td colspan=10 height=20><img src="images/pixel.gif"></td> |
</tr> |
<tr> |
<td colspan=10 height=20 align=center> |
<table border=0 width=640 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=440></td> |
<td bgcolor="black" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">Analyse journalière</font> |
</th></tr> |
</table> |
</td></tr> |
<tr valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<p> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr bgcolor="#d0ddb0"> |
<th>date</th> |
<?php |
echo <<<EOM |
<th colspan=3>$message[$column1]</th> |
<th colspan=3>$message[$column2]</th> |
<th colspan=3>$message[$column3]</th> |
EOM; |
?> |
</tr> |
<?php |
for($i = 0; $i <= $num_days; $i++){ |
$day = $days[$i]; |
$trcolor = ($i % 2) ? "#f7f7e4" : "#efefe4"; |
echo <<<EOM |
<tr align=center bgcolor="$trcolor"> |
<td>$day</td> |
<td>{$data[$day][1]}</td> |
<td>{$perc[$day][1]}</td> |
<td align=left height=14> |
<table border=0 cellpadding=0> |
<tr> |
<td bgcolor="{$color[$day][1]}" width={$width[$day][1]}><img border=0 height=14 width={$width[$day][1]} src="images/pixel.gif" alt="the $message[$column1] for $day is {$data[$day][1]}"></td> |
</tr> |
</table> |
</td> |
<td>{$data[$day][2]}</td> |
<td>{$perc[$day][2]}</td> |
<td align=left height=14> |
<table border=0 cellpadding=0> |
<tr> |
<td bgcolor="{$color[$day][2]}" width={$width[$day][2]}><img border=0 height=14 width={$width[$day][2]} src="images/pixel.gif" alt="the $message[$column3] for $day is {$data[$day][2]}"></td> |
</tr> |
</table> |
</td> |
<td>{$data[$day][3]}</td> |
<td>{$perc[$day][3]}</td> |
<td align=left height=14> |
<table border=0 cellpadding=0> |
<tr> |
<td bgcolor="{$color[$day][3]}" width={$width[$day][3]}><img border=0 height=14 width={$width[$day][3]} src="images/pixel.gif" alt="the $message[$column3] for $day is {$data[$day][3]}"></td> |
</tr> |
</table> |
</td> |
</tr> |
EOM; |
} |
?> |
</table> |
</td></tr> |
</table> |
</td></tr> |
</table> |
</td></tr> |
</table> |
<p> |
<table border=0 width=640 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=440></td> |
<td bgcolor="black" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white">Récapitulatif journalier</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<p> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ff |
ffe0" valign=top> |
<tr bgcolor="#d0ddb0"> |
<th> </th> |
<?php |
echo <<<EOM |
<th>$message[$column1]</th> |
<th>$message[$column2]</th> |
<th>$message[$column3]</th> |
EOM; |
?> |
</tr> |
<?php |
echo <<<EOM |
<tr align=center bgcolor="#efefe4"> |
<td>maximum</td> |
<td>{$data[max][1]}</td> |
<td>{$data[max][2]}</td> |
<td>{$data[max][3]}</td> |
</tr> |
<tr align=center bgcolor="#f7f7e4"> |
<td>moyenne</td> |
<td>{$data[avg][1]}</td> |
<td>{$data[avg][2]}</td> |
<td>{$data[avg][3]}</td> |
</tr> |
<tr align=center bgcolor="#efefe4"> |
<td>récapitulatif</td> |
<td>{$data[sum][1]}</td> |
<td>{$data[sum][2]}</td> |
<td>{$data[sum][3]}</td> |
</tr> |
EOM; |
?> |
</table> |
</table> |
</td></tr> |
</table> |
</td></tr> |
</table> |
</form> |
</center> |
</body> |
</html> |
/web/acc/manager/html/user_toolbar.html.php |
---|
0,0 → 1,28 |
<?php |
$Login = urlencode($login); |
print <<<EOM |
<tr valign=top> |
<td align=center bgcolor="#FFCC66"> |
<a href="user_admin.php?login=$Login" title="Afficher les informations de l'usager"><font color="black"><b>ÉTAT</b></font></a></td> |
<td align=center bgcolor="#FFCC66"> |
<a href="user_edit.php?login=$Login" title="Modifier les paramètres de l'usager"><font color="black"><b>ATTRIBUTS</b></font></a></td> |
<td align=center bgcolor="#FFCC66"> |
<a href="user_info.php?login=$Login" title="Modifier les informations personnelles de l'usager"><font color="black"><b>INFOS PERSONNELLES</b></font></a></td> |
</tr> |
<tr valign=top> |
<td align=center bgcolor="#FFCC66"> |
<a href="user_accounting.php?login=$Login" title="Afficher les informations de connexions de l'usager"><font color="black"><b>CONNEXIONS</b></font></a></td> |
<!--<td align=center bgcolor="#FFCC66"> |
<a href="badusers.php?login=$Login" title="Show User Unauthorized Actions"><font color="black"><b>BADUSERS</b></font></a></td> |
--> |
<td align=center bgcolor="#FFCC66"> |
<a href="user_delete.php?login=$Login" title="Supprimer l'usager"><font color="black"><b>SUPPRIMER</b></font></a></td> |
<!--<td align=center bgcolor="#FFCC66"> |
<a href="user_test.php?login=$Login" title="Test de l'usager"><font color="black"><b>TEST</b></font></a></td> |
--> |
<td align=center bgcolor="#FFCC66"> |
<a href="clear_opensessions.php?login=$Login" title="Effacer les sessions ouvertes de l'usager"><font color="black"><b>SESSIONS OUVERTES</b></font></a></td> |
</tr> |
</font> |
EOM; |
?> |
/web/acc/manager/html/user_admin_userinfo.html.php |
---|
0,0 → 1,29 |
<?php |
echo <<<EOM |
<tr><td align=center bgcolor="#d0ddb0"> |
Serveur |
</td><td> |
<b>$lastlog_server_name</b> ($lastlog_server_ip) |
</td></tr> |
<tr><td align=center bgcolor="#d0ddb0"> |
Port du serveur |
</td><td> |
$lastlog_server_port |
</td></tr> |
<tr><td align=center bgcolor="#d0ddb0"> |
@MAC de la station cliente |
</td><td> |
$lastlog_callerid |
</td></tr> |
<tr><td align=center bgcolor="#d0ddb0"> |
Upload |
</td><td> |
$lastlog_input |
</td></tr> |
<tr><td align=center bgcolor="#d0ddb0"> |
Download |
</td><td> |
$lastlog_output |
</td></tr> |
EOM; |
?> |
/web/acc/manager/lib/functions.php |
---|
0,0 → 1,135 |
<?php |
function time2str($time) |
{ |
$time = floor($time); |
if (!$time) |
return "0 seconds"; |
$d = $time/86400; |
$d = floor($d); |
if ($d){ |
$str .= "$d days, "; |
$time = $time % 86400; |
} |
$h = $time/3600; |
$h = floor($h); |
if ($h){ |
$str .= "$h hours, "; |
$time = $time % 3600; |
} |
$m = $time/60; |
$m = floor($m); |
if ($m){ |
$str .= "$m minutes, "; |
$time = $time % 60; |
} |
if ($time) |
$str .= "$time seconds, "; |
$str = ereg_replace(', $','',$str); |
return $str; |
} |
function time2strclock($time) |
{ |
$time = floor($time); |
if (!$time) |
return "00:00:00"; |
$str["days"] = $str["hour"] = $str["min"] = $str["sec"] = "00"; |
$d = $time/86400; |
$d = floor($d); |
if ($d){ |
if ($d < 10) |
$d = "0" . $d; |
$str["days"] = "$d"; |
$time = $time % 86400; |
} |
$h = $time/3600; |
$h = floor($h); |
if ($h){ |
if ($h < 10) |
$h = "0" . $h; |
$str["hour"] = "$h"; |
$time = $time % 3600; |
} |
$m = $time/60; |
$m = floor($m); |
if ($m){ |
if ($m < 10) |
$m = "0" . $m; |
$str["min"] = "$m"; |
$time = $time % 60; |
} |
if ($time){ |
if ($time < 10) |
$time = "0" . $time; |
} |
else |
$time = "00"; |
$str["sec"] = "$time"; |
if ($str["days"] != "00") |
$ret = "$str[days]:$str[hour]:$str[min]:$str[sec]"; |
else |
$ret = "$str[hour]:$str[min]:$str[sec]"; |
return $ret; |
} |
function date2timediv($date,$now) |
{ |
list($day,$time)=explode(' ',$date); |
$day = explode('-',$day); |
$time = explode(':',$time); |
$timest = mktime($time[0],$time[1],$time[2],$day[1],$day[2],$day[0]); |
if (!$now) |
$now = time(); |
return ($now - $timest); |
} |
function date2time($date) |
{ |
list($day,$time)=explode(' ',$date); |
$day = explode('-',$day); |
$time = explode(':',$time); |
$timest = mktime($time[0] ?"":0,$time[1],$time[2],$day[1],$day[2],$day[0]); |
return $timest; |
} |
function bytes2str($bytes) |
{ |
$bytes=floor($bytes); |
if ($bytes > 536870912) |
$str = sprintf("%5.2f GBs", $bytes/1073741824); |
else if ($bytes > 524288) |
$str = sprintf("%5.2f MBs", $bytes/1048576); |
else |
$str = sprintf("%5.2f KBs", $bytes/1024); |
return $str; |
} |
function nothing($ret) |
{ |
return $ret; |
} |
function check_defaults($val,$op,$def) |
{ |
for($i=0;$i<$def[count];$i++){ |
if ($val == $def[$i] && ($op == '' || $op == $def[operator][$i])) |
return 1; |
} |
return 0; |
} |
function check_ip($ipaddr) { |
if(ereg("^([0-9]{1,3})\x2E([0-9]{1,3})\x2E([0-9]{1,3})\x2E([0-9]{1,3})$", $ipaddr,$digit)) { |
if(($digit[1] <= 255) && ($digit[2] <= 255) && ($digit[3] <= 255) && ($digit[4] <= 255)) { |
return(1); |
} |
} |
return(0); |
} |
?> |
/web/acc/manager/pass/index.php |
---|
0,0 → 1,143 |
<?php |
# change user password on Alcasar captive Portal |
# Copyright (C) 2003, 2004 Mondru AB. |
# Copyright (C) 2008-2009 ANGEL95 & REXY |
require('/etc/freeradius-web/config.php'); |
require('../lib/functions.php'); |
require('../lib/defaults.php'); |
$current_page = $_SERVER['PHP_SELF']; |
# Choice of language |
$Language = 'fr'; |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){ |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); |
$Language = strtolower(substr(chop($Langue[0]),0,2)); } |
if($Language == 'es'){ |
$R_title = "User password change"; |
$R_form_l1 = "User"; |
$R_form_l2 = "Old password"; |
$R_form_l3 = "New password"; |
$R_form_l4 = "New password (confirmation)"; |
$R_form_button = "Modify"; |
$R_form_result1 = "Your password has been successfuly changed"; |
$R_form_result2 = "Error when trying to change password"; |
} |
if($Language == 'de'){ |
$R_title = "User password change"; |
$R_form_l1 = "User"; |
$R_form_l2 = "Old password"; |
$R_form_l3 = "New password"; |
$R_form_l4 = "New password (confirmation)"; |
$R_form_button = "Modify"; |
$R_form_result1 = "Your password has been successfuly changed"; |
$R_form_result2 = "Error when trying to change password"; |
} |
if($Language == 'nl'){ |
$R_title = "User password change"; |
$R_form_l1 = "User"; |
$R_form_l2 = "Old password"; |
$R_form_l3 = "New password"; |
$R_form_l4 = "New password (confirmation)"; |
$R_form_button = "Modify"; |
$R_form_result1 = "Your password has been successfuly changed"; |
$R_form_result2 = "Error when trying to change password"; |
} |
if($Language == 'en'){ |
$R_title = "User password change"; |
$R_form_l1 = "User"; |
$R_form_l2 = "Old password"; |
$R_form_l3 = "New password"; |
$R_form_l4 = "New password (confirmation)"; |
$R_form_button = "Modify"; |
$R_form_result1 = "Your password has been successfuly changed"; |
$R_form_result2 = "Error when trying to change password"; |
} |
if($Language == 'fr'){ |
$R_title = "Changement de mot de passe utilisateur"; |
$R_form_l1 = "Utilisateur"; |
$R_form_l2 = "Ancien mot de passe"; |
$R_form_l3 = "nouveau mot de passe"; |
$R_form_l4 = "nouveau mot de passe (confirmation)"; |
$R_form_button = "Modifier"; |
$R_form_result1 = "Votre mot de passe a été modifié avec succès"; |
$R_form_result2 = "Erreur de changement de mot de passe"; |
} |
echo " |
<html> |
<head> |
<title>$R_title</title> |
<meta http-equiv=\"Cache-control\" content=\"no-cache\"> |
<meta http-equiv=\"Pragma\" content=\"no-cache\"> |
<link rel=\"stylesheet\" href=\"/css/style.css\" type=\"text/css\"> |
</head> |
<body> |
<center> |
<table border=0 width=400 cellpadding=0 cellspacing=2> |
<tr> |
<td> |
<form name=\"master\" action=\"$current_page\" method=\"post\"> |
<input type=hidden name=action value=checkpass> |
<br> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor=\"black\" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor=\"#907030\" align=right valign=top><th> |
<font color=\"white\">$R_title</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor=\"black\" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor=\"#ffffd0\" valign=top> |
<tr><td> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor=\"#ffffe0\" valign=top> |
<tr><td align=center bgcolor=\"#d0ddb0\">$R_form_l1</td><td><input type=\"text\" name=\"login\" value=\"\"></td></tr> |
<tr><td align=center bgcolor=\"#d0ddb0\">$R_form_l2</td><td><input type=\"password\" name=\"passwd\" value=\"\"></td></tr> |
<tr><td align=center bgcolor=\"#d0ddb0\">$R_form_l3</td><td><input type=\"password\" name=\"newpasswd\" value=\"\"></td></tr> |
<tr><td align=center bgcolor=\"#d0ddb0\">$R_form_l4</td><td><input type=\"password\" name=\"newpasswd2\" value=\"\"> <input type=\"submit\" class=button value=\"$R_form_button\"></td></tr> |
</table> |
</table> |
</table>"; |
#if (is_file("../lib/$config[general_lib_type]/password_check.php")) |
# include("../lib/$config[general_lib_type]/password_check.php"); |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php")) |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php"); |
else{ |
echo "<b>Could not include SQL library</b><br>\n"; |
exit(); |
} |
if ($action == 'checkpass'){ |
$link = @da_sql_pconnect($config); |
if ($link){ |
$res = @da_sql_query($link,$config, |
"SELECT attribute,value FROM $config[sql_check_table] WHERE username = '$login' |
AND attribute = '$config[sql_password_attribute]';"); |
if ($res){ |
$row = @da_sql_fetch_array($res,$config); |
if (is_file("../lib/crypt/$config[general_encryption_method].php")){ |
include("../lib/crypt/$config[general_encryption_method].php"); |
$enc_passwd = $row[value]; |
$passwd = da_encrypt($passwd,$enc_passwd); |
$newpasswd = da_encrypt($newpasswd,$enc_passwd); |
$newpasswd2 = da_encrypt($newpasswd2,$enc_passwd); |
if (($passwd == $enc_passwd) and ($newpasswd == $newpasswd2)){ |
$msg = '<font color=blue><b>'.$R_form_result1.'</b></font>'; |
$res2 = @da_sql_query($link,$config, |
"UPDATE $config[sql_check_table] set value='$newpasswd' WHERE username = '$login' |
AND attribute = '$config[sql_password_attribute]';");} |
else |
$msg = '<font color=red><b>'.$R_form_result2.'</b></font>'; |
} |
else |
echo "<b>Could not open encryption library file</b><br>\n"; |
} |
} |
echo "<tr><td colspan=3 align=center>$msg</td></tr>\n"; |
} |
?> |
</body> |
</html> |