/web/acc/manager/htdocs/accounting.php |
---|
25,22 → 25,22 |
} |
$operators=array( '=','<', '>', '<=', '>=', 'regexp', 'like' ); |
if ($config[sql_type] == 'pg'){ |
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); |
$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]; |
$key = strtolower(da_sql_field_name($fields,$i,$config)); |
$val = $sql_attrs[$key]['desc']; |
if ($val == '') |
continue; |
$show = $sql_attrs[$key][show]; |
$show = $sql_attrs[$key]['show']; |
$selected[$key] = ($show == 'yes') ? 'selected' : ''; |
$items[$key] = "$val"; |
} |
263,9 → 263,9 |
} |
echo "</tr>\n"; |
$search = @da_sql_query($link,$config,$query); |
$search = da_sql_query($link,$config,$query); |
if ($search){ |
while( $row = @da_sql_fetch_array($search,$config) ){ |
while( $row = da_sql_fetch_array($search,$config) ){ |
$num++; |
echo "<tr align=center>\n"; |
foreach($accounting_show_attrs as $val){ |
/web/acc/manager/htdocs/badusers.php |
---|
0,0 → 1,231 |
<?php |
require('/etc/freeradius-web/config.php'); |
require('../lib/functions.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>Unauthorized Service Usage History for $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" : "0001-01-01 00:00:00"; |
$now_str = da_sql_escape_string($now_str); |
$prev_str = da_sql_escape_string($prev_str); |
$num = 0; |
$pagesize = ($pagesize) ? $pagesize : 10; |
if (!is_numeric($pagesize) && $pagesize != 'all') |
$pagesize = 10; |
$limit = ($pagesize == 'all') ? '' : "$pagesize"; |
$selected[$pagesize] = 'selected'; |
$login = ($login != '') ? $login : 'anyone'; |
$usercheck = ($login == 'anyone') ? "LIKE '%'" : "= '$login'"; |
$order = ($order != '') ? $order : $config[general_accounting_info_order]; |
if ($order != 'desc' && $order != 'asc') |
$order = 'desc'; |
$selected[$order] = 'selected'; |
echo <<<EOM |
<head> |
<title>Unauthorized Service Usage History for $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> |
EOM; |
if ($login != 'anyone'){ |
echo <<<EOM |
<table border=0 width=400 cellpadding=0 cellspacing=2> |
EOM; |
include("../html/user_toolbar.html.php"); |
print <<<EOM |
</table> |
EOM; |
} |
if ($do_delete == 1 && ($row_id != 0 && is_numeric($row_id))){ |
$link = da_sql_connect($config); |
if ($link){ |
$search = da_sql_query($link,$config, |
"SELECT id,admin FROM $config[sql_badusers_table] |
WHERE id = '$row_id';"); |
if ($search){ |
$row = da_sql_fetch_array($search,$config); |
if ($row[id] == $row_id){ |
$admin = "$row[admin]"; |
if (($admin != '-' && $_SERVER["PHP_AUTH_USER"] == $admin) || $admin == '-'){ |
$sql_servers = array(); |
if ($config[sql_extra_servers] != '') |
$sql_servers = explode(' ',$config[sql_extra_servers]); |
$sql_servers[] = $config[sql_server]; |
foreach ($sql_servers as $server){ |
$link2 = da_sql_host_connect($server,$config); |
if ($link2){ |
$r = da_sql_query($link2,$config, |
"DELETE FROM $config[sql_badusers_table] |
WHERE id = '$row_id';"); |
if (!$r) |
echo "<b>SQL Error:" . da_sql_error($link2,$config) . "</b><br>\n"; |
da_sql_close($link2,$config); |
} |
else |
echo "<b>SQL Error: Could not connect to SQL database: $server</b><br>\n"; |
} |
} |
} |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
da_sql_close($link,$config); |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
} |
echo <<<EOM |
<br><br> |
<table border=0 width=740 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">Unauthorized Service Usage History for $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> |
<b>$prev_str</b> up to <b>$now_str</b> |
<form action="badusers.php" method="get" name="master"> |
<input type=hidden name=do_delete value=0> |
<input type=hidden name=row_id value=0> |
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>user</th><th>date</th><th>admin</th><th>reason</th><th>administrator action</th> |
</tr> |
<?php |
$auth_user = $_SERVER["PHP_AUTH_USER"]; |
if ($config[general_restrict_badusers_access] == 'yes'){ |
$auth_user = da_sql_escape_string($auth_user); |
$extra_query = "AND admin == '$auth_user'"; |
} |
$link = da_sql_pconnect($config); |
if ($link){ |
$search = da_sql_query($link,$config, |
"SELECT " . da_sql_limit($limit,0,$config) . " * FROM $config[sql_badusers_table] |
WHERE username $usercheck $extra_query AND incidentdate <= '$now_str' |
AND incidentdate >= '$prev_str' " . da_sql_limit($limit,1,$config) . |
" ORDER BY incidentdate $order " . da_sql_limit($limit,2,$config) . " ;"); |
if ($search){ |
while( $row = da_sql_fetch_array($search,$config) ){ |
$num++; |
$id = $row[id]; |
$user = "$row[username]"; |
$User = urlencode($user); |
$date = "$row[incidentdate]"; |
$reason = "$row[reason]"; |
$admin = "$row[admin]"; |
if ($admin == $auth_user || $admin == '-') |
$action = "<td><input type=submit class=button value=\"Delete\" OnClick=\"this.form.do_delete.value=1;this.form.row_id.value=$id\"></td>"; |
else |
$action = "<td>-</td>"; |
if ($admin == '') |
$admin = '-'; |
if ($reason == '') |
$reason = '-'; |
echo <<<EOM |
<tr align=center> |
<td>$num</td> |
<td><a href="user_admin.php?login=$User" title="Edit user $user">$user</a></td> |
<td>$date</td> |
<td>$admin</td> |
<td>$reason</td> |
$action |
</tr> |
EOM; |
} |
} |
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="center"> |
<table border=0> |
<tr><td colspan=6></td> |
<td rowspan=3 valign="bottom"> |
<small> |
the <b>from</b> date matches any login after the 00:00 that day, |
and the <b>to</b> date any login before the 23:59 that day. |
the default values shown are the <b>current week</b>. |
</td> |
</tr> |
<tr valign="bottom"> |
<td><small><b>user</td><td><small><b>from date</td><td><small><b>to date</td><td><small><b>pagesize</td><td><b>order</td> |
</td> |
<tr valign="middle"><td> |
<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">all |
</select> |
</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> |
</table></td></tr></form> |
</table> |
</tr> |
</table> |
</body> |
</html> |
/web/acc/manager/htdocs/clear_opensessions.php |
---|
3,6 → 3,7 |
if (is_file("../lib/langues.php")) |
include("../lib/langues.php"); |
require('/etc/freeradius-web/config.php'); |
if(!isset($clear_sessions)) $clear_sessions = 0; |
if (is_file("../lib/$config[general_lib_type]/user_info.php")) |
include("../lib/$config[general_lib_type]/user_info.php"); |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php")) |
32,7 → 33,7 |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>$l_users_managment</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
<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> |
63,7 → 64,7 |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
EOM; |
if ($clear_sessions == 1) |
{ |
# close active sessions |
71,10 → 72,10 |
# delete open accounting sessions |
$now = time(); |
$today_now = date("Y-m-d H:i:s",$now); |
$link = @da_sql_pconnect($config); |
$link = da_sql_pconnect($config); |
if ($link) |
{ |
$res = @da_sql_query($link,$config, |
$res = da_sql_query($link,$config, |
"UPDATE $config[sql_accounting_table] SET acctstoptime = '$today_now', acctterminatecause='Admin-Reset' |
WHERE username='$login' AND acctstoptime IS NULL;"); |
if (! $res) |
85,13 → 86,13 |
} |
# Count of accounting open sessions (in database) |
$open_accnt_sessions = 0; |
$link = @da_sql_pconnect($config); |
$link = da_sql_pconnect($config); |
if ($link){ |
$search = @da_sql_query($link,$config, |
$search = da_sql_query($link,$config, |
"SELECT COUNT(*) AS counter FROM $config[sql_accounting_table] |
WHERE username = '$login' AND acctstoptime IS NULL;"); |
if ($search){ |
if ($row = @da_sql_fetch_array($search,$config)) |
if ($row = da_sql_fetch_array($search,$config)) |
$open_accnt_sessions = $row['counter']; |
} |
else |
/web/acc/manager/htdocs/find.php |
---|
3,6 → 3,26 |
if (is_file("../lib/langues.php")) |
include("../lib/langues.php"); |
require('/etc/freeradius-web/config.php'); |
if(!isset($selected)) |
{ |
$selected['username'] = ''; |
$selected['name'] = ''; |
$selected['department'] = ''; |
$selected['radius'] = ''; |
$selected['Expiration'] = ''; |
$selected['Max-All-Session'] = ''; |
$selected['Session-Timeout'] = ''; |
$selected['Max-Daily-Session'] = ''; |
$selected['Max-Monthly-Session'] = ''; |
$selected['Simultaneous-Use'] = ''; |
$selected['Login-Time'] = ''; |
$selected['ChilliSpot-Max-Input-Octets'] = ''; |
$selected['ChilliSpot-Max-Total-Octets'] = ''; |
$selected['ChilliSpot-Bandwidth-Max-Up'] = ''; |
$selected['ChilliSpot-Bandwidth-Max-Down'] = ''; |
$selected['ChilliSpot-Max-Output-Octets'] = ''; |
$selected['WISPr-Redirection-URL'] = ''; |
} |
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;} |
16,7 → 36,7 |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th><?php echo "$l_users_managment";?></th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
<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> |
46,6 → 66,7 |
include("../lib/$config[general_lib_type]/find.php"); |
if (isset($found_users)){ |
$num = 0; |
$msg =''; |
$msg .= <<<EOM |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
75,7 → 96,7 |
<a href="user_delete.php?login=$User" title="$l_remove"><img src=/images/state_error.gif></a></td><td> |
EOM; |
if (isset($member_groups)) foreach ($member_groups as $group) { $msg .= "$group";} |
else $msg .= " "; |
else $msg .= " "; |
$msg .= "</td>"; |
} |
$msg .= "</tr></table>\n"; |
121,57 → 142,57 |
foreach($show_attrs as $key => $desc) |
switch ($key) |
{ |
case 'Simultaneous-Use' : |
case 'Simultaneous-Use' : |
$desc=$l_simultaneous_use; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
break; |
case 'Max-All-Session' : |
$desc=$l_max_all_session; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
break; |
case 'Session-Timeout' : |
case 'Session-Timeout' : |
$desc=$l_session_timeout; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
break; |
case 'Max-Daily-Session' : |
$desc=$l_daily_timeout; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
break; |
case 'Max-Monthly-Session' : |
$desc=$l_monthly_timeout; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
break; |
case 'Login-Time' : |
case 'Login-Time' : |
$desc=$l_login_time; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
break; |
case 'Expiration' : |
$desc=$l_expiration; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
break; |
case 'ChilliSpot-Max-Input-Octets' : |
$desc=$l_max_input_octets; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
break; |
case 'ChilliSpot-Max-Output-Octets' : |
$desc=$l_max_output_octets; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
break; |
case 'ChilliSpot-Max-Total-Octets' : |
$desc=$l_max_total_octets; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
break; |
case 'ChilliSpot-Bandwidth-Max-Up' : |
$desc=$l_max_bandwidth_up; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
break; |
case 'ChilliSpot-Bandwidth-Max-Down' : |
$desc=$l_max_bandwidth_down; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
break; |
case 'WISPr-Redirection-URL' : |
$desc=$l_wispr_redirection; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
echo "<option $selected[$key] value=\"$key\">$desc\n"; |
break; |
} |
echo <<<EOM |
197,7 → 218,7 |
<td> |
<input type=text name="max_results" value="<?php echo $max ?>" size=25> |
</td> |
</tr> --> |
</tr> --> |
</table> |
<br> |
<input type=submit class=button value="<?php echo"$l_search";?>" OnClick="this.form.find_user.value=1"> |
/web/acc/manager/htdocs/group_admin.php |
---|
3,11 → 3,11 |
if (is_file("../lib/langues.php")) |
include("../lib/langues.php"); |
require('/etc/freeradius-web/config.php'); |
if ($show == 1 && isset($del_members)){ |
if (isset($show) && $show == 1 && isset($del_members)){ |
header("Location: user_admin.php?login=$del_members[0]"); |
exit; |
} |
if ($config[general_lib_type] != 'sql'){ |
if ($config['general_lib_type'] != 'sql'){ |
echo <<<EOM |
<title>Admin_groups</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
28,7 → 28,7 |
if ($group_exists == 'no'){ |
echo <<<EOM |
<title>Admin_groups</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<meta http-equiv="Content-Type" content="text/html" charset="$config[general_charset]"> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
36,7 → 36,7 |
<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> |
<b> n''existe pas</b><br> |
<input type=submit class=button value="Show Group"> |
</body> |
</html> |
49,13 → 49,13 |
<html> |
<head> |
<title>Admin_groups</title> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<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_groups_managment"; ?></th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
<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> |
84,7 → 84,7 |
<tr><td> |
<?php |
if ($do_changes == 1){ |
if (isset($do_changes) && $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")) |
91,7 → 91,7 |
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> |
102,7 → 102,7 |
<?php echo "$l_group_members_to_remove";?> |
</td> |
<td> |
<select name=del_members[] multiple size=5> |
<select name=del_members[] multiple size=5> |
<?php |
foreach ($group_members as $member){ |
echo "<option value=\"$member\">$member\n"; |
/web/acc/manager/htdocs/group_new.php |
---|
1,11 → 1,36 |
<?php |
if (!isset ($create)) $create=0; |
if (!isset ($login)) $login=''; |
if (!isset ($selected)) $selected=array(); |
/*if(!isset($selected)) |
{ |
$selected['username'] = ''; |
$selected['name'] = ''; |
$selected['department'] = ''; |
$selected['radius'] = ''; |
$selected['Expiration'] = ''; |
$selected['Max-All-Session'] = ''; |
$selected['Session-Timeout'] = ''; |
$selected['Max-Daily-Session'] = ''; |
$selected['Max-Monthly-Session'] = ''; |
$selected['Simultaneous-Use'] = ''; |
$selected['Login-Time'] = ''; |
$selected['ChilliSpot-Max-Input-Octets'] = ''; |
$selected['ChilliSpot-Max-Total-Octets'] = ''; |
$selected['ChilliSpot-Bandwidth-Max-Up'] = ''; |
$selected['ChilliSpot-Bandwidth-Max-Down'] = ''; |
$selected['ChilliSpot-Max-Output-Octets'] = ''; |
$selected['WISPr-Redirection-URL'] = ''; |
}*/ |
//Gestion de la langue |
if (is_file("../lib/langues.php")) |
include("../lib/langues.php"); |
require('/etc/freeradius-web/config.php'); |
if ($config[general_lib_type] != 'sql'){ |
if ($config['general_lib_type'] != 'sql'){ |
echo <<<EOM |
<title>$l_title</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
24,9 → 49,11 |
require('../lib/defaults.php'); |
require("../lib/$config[general_lib_type]/group_info.php"); |
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){ |
if ($config['general_lib_type'] == 'sql' && $config['sql_use_operators'] == 'true'){ |
$colspan=2; |
$show_ops=1; |
include_once("../lib/operators.php"); |
if(!isset($selected[$op_eq])) $selected[$op_eq] = ''; |
}else{ |
$show_ops = 0; |
$colspan=1; |
41,7 → 68,7 |
<script type="text/javascript" src="/js/fonctions.js"></script> |
<script language="javascript" type="text/javascript"> |
/*Insertion du calendrier*/ |
var dp_cal; |
var dp_cal; |
window.onload = function () { |
dp_cal = new Epoch('epoch_popup','popup',document.getElementById('popup_container')); |
}; |
51,7 → 78,7 |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th><? echo "$l_groups_managment"; ?></th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
<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> |
72,7 → 99,7 |
<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"); |
105,7 → 132,7 |
if (!isset($existing_groups)) |
echo "<b>$l_group_empty</b>\n"; |
else{ |
echo "<select name=\"existing_groups\">\n"; |
echo "<select name=\"existing_groups\">\n"; |
foreach ($existing_groups as $group => $count) |
echo "<option value=\"$group\">$group\n"; |
echo "</select>\n"; |
127,7 → 154,7 |
<textarea name=members cols="50" wrap="PHYSICAL" rows=5></textarea> |
</td> |
</tr> |
EOM; |
foreach($show_attrs as $key => $desc){ |
$name = $attrmap["$key"]; |
134,11 → 161,17 |
if ($name == 'none') |
continue; |
$oper_name = $name . '_op'; |
$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0]; |
if(isset($item_vals["$key"][0]) && $item_vals["$key"][0] != ''){ |
$val = $item_vals["$key"][0]; |
} else if(isset($default_vals["$key"][0])) { |
$val = $default_vals["$key"][0]; |
} else { |
$val = ''; |
} |
switch ($key) |
{ |
// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.) |
case 'Simultaneous-Use' : |
// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.) |
case 'Simultaneous-Use' : |
$advanced=1; |
$help_link="help/simultaneous_use_help.html"; |
$desc=$l_simultaneous_use; |
148,7 → 181,7 |
$help_link="help/max_all_session_help.html"; |
$desc=$l_max_all_session; |
break; |
case 'Session-Timeout' : |
case 'Session-Timeout' : |
$advanced=1; |
$help_link="help/session_timeout_help.html"; |
$desc=$l_session_timeout; |
163,7 → 196,7 |
$help_link="help/session_timeout_help.html"; |
$desc=$l_monthly_timeout; |
break; |
case 'Login-Time' : |
case 'Login-Time' : |
$advanced=1; |
$help_link="help/login_time_help.html"; |
$desc=$l_login_time; |
228,12 → 261,12 |
</td> |
EOM; |
switch ($key){ |
case 'Simultaneous-Use' : |
case 'Simultaneous-Use' : |
case 'Max-All-Session' : |
case 'Max-Daily-Session' : |
case 'Max-Weekly-Session' : |
case 'Max-Monthly-Session' : |
case 'Login-Time' : |
case 'Login-Time' : |
case 'Expiration' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
272,9 → 305,9 |
break; |
} |
} |
/* |
Ajout du choix d'unité (pour les durées limites de session, journée et de mois) |
/* |
Ajout du choix d'unité (pour les durées limites de session, journée et de mois) |
et d'un calendrier pour la date d'expiration |
Sauf dans le cas de la visualisation |
*/ |
282,9 → 315,9 |
if ($create==0 ){ |
switch ($name){ |
/* |
Choix de l'unité heures, minutes ou secondes |
pour les durées limites de session,journée et de mois |
*/ |
Choix de l'unité heures, minutes ou secondes |
pour les durées limites de session,journée et de mois |
*/ |
case 'Session-Timeout' : |
case 'Max-Daily-Session' : |
case 'Max-Monthly-Session' : |
/web/acc/manager/htdocs/images/arrow.gif |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/web/acc/manager/htdocs/images/bg.gif |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/web/acc/manager/htdocs/images/black.gif |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/web/acc/manager/htdocs/images/greenlines1.gif |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/web/acc/manager/htdocs/images/logo2.gif |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/web/acc/manager/htdocs/images/pixel.gif |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/web/acc/manager/htdocs/images/title2.gif |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/web/acc/manager/htdocs/show_groups.php |
---|
10,7 → 10,7 |
echo <<<EOM |
<html> |
<title>Find group</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<meta http-equiv="Content-Type" content="text/html" charset="$config[general_charset]"> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
<body> |
21,11 → 21,11 |
EOM; |
exit(); |
} |
if ($config[general_lib_type] != 'sql'){ |
if ($config['general_lib_type'] != 'sql'){ |
echo <<<EOM |
<html> |
<title>find group</title> |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
<meta http-equiv="Content-Type" content="text/html" charset="$config[general_charset]"> |
<link rel="stylesheet" href="style.css"> |
</head> |
<body> |
45,7 → 45,7 |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th><?php echo "$l_groups_managment"; ?></th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
<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> |
/web/acc/manager/htdocs/user_accounting.php |
---|
2,6 → 2,17 |
//gestion de la langue |
if (is_file("../lib/langues.php")) |
include("../lib/langues.php"); |
if(!isset($selected['5'])) $selected['5'] = ''; |
if(!isset($selected['10'])) $selected['10'] = ''; |
if(!isset($selected['15'])) $selected['15'] = ''; |
if(!isset($selected['20'])) $selected['20'] = ''; |
if(!isset($selected['40'])) $selected['40'] = ''; |
if(!isset($selected['80'])) $selected['80'] = ''; |
if(!isset($selected['all'])) $selected['all'] = ''; |
if(!isset($selected['asc'])) $selected['asc'] = ''; |
if(!isset($selected['desc'])) $selected['desc'] = ''; |
require('/etc/freeradius-web/config.php'); |
require('../lib/functions.php'); |
require('../lib/sql/functions.php'); |
29,20 → 40,22 |
} |
$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 ); |
$now_str = (isset($now_str) && $now_str != '') ? "$now_str" : date($config['sql_date_format'],$now + 86400); |
$prev_str = (isset($prev_str) && $prev_str != '') ? "$prev_str" : date($config['sql_date_format'], $now - 604800 ); |
$num = 0; |
$pagesize = ($pagesize) ? $pagesize : 10; |
$pagesize = (isset($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]; |
$order = (isset($order) && $order != '') ? $order : $config['general_accounting_info_order']; |
if ($order != 'desc' && $order != 'asc') |
$order = 'desc'; |
$selected[$order] = 'selected'; |
$now_str = mysql_escape_string($now_str); |
$prev_str = mysql_escape_string($prev_str); |
$link = da_sql_pconnect($config); |
$now_str = da_sql_escape_string($link, $now_str); |
$prev_str = da_sql_escape_string($link, $prev_str); |
//$now_str = da_sql_escape_string($now_str); |
//$prev_str = da_sql_escape_string($prev_str); |
61,7 → 74,7 |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>$l_users_managment</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
<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> |
99,53 → 112,55 |
<td><b>#</b></td> |
<?php |
for($i=1;$i<=9;$i++){ |
if (($acct_attrs['ua']["$i"] != '') && ($acct_attrs['ua']["$i"] != 'server') && ($acct_attrs['ua']["$i"] != 'callerid')) |
if (isset($acct_attrs['ua']["$i"]) && ($acct_attrs['ua']["$i"] != '') && ($acct_attrs['ua']["$i"] != 'server') && ($acct_attrs['ua']["$i"] != 'callerid')) |
echo "<td><b>" . $acct_attrs['ua']["$i"] . "</b></td>\n"; |
} |
$sql_extra_query = ''; |
if ($config[sql_accounting_extra_query] != '') |
$sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config); |
if (isset($config['sql_accounting_extra_query']) && $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, |
$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) ){ |
$acct_sessiontime_sum = 0; |
$acct_upload_sum = 0; |
$acct_download_sum = 0; |
while( $row = da_sql_fetch_array($search,$config) ){ |
$num++; |
$acct_type = "$row[framedprotocol]/$row[nasporttype]"; |
if ($acct_type == '') |
$acct_type = '-'; |
$acct_logedin = $row[acctstarttime]; |
$acct_sessiontime = $row[acctsessiontime]; |
$acct_logedin = $row['acctstarttime']; |
$acct_sessiontime = $row['acctsessiontime']; |
$acct_sessiontime_sum += $acct_sessiontime; |
$acct_sessiontime = time2str($acct_sessiontime); |
$acct_ip = $row[framedipaddress]; |
$acct_ip = $row['framedipaddress']; |
if ($acct_ip == '') |
$acct_ip = '-'; |
$acct_upload = $row[acctinputoctets]; |
$acct_upload = $row['acctinputoctets']; |
$acct_upload_sum += $acct_upload; |
$acct_upload = bytes2str($acct_upload); |
$acct_download = $row[acctoutputoctets]; |
$acct_download = $row['acctoutputoctets']; |
$acct_download_sum += $acct_download; |
$acct_download = bytes2str($acct_download); |
$acct_server = $row[nasipaddress]; |
$acct_server = $row['nasipaddress']; |
if ($acct_server != ''){ |
$acct_server = $da_name_cache[$row[nasipaddress]]; |
$acct_server = (isset($da_name_cache)) ? $da_name_cache[$row['nasipaddress']] : null; |
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; |
$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; |
$da_name_cache[$row['nasipaddress']] = $acct_server; |
} |
} |
else |
154,29 → 169,29 |
$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)) |
if (preg_match('/Login-Incorrect/',$acct_terminate_cause) || |
preg_match('/Multiple-Logins/', $acct_terminate_cause) || preg_match('/Invalid-User/',$acct_terminate_cause)) |
$acct_callerid = "$row[callingstationid]"; |
if ($acct_callerid == '') |
if (!isset($acct_callerid) || $acct_callerid == '') |
$acct_callerid = '-'; |
echo <<<EOM |
<tr align=center> |
<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"; |
if (isset($acct_attrs['ua'][1]) && $acct_attrs['ua'][1] != '') echo "<td>$acct_type</td>\n"; |
if (isset($acct_attrs['ua'][2]) && $acct_attrs['ua'][2] != '') echo "<td>$acct_logedin</td>\n"; |
if (isset($acct_attrs['ua'][3]) && $acct_attrs['ua'][3] != '') echo "<td>$acct_sessiontime</td>\n"; |
if (isset($acct_attrs['ua'][4]) && $acct_attrs['ua'][4] != '') echo "<td>$acct_ip</td>\n"; |
if (isset($acct_attrs['ua'][5]) && $acct_attrs['ua'][5] != '') echo "<td>$acct_upload</td>\n"; |
if (isset($acct_attrs['ua'][6]) && $acct_attrs['ua'][6] != '') echo "<td>$acct_download</td>\n"; |
// if (isset($acct_attrs['ua'][7]) && $acct_attrs[ua][7] != '') echo "<td>$acct_server</td>\n"; |
if (isset($acct_attrs['ua'][8]) && $acct_attrs['ua'][8] != '') echo "<td>$acct_terminate_cause</td>\n"; |
// if (isset($acct_attrs['ua'][9]) && $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); |
$acct_sessiontime_sum = (isset($acct_sessiontime_sum)) ? time2str($acct_sessiontime_sum) : "0 seconds"; |
$acct_upload_sum = (isset($acct_upload_sum)) ? bytes2str($acct_upload_sum) : "0.00 KBs"; |
$acct_download_sum = (isset($acct_download_sum)) ? bytes2str($acct_download_sum) : "0.00 KBs"; |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
184,21 → 199,21 |
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--; |
if (!isset($acct_attrs['ua'][1]) || $acct_attrs['ua'][1] == ''){ |
$colspan--;} |
if (!isset($acct_attrs['ua'][2]) || $acct_attrs['ua'][2] == ''){ |
$colspan--;} |
echo <<<EOM |
<tr bgcolor="lightyellow" align="center"> |
<td colspan=$colspan><b>Total</b></td> |
EOM; |
if ($acct_attrs[ua][3] != '') echo "<td><b>$acct_sessiontime_sum</b></td>\n"; |
if ($acct_attrs[ua][4] != '') echo "<td> </td>\n"; |
if ($acct_attrs[ua][5] != '') echo "<td><b>$acct_upload_sum</b></td>\n"; |
if ($acct_attrs[ua][6] != '') echo "<td><b>$acct_download_sum</b></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"; |
if (isset($acct_attrs['ua'][3]) && $acct_attrs['ua'][3] != '') echo "<td><b>$acct_sessiontime_sum</b></td>\n"; |
if (isset($acct_attrs['ua'][4]) && $acct_attrs['ua'][4] != '') echo "<td> </td>\n"; |
if (isset($acct_attrs['ua'][5]) && $acct_attrs['ua'][5] != '') echo "<td><b>$acct_upload_sum</b></td>\n"; |
if (isset($acct_attrs['ua'][6]) && $acct_attrs['ua'][6] != '') echo "<td><b>$acct_download_sum</b></td>\n"; |
// if (isset($acct_attrs['ua'][7]) && $acct_attrs['ua'][7] != '') echo "<td> </td>\n"; |
if (isset($acct_attrs['ua'][8]) && $acct_attrs['ua'][8] != '') echo "<td> </td>\n"; |
// if (isset($acct_attrs['ua'][9]) && $acct_attrs['ua'][9] != '') echo "<td> </td>\n"; |
?> |
</tr> |
</table> |
/web/acc/manager/htdocs/user_admin.php |
---|
51,16 → 51,51 |
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]; |
if(isset($item_vals['Max-Monthly-Session'][0]) && $item_vals['Max-Monthly-Session'][0] != ''){ |
$monthly_limit = $item_vals['Max-Monthly-Session'][0]; |
} else if (isset($default_vals['Max-Monthly-Session'][0])){ |
$monthly_limit = $default_vals['Max-Monthly-Session'][0]; |
} else { |
$monthly_limit = ''; |
} |
$monthly_limit = ($monthly_limit) ? $monthly_limit : $config['counter_default_monthly']; |
if(isset($item_vals['Max-Weekly-Session'][0]) && $item_vals['Max-Weekly-Session'][0] != ''){ |
$weekly_limit = $item_vals['Max-Weekly-Session'][0]; |
} else if (isset($default_vals['Max-Weekly-Session'][0])){ |
$weekly_limit = $default_vals['Max-Weekly-Session'][0]; |
} else { |
$weekly_limit = ''; |
} |
$weekly_limit = ($weekly_limit) ? $weekly_limit : $config['counter_default_weekly']; |
if(isset($item_vals['Max-Daily-Session'][0]) && $item_vals['Max-Daily-Session'][0] != ''){ |
$daily_limit = $item_vals['Max-Daily-Session'][0]; |
} else if (isset($default_vals['Max-Daily-Session'][0])){ |
$daily_limit = $default_vals['Max-Daily-Session'][0]; |
} else { |
$daily_limit = ''; |
} |
$daily_limit = ($daily_limit) ? $daily_limit : $config['counter_default_daily']; |
if(isset($item_vals['Session-Timeout'][0]) && $item_vals['Session-Timeout'][0] != ''){ |
$session_limit = $item_vals['Session-Timeout'][0]; |
} else if (isset($default_vals['Session-Timeout'][0])){ |
$session_limit = $default_vals['Session-Timeout'][0]; |
} else { |
$session_limit = ''; |
} |
$session_limit = ($session_limit) ? $session_limit : 'none'; |
$total_limit = ($item_vals['Max-All-Session'][0] != '') ? $item_vals['Max-All-Session'][0] : $default_vals['Max-All-Session'][0]; |
if(isset($item_vals['Max-All-Session'][0]) && $item_vals['Max-All-Session'][0] != ''){ |
$total_limit = $item_vals['Max-All-Session'][0]; |
} else if (isset($default_vals['Max-All-Session'][0])){ |
$total_limit = $default_vals['Max-All-Session'][0]; |
} else { |
$total_limit = ''; |
} |
$total_limit = ($total_limit) ? $total_limit : 'none'; |
$remaining = 'unlimited time'; |
$log_color = 'green'; |
69,12 → 104,12 |
$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); |
$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); |
$days[$i] = date($config['sql_date_format'],$now_tmp); |
$now_tmp -= 86400; |
} |
$day++; |
82,7 → 117,7 |
$now -= 604800; |
$now += 86400; |
for ($i = $day; $i <= 6; $i++){ |
$days[$i] = date($config[sql_date_format],$now); |
$days[$i] = date($config['sql_date_format'],$now); |
// $now -= 86400; |
$now += 86400; |
} |
91,9 → 126,9 |
$extra_msg = ''; |
$used = array('-','-','-','-','-','-','-'); |
$link = @da_sql_pconnect($config); |
$link = da_sql_pconnect($config); |
if ($link){ |
$search = @da_sql_query($link,$config, |
$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, |
104,38 → 139,38 |
$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]; |
$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, |
$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]; |
$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, |
if ($monthly_limit != 'none' || (isset($config['counter_monthly_calculate_usage']) && $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]; |
$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, |
$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 |
142,8 → 177,8 |
acctterminatecause LIKE 'Invalid-User%' OR |
acctterminatecause LIKE 'Multiple-Logins%');"); |
if ($search){ |
$row = @da_sql_fetch_array($search,$config); |
$tot_badlogins = $row[counter]; |
$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"; |
150,19 → 185,19 |
for($i = 0; $i <=6; $i++){ |
if ($days[$i] == '') |
continue; |
$search = @da_sql_query($link,$config, |
$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]; |
$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]; |
$daily_used = $row['sum_sess_time']; |
if ($daily_limit != 'none'){ |
$remaining = $daily_limit - $daily_used; |
if ($remaining <=0) |
207,7 → 242,7 |
$remaining = $tmp; |
$log_color = ($remaining) ? 'green' : 'red'; |
} |
if ($monthly_limit != 'none' || $config[counter_monthly_calculate_usage] == 'true'){ |
if ($monthly_limit != 'none' || (isset($config['counter_monthly_calculate_usage']) && $config['counter_monthly_calculate_usage'] == 'true')){ |
$monthly_used = time2str($monthly_used); |
if ($monthly_limit != 'none' && !$tmp) |
$monthly_used = "<font color=red>$monthly_used</font>"; |
219,14 → 254,14 |
$remaining = $session_limit; |
} |
$search = @da_sql_query($link,$config, |
$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)){ |
if (da_sql_num_rows($search,$config)){ |
$logged_now = 1; |
$row = @da_sql_fetch_array($search,$config); |
$row = da_sql_fetch_array($search,$config); |
$lastlog_time = $row['acctstarttime']; |
$lastlog_server_ip = $row['nasipaddress']; |
$lastlog_server_port = $row['nasportid']; |
235,11 → 270,11 |
$remaining = $remaining - $lastlog_session_time; |
if ($remaining < 0) |
$remaining = 0; |
$log_color = ($remaining) ? 'green' : 'red'; |
$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_client_ip = $row['framedipaddress']; |
$lastlog_server_name = @gethostbyaddr($lastlog_server_ip); |
$lastlog_client_name = @gethostbyaddr($lastlog_client_ip); |
$lastlog_callerid = $row['callingstationid']; |
259,19 → 294,19 |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
if (! $logged_now){ |
$search = @da_sql_query($link,$config, |
if (!isset($logged_now) || !$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); |
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_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']; |
307,7 → 342,7 |
$msg =<<<EON |
$l_user_remain_login<font color="$log_color"> <b>$remaining $extra_msg</b></font> |
EON; |
$lock_msg = $item_vals['Dialup-Lock-Msg'][0]; |
$lock_msg = (isset($item_vals['Dialup-Lock-Msg'][0])) ? $item_vals['Dialup-Lock-Msg'][0] : ''; |
if ($lock_msg != '') |
$descr =<<<EON |
<font color=red><b>$lock_msg </b</font> |
315,7 → 350,7 |
else |
$descr = '-'; |
$expiration = $default_vals['Expiration'][0]; |
$expiration = isset($default_vals['Expiration'][0]) ? $default_vals['Expiration'][0] : ''; |
if ($item_vals['Expiration'][0] != '') |
$expiration = $item_vals['Expiration'][0]; |
if ($expiration != ''){ |
/web/acc/manager/htdocs/user_delete.php |
---|
3,6 → 3,7 |
if (is_file("../lib/langues.php")) |
include("../lib/langues.php"); |
require('/etc/freeradius-web/config.php'); |
if (!isset($type)) $type = 'user'; |
if ($type != 'group'){ |
if (is_file("../lib/$config[general_lib_type]/user_info.php")) |
include("../lib/$config[general_lib_type]/user_info.php"); |
19,6 → 20,9 |
<head> |
EOM; |
if (!isset($user_type)) $user_type = 'user'; |
if (!isset($delete_user)) $delete_user = 0; |
if ($user_type != 'group'){ |
$util = $l_user; |
$title = $l_users_managment;} |
34,7 → 38,7 |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>$title</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
<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> |
68,7 → 72,7 |
<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")) |
75,7 → 79,7 |
include("../lib/$config[general_lib_type]/delete_user.php"); |
} |
else{ |
if ($delete_users_of_group == 1){ |
if (isset($delete_users_of_group) && $delete_users_of_group == 1){ |
unset($group_members); |
$tmp_group_name=$login; |
if (is_file("../lib/$config[general_lib_type]/group_info.php")){ |
/web/acc/manager/htdocs/user_edit.php |
---|
5,10 → 5,16 |
require('/etc/freeradius-web/config.php'); |
require('../lib/attrshow.php'); |
require('../lib/defaults.php'); |
if(!isset($change)) $change = 0; |
if(!isset($user_type)) $user_type = 'user'; |
if(!isset($badusers)) $badusers = 0; |
if(!isset($cn)) $cn = ''; |
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'){ |
if ($config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){ |
$saved_login = $login; |
$login = ''; |
if (is_file("../lib/sql/group_info.php")) |
20,7 → 26,7 |
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'){ |
if ($config['general_lib_type'] == 'sql' && $config['sql_use_operators'] == 'true'){ |
$colspan=2; |
$show_ops = 1; |
include("../lib/operators.php"); |
33,7 → 39,7 |
<html> |
<head> |
<title>Users & groups edition</title> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<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' |
51,7 → 57,7 |
<script type="text/javascript" src="/js/epoch_classes.js"></script> |
<script language="javascript" type="text/javascript"> |
/*Insertion du calendrier */ |
var dp_cal; |
var dp_cal; |
window.onload = function () { |
dp_cal = new Epoch('epoch_popup','popup',document.getElementById('popup_container')); |
}; |
62,10 → 68,10 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th> |
<?php |
if ($user_type != 'group'){ echo "$l_users_managment";} else{ echo "$l_groups_managment";} |
if($user_type != 'group'){ echo "$l_users_managment";} else{ echo "$l_groups_managment";} |
?> |
</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
<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> |
73,16 → 79,13 |
<center> |
<table border=0 width=640 cellpadding=0 cellspacing=2> |
<?php |
if ($user_type != 'group') |
{ |
if ($user_type != 'group'){ |
include("../html/user_toolbar.html.php"); |
$titre=$l_user; |
} |
else |
{ |
}else{ |
include("../html/group_toolbar.html.php"); |
$titre=$l_group; |
} |
} |
print <<<EOM |
</table> |
<br> |
100,17 → 103,17 |
<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 != '' |
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'){ |
if ($group_change && $config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){ |
include("../lib/sql/group_change.php"); |
include("../lib/defaults.php"); |
} |
134,7 → 137,7 |
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 ?>> |
145,7 → 148,7 |
<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'){ |
if ($user_type != 'group' && $config['general_show_user_password'] != 'no'){ |
echo <<<EOM |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
163,7 → 166,7 |
} |
foreach($show_attrs as $key => $desc){ |
$name = $attrmap["$key"]; |
$generic = $attrmap[generic]["$key"]; |
$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : ''; |
if ($name == 'none') |
continue; |
unset($vals); |
170,17 → 173,17 |
unset($selected); |
unset($ops); |
$def_added = 0; |
if ($item_vals["$key"][count]){ |
for($i=0;$i<$item_vals["$key"][count];$i++){ |
if (isset($item_vals["$key"]['count']) && $item_vals["$key"]['count']){ |
for($i=0;$i<$item_vals["$key"]['count'];$i++){ |
$vals[] = $item_vals["$key"][$i]; |
$ops[] = $item_vals["$key"][operator][$i]; |
$ops[] = $item_vals["$key"]['operator'][$i]; |
} |
} |
else{ |
if ($default_vals["$key"][count]){ |
for($i=0;$i<$default_vals["$key"][count];$i++){ |
if (isset($default_vals["$key"]['count']) && $default_vals["$key"]['count']){ |
for($i=0;$i<$default_vals["$key"]['count'];$i++){ |
$vals[] = $default_vals["$key"][$i]; |
$ops[] = $default_vals["$key"][operator][$i]; |
$ops[] = $default_vals["$key"]['operator'][$i]; |
} |
} |
else{ |
190,20 → 193,20 |
$def_added = 1; |
} |
if ($generic == 'generic' && $def_added == 0){ |
for($i=0;$i<$default_vals["$key"][count];$i++){ |
for($i=0;$i<$default_vals["$key"]['count'];$i++){ |
$vals[] = $default_vals["$key"][$i]; |
$ops[] = $default_vals["$key"][operator][$i]; |
$ops[] = $default_vals["$key"]['operator'][$i]; |
} |
} |
if ($add && $name == $add_attr){ |
} |
if (isset($add) && $add && $name == $add_attr){ |
$vals[] = $default_vals["$key"][0]; |
$ops[] = ($default_vals["$key"][operator][0] != '') ? $default_vals["$key"][operator][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); |
$val = preg_replace('/\"/','"',$val); |
$oper_name = $name1 . '_op'; |
$oper = $ops[$i]; |
$selected[$oper] = 'selected'; |
210,8 → 213,8 |
$i++; |
switch ($key) |
{ |
// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.) |
case 'Simultaneous-Use' : |
// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.) |
case 'Simultaneous-Use' : |
$advanced=1; |
$help_link="help/simultaneous_use_help.html"; |
$desc=$l_simultaneous_use; |
221,7 → 224,7 |
$help_link="help/max_all_session_help.html"; |
$desc=$l_max_all_session; |
break; |
case 'Session-Timeout' : |
case 'Session-Timeout' : |
$advanced=1; |
$help_link="help/session_timeout_help.html"; |
$desc=$l_session_timeout; |
236,7 → 239,7 |
$help_link="help/session_timeout_help.html"; |
$desc=$l_monthly_timeout; |
break; |
case 'Login-Time' : |
case 'Login-Time' : |
$advanced=1; |
$help_link="help/login_time_help.html"; |
$desc=$l_login_time; |
291,12 → 294,13 |
<a href="$help_link" target=help onclick=window.open("$help_link","help","width=600,height=250,toolbar=no,scrollbars=no,resizable=yes") title="$l_click_for_help"><font color="blue">$desc</font></a> |
EOM; |
if ($show_ops){ |
if(!isset($selected[$op_eq])) $selected[$op_eq] = ''; |
switch ($key) |
{ |
case 'Simultaneous-Use' : |
case 'Simultaneous-Use' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=20></td>"; |
break; |
case 'Login-Time' : |
case 'Login-Time' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=20></td>"; |
break; |
case 'Expiration' : |
395,7 → 399,7 |
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'){ |
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"; |
411,7 → 415,7 |
else{ |
echo "aucun group</td></tr>"; |
} |
} |
} |
echo "</table><br>"; |
echo "<input type=submit class=button value=$l_change OnClick=\"this.form.change.value=1\">"; |
//if ($user_type != 'group'){ |
/web/acc/manager/htdocs/user_info.php |
---|
3,11 → 3,12 |
if (is_file("../lib/langues.php")) |
include("../lib/langues.php"); |
require('/etc/freeradius-web/config.php'); |
if(!isset($change)) $change = 0; |
?> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>"> |
<title>User personal information</title> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
14,7 → 15,7 |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th><?php echo "$l_users_managment";?></th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
<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> |
54,7 → 55,7 |
<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"> |
/web/acc/manager/htdocs/user_new.php |
---|
1,12 → 1,17 |
<?php |
<?php |
if (!isset ($create)) { $create=0; } |
if (!isset ($show)) { $show=0; } |
if (!isset ($create)) $create=0; |
if (!isset ($show)) $show=0; |
// ticket d'impression (thank's to Geoffroy MUSITELLI) |
//gestion de la langue |
if (is_file("../lib/langues.php")) |
include("../lib/langues.php"); |
if(!isset($login)) $login = ''; |
if(!isset($cn)) $cn = ''; |
if(!isset($mail)) $mail = ''; |
if(!isset($langue_imp)) $langue_imp = ''; |
require('/etc/freeradius-web/config.php'); |
if($show == 2) |
{ |
15,7 → 20,7 |
} |
require('../lib/attrshow.php'); |
require('../lib/defaults.php'); |
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){ |
if ($config['general_lib_type'] == 'sql' && $config['sql_use_operators'] == 'true'){ |
$colspan=2; |
$show_ops=1; |
}else{ |
24,7 → 29,7 |
} |
?> |
<html><head><title>Voucher creation</title> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>"> |
<link rel="stylesheet" href="/css/style.css"> |
<link rel="stylesheet" type="text/css" href="/css/epoch_styles.css" /> |
<script type="text/javascript" src="/js/epoch_classes.js"></script> |
32,7 → 37,7 |
<script language="javascript" type="text/javascript"> |
/*Insertion du calendrier */ |
var dp_cal; |
var dp_cal; |
window.onload = function () { |
dp_cal = new Epoch('epoch_popup','popup',document.getElementById('popup_container')); |
}; |
60,11 → 65,12 |
</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 |
<tr><td> |
<?php |
function sec_imp($time) |
/* Formatage des secondes avant l'impression */ |
{ |
/* Formatage des secondes avant l'impression */ |
{ |
$result = ''; |
$jour = 0;$heure = 0;$minute = 0;$seconde = 0; |
$jour = floor($time/86400); |
$reste = $time%86400; |
77,7 → 83,7 |
$seconde = $reste%60; |
if ($seconde!=0) $result = $result.$seconde.' s '; |
return $result; |
} |
} |
if ($create == 1){ |
if (is_file("../lib/$config[general_lib_type]/user_info.php")) |
92,7 → 98,7 |
include("../lib/$config[general_lib_type]/create_user.php"); |
/* Petit traitement pré-impression pour la lisibilité */ |
/* Récupération des attributs du groupe le cas échéant */ |
if ($group!=''){ |
if (isset($group) && $group!=''){ |
$saved_login = $login; |
$login = $group; |
if (is_file("../lib/sql/group_info.php")) |
103,7 → 109,7 |
if ($sto_imp==''){ $sto_imp='-';} |
else { $sto_imp=sec_imp($sto_imp);} |
if ($mas_imp==''){ $mas_imp='-';} |
else { $mas_imp=sec_imp($mas_imp);} |
else { $mas_imp=sec_imp($mas_imp);} |
if ($mds_imp==''){ $mds_imp='-';} |
else { $mds_imp=sec_imp($mds_imp);} |
if ($mms_imp==''){ $mms_imp='-';} |
110,9 → 116,9 |
else { $mms_imp=sec_imp($mms_imp);} |
/*Formatage de la date afin d'être lisible dans toute les langues 'jj mm yyyy'*/ |
if ($Expiration!=''){ $Expiration=date("d - m - Y",strtotime($Expiration));} |
else { $Expiration=$v_without;} |
else { $Expiration='-';} |
if ($show != 3) //utilisateur normal |
{ |
{ |
//Appel du ticket d'impression , passage en paramètres des valeurs à afficher |
echo' <form name="impression" method="post" action="ticket_user.php" target=_blank> |
<input type="hidden" name="langue_imp" value="'.$langue_imp.'"> |
142,7 → 148,7 |
<input type=hidden name=show value="0"> |
<input type=hidden name=langue_imp value='fr'> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<?php |
<?php |
if($create==0){ |
echo <<<EOM |
<tr> |
162,7 → 168,7 |
</td> |
</tr> |
EOM; |
if ($config[general_lib_type] == 'sql'){ |
if ($config['general_lib_type'] == 'sql'){ |
if (isset($member_groups)) |
$selected[$member_groups[0]] = 'selected'; |
echo <<<EOM |
182,8 → 188,8 |
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')){ |
if ($config['general_lib_type'] == 'ldap' || |
($config['general_lib_type'] == 'sql' && $config['sql_use_user_info_table'] == 'true')){ |
echo <<<EOM |
<tr> |
<td class="etiquette" colspan=$colspan> |
206,7 → 212,13 |
if ($name == 'none') |
continue; |
$oper_name = $name . '_op'; |
$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0]; |
if(isset($item_vals["$key"][0]) && $item_vals["$key"][0] != ''){ |
$val = $item_vals["$key"][0]; |
} else if(isset($default_vals["$key"][0])) { |
$val = $default_vals["$key"][0]; |
} else { |
$val = ''; |
} |
/* |
Gestion d'un mode simple ou d'un mode avancé |
Définition du mode avancé: les attributs concernant la gestion des octets, de la bande passante |
219,13 → 231,13 |
case 'ChilliSpot-Bandwidth-Max-Up' : |
case 'ChilliSpot-Bandwidth-Max-Down' : |
case 'WISPr-Redirection-URL' : |
case 'Login-Time' : |
case 'Login-Time' : |
case 'Session-Timeout' : |
case 'Max-Daily-Session' : |
case 'Max-Monthly-Session' : |
$advanced=0; //<-- attribut non-affiché |
break; |
case 'Simultaneous-Use' : |
case 'Simultaneous-Use' : |
$advanced=1; |
$help_link="help/simultaneous_use_help.html"; |
$desc=$l_simultaneous_use; |
257,12 → 269,12 |
</td> |
EOM; |
switch ($key){ |
case 'Simultaneous-Use' : |
case 'Simultaneous-Use' : |
case 'Max-All-Session' : |
case 'Max-Daily-Session' : |
case 'Max-Weekly-Session' : |
case 'Max-Monthly-Session' : |
case 'Login-Time' : |
case 'Login-Time' : |
case 'Expiration' : |
echo "<input type=\"hidden\" name=$oper_name value=\":=\">"; |
break; |
301,9 → 313,9 |
break; |
} |
} |
/* |
/* |
Ajout du pré-remplissage de cellule |
du choix d'unité (pour les durées limites de session,journée et de mois) |
du choix d'unité (pour les durées limites de session,journée et de mois) |
et d'un calendrier pour la date d'expiration |
Sauf dans le cas de la visualisation |
*/ |
316,9 → 328,9 |
echo"<input type=text name=\"$name\" value=\"$val\" size=20>"; |
break; |
/* |
Choix de l'unité heures, minutes ou secondes |
pour les durées limites de session,journée et de mois |
*/ |
Choix de l'unité heures, minutes ou secondes |
pour les durées limites de session,journée et de mois |
*/ |
case 'Session-Timeout' : |
case 'Max-Daily-Session' : |
/*valeur d'origine de durée limite */ |
378,7 → 390,7 |
<option value=\"es\" >Español</option> |
<option value=\"it\" >Italiano</option> |
<option value=\"pt\" >Portugês</option> |
</select></td></tr>"; |
</select></td></tr>"; |
} |
echo "</table>"; |
if($create == 1) |
/web/acc/manager/htdocs/user_new2.php |
---|
3,6 → 3,18 |
//gestion de la langue |
if (is_file("../lib/langues.php")) |
include("../lib/langues.php"); |
require('../lib/operators.php'); |
if(!isset($create)) $create=0; |
if(!isset($show)) $show=0; |
if(!isset($login)) $login = ''; |
if(!isset($cn)) $cn = ''; |
if(!isset($mail)) $mail = ''; |
if(!isset($langue_imp)) $langue_imp = ''; |
if(!isset($selected)) $selected = array(); |
if(!isset($selected['='])) $selected['='] = ''; |
require('/etc/freeradius-web/config.php'); |
if($show == 2) |
{ |
12,7 → 24,7 |
require('../lib/attrshow.php'); |
require('../lib/defaults.php'); |
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){ |
if ($config['general_lib_type'] == 'sql' && $config['sql_use_operators'] == 'true'){ |
$colspan=2; |
$show_ops=1; |
}else{ |
22,7 → 34,7 |
?> |
<html><head><title>User creation</title> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>"> |
<link rel="stylesheet" href="/css/style.css"> |
<link rel="stylesheet" type="text/css" href="/css/epoch_styles.css" /> |
<script type="text/javascript" src="/js/epoch_classes.js"></script> |
30,7 → 42,7 |
<script language="javascript" type="text/javascript"> |
/*Insertion du calendrier */ |
var dp_cal; |
var dp_cal; |
window.onload = function () { |
dp_cal = new Epoch('epoch_popup','popup',document.getElementById('popup_container')); |
}; |
60,11 → 72,12 |
</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> |
<tr><td> |
<?php |
function sec_imp($time) |
/*Formatage des secondes avant l'impression */ |
{ |
/*Formatage des secondes avant l'impression */ |
{ |
$result = ''; |
$jour = 0;$heure = 0;$minute = 0;$seconde = 0; |
$jour = floor($time/86400); |
$reste = $time%86400; |
77,7 → 90,7 |
$seconde = $reste%60; |
if ($seconde!=0) $result = $result.$seconde.' s '; |
return $result; |
} |
} |
if ($create == 1){ |
if (is_file("../lib/$config[general_lib_type]/user_info.php")) |
92,7 → 105,7 |
include("../lib/$config[general_lib_type]/create_user.php"); |
/* Petit traitement pré-impression pour la lisibilité */ |
/* Récupération des attributs du groupe le cas échéant */ |
if ($group!=''){ |
if (isset($group) && $group!=''){ |
$saved_login = $login; |
$login = $group; |
if (is_file("../lib/sql/group_info.php")) |
100,19 → 113,19 |
$login = $saved_login;} |
/* Si les valeurs de durée sont vide remplissage avec la valeur 'Illimitée'*/ |
/* et formatage des secondes sous le format Heure min ses*/ |
if ($sto_imp==''){ $sto_imp=$v_illimit;} |
if ($sto_imp==''){ $sto_imp='-';} |
else { $sto_imp=sec_imp($sto_imp);} |
if ($mas_imp==''){ $mas_imp=$v_illimit;} |
if ($mas_imp==''){ $mas_imp='-';} |
else { $mas_imp=sec_imp($mas_imp);} |
if ($mds_imp==''){ $mds_imp=$v_illimit;} |
if ($mds_imp==''){ $mds_imp='-';} |
else { $mds_imp=sec_imp($mds_imp);} |
if ($mms_imp==''){ $mms_imp=$v_illimit;} |
if ($mms_imp==''){ $mms_imp='-';} |
else { $mms_imp=sec_imp($mms_imp);} |
/*Formatage de la date afin d'être lisible dans toute les langues 'jj mm yyyy'*/ |
if ($Expiration!=''){ $Expiration=date("d - m - Y",strtotime($Expiration));} |
else { $Expiration=$v_without;} |
else { $Expiration='-';} |
if ($show != 3) |
{ |
{ |
//Appel du ticket d'impression , passage en paramètres des valeurs à afficher |
echo' <form name="impression" method="post" action="ticket_user.php" target=_blank> |
<input type="hidden" name="langue_imp" value="'.$langue_imp.'"> |
162,7 → 175,7 |
</td> |
</tr> |
EOM; |
if ($config[general_lib_type] == 'sql'){ |
if ($config['general_lib_type'] == 'sql'){ |
if (isset($member_groups)) |
$selected[$member_groups[0]] = 'selected'; |
echo <<<EOM |
182,8 → 195,8 |
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')){ |
if ($config['general_lib_type'] == 'ldap' || |
($config['general_lib_type'] == 'sql' && $config['sql_use_user_info_table'] == 'true')){ |
echo <<<EOM |
<tr> |
<td class="etiquette" colspan=$colspan> |
206,11 → 219,17 |
if ($name == 'none') |
continue; |
$oper_name = $name . '_op'; |
$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0]; |
if(isset($item_vals["$key"][0]) && $item_vals["$key"][0] != '') { |
$val = $item_vals["$key"][0]; |
} else if(isset($default_vals["$key"][0])){ |
$val = $default_vals["$key"][0]; |
} else{ |
$val = ''; |
} |
switch ($key) |
{ |
// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.) |
case 'Simultaneous-Use' : |
// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.) |
case 'Simultaneous-Use' : |
$advanced=1; |
$help_link="help/simultaneous_use_help.html"; |
$desc=$l_simultaneous_use; |
220,7 → 239,7 |
$help_link="help/max_all_session_help.html"; |
$desc=$l_max_all_session; |
break; |
case 'Session-Timeout' : |
case 'Session-Timeout' : |
$advanced=1; |
$help_link="help/session_timeout_help.html"; |
$desc=$l_session_timeout; |
235,7 → 254,7 |
$help_link="help/session_timeout_help.html"; |
$desc=$l_monthly_timeout; |
break; |
case 'Login-Time' : |
case 'Login-Time' : |
$advanced=1; |
$help_link="help/login_time_help.html"; |
$desc=$l_login_time; |
292,12 → 311,12 |
</td> |
EOM; |
switch ($key){ |
case 'Simultaneous-Use' : |
case 'Simultaneous-Use' : |
case 'Max-All-Session' : |
case 'Max-Daily-Session' : |
case 'Max-Weekly-Session' : |
case 'Max-Monthly-Session' : |
case 'Login-Time' : |
case 'Login-Time' : |
case 'Expiration' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
336,8 → 355,8 |
break; |
} |
} |
/* |
Ajout du choix d'unité (pour les durées limites de session,journée et de mois) |
/* |
Ajout du choix d'unité (pour les durées limites de session,journée et de mois) |
et d'un calendrier pour la date d'expiration |
Sauf dans le cas de la visualisation |
*/ |
345,9 → 364,9 |
if ($create==0 ){ |
switch ($name){ |
/* |
Choix de l'unité jour, heures, minutes ou secondes |
pour les durées limites max, de session,de journée et de mois |
*/ |
Choix de l'unité jour, heures, minutes ou secondes |
pour les durées limites max, de session,de journée et de mois |
*/ |
case 'Session-Timeout' : |
case 'Max-Daily-Session' : |
/*valeur d'origine de durée limite */ |
405,7 → 424,7 |
<option value=\"es\" >Español</option> |
<option value=\"it\" >Italiano</option> |
<option value=\"pt\" >Portugês</option> |
</select></td></tr>"; |
</select></td></tr>"; |
} |
echo "</table><BR>"; |
if($create == 1) |
413,7 → 432,7 |
echo "<a href=\"ticket.pdf\">Ticket</a><br>"; |
echo "<center><a href=\"user_admin.php?login=$login\">$l_show_profile</a></center>"; |
} |
else |
else |
{ |
echo "<input type=submit class=button value=\"$l_create\" OnClick=\"return formControl('newuser');\">"; |
echo "<input type='hidden' name='nbtickets' value=''>"; |
/web/acc/manager/html/user_admin.html.php |
---|
10,7 → 10,7 |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>$l_users_managment</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
<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> |
19,14 → 19,14 |
<tr><td valign="middle" align="left"> |
<link rel="stylesheet" href="/css/style.css"> |
EOM; |
if ($logged_now) |
if (isset($logged_now) && $logged_now) |
print <<<EOM |
<script Language="JavaScript"> |
<!-- |
var start; |
var our_time; |
function startcounter() |
function startcounter() |
{ |
var start_date = new Date(); |
start = start_date.getTime(); |
38,21 → 38,21 |
{ |
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); |
} |
86,7 → 86,7 |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
EOM; |
if ($logged_now){ |
if (isset($logged_now) && $logged_now){ |
print <<<EOM |
<form name="online" onSubmit="return(false);"> |
<tr><td align=center bgcolor="#d0ddb0"> |
96,7 → 96,7 |
</td></tr> |
<tr><td align=center bgcolor="#d0ddb0"> |
<b>$l_connection_time</b> |
</td><td> |
</td><td> |
<input type="text" name="status" size=10 value="$lastlog_session_time"> |
</form> |
</td></tr> |
211,7 → 211,7 |
<tr><td align=center bgcolor="#d0ddb0"><b>$l_download ($l_average)</b></td><td> |
$avg_input</td></tr> |
<tr><td align=center bgcolor="#d0ddb0"><b>$l_upload ($l_average)</b></td><td> |
$avg_output</td></tr> |
$avg_output</td></tr> |
</table> |
</table> |
</table> |
410,7 → 410,7 |
print <<<EOM |
</tr></table> |
EOM; |
if ($logged_now) |
if (isset($logged_now) && $logged_now) |
print <<<EOM |
<script Language="JavaScript"> |
startcounter(); |
/web/acc/manager/lib/acctshow.php |
---|
0,0 → 1,20 |
<?php |
#Read sql attribute map |
unset($sql_attrs); |
if (isset($_SESSION['sql_attrs'])) |
$sql_attrs = $_SESSION["sql_attrs"]; |
if (!isset($sql_attrs)){ |
$ARR = file($config[general_sql_attrs_file]); |
foreach($ARR as $val){ |
$val=chop($val); |
if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val)) |
continue; |
list($key,$desc,$show,$func)=preg_split("/\t+/",$val); |
$sql_attrs[strtolower($key)][desc] = "$desc"; |
$sql_attrs[strtolower($key)][show] = "$show"; |
$sql_attrs[strtolower($key)][func] = ($func == "") ? "nothing" : "$func"; |
} |
if ($config[general_use_session] == 'yes') |
session_register('sql_attrs'); |
} |
?> |
/web/acc/manager/lib/add_badusers.php |
---|
0,0 → 1,38 |
<?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(); |
} |
$date=date($config[sql_full_date_format]); |
$lockmsg_name = $attrmap['Dialup-Lock-Msg'] . '0'; |
$msg = $$lockmsg_name; |
$admin = '-'; |
if ($_SERVER["PHP_AUTH_USER"] != '') |
$admin = $_SERVER["PHP_AUTH_USER"]; |
if ($msg == '') |
echo "<b>Lock Message should not be empty</b><br>\n"; |
else{ |
$sql_servers = array(); |
if ($config[sql_extra_servers] != '') |
$sql_servers = explode(' ',$config[sql_extra_servers]); |
$sql_servers[] = $config[sql_server]; |
foreach ($sql_servers as $server){ |
$link = da_sql_host_connect($server,$config); |
if ($link){ |
$r = da_sql_query($link,$config, |
"INSERT INTO $config[sql_badusers_table] (username,incidentdate,admin,reason) |
VALUES ('$login','$date','$admin','$msg');"); |
if (!$r) |
echo "<b>SQL Error:" . da_sql_error($link,$config) . "</b><br>\n"; |
else |
echo "<b>User added to badusers table</b><br>\n"; |
da_sql_close($link,$config); |
} |
else |
echo "<b>SQL Error: Could not connect to SQL database: $server</b><br>\n"; |
} |
} |
?> |
/web/acc/manager/lib/attrshow.php |
---|
0,0 → 1,54 |
<?php |
//include_once('../lib/xlat.php'); |
#Read user_edit attribute map |
unset($show_attrs); |
if (isset($_SESSION['show_attrs'])) |
$show_attrs = $_SESSION['show_attrs']; |
if (!isset($show_attrs)){ |
$infile = $config['general_user_edit_attrs_file']; |
$ARR = file($infile); |
foreach($ARR as $val){ |
$val=chop($val); |
if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val)) |
continue; |
list($key,$v)=preg_split("/\t+/",$val); |
$show_attrs["$key"]=($v != '') ? "$v" : "$key"; |
} |
if ($config['general_use_session'] == 'yes') |
session_register('show_attrs'); |
} |
unset($acct_attrs); |
if (isset($_SESSION['acct_attrs'])) |
$acct_attrs = $_SESSION['acct_attrs']; |
if (!isset($acct_attrs) && isset($config['general_accounting_attrs_file'])){ |
$infile = $config['general_accounting_attrs_file']; |
$ARR = file($infile); |
$acct_attrs = array(); |
$acct_attrs["ua"] = array(); |
$acct_attrs["ua"]['num'] = 0; |
$acct_attrs["uf"] = array(); |
$acct_attrs["uf"]['num'] = 0; |
$acct_attrs["fl"] = array(); |
$acct_attrs["fl"]['num'] = 0; |
foreach ($ARR as $val){ |
$val=chop($val); |
if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val)) |
continue; |
list($num,$desc,$showua,$showuf,$showfl)=preg_split("/\t+/",$val); |
if ($showua == 'yes'){ |
$acct_attrs["ua"]["num"]++; |
$acct_attrs["ua"]["$num"]=$desc; |
} |
if ($showuf == 'yes'){ |
$acct_attrs["uf"]["num"]++; |
$acct_attrs["uf"]["$num"]=$desc; |
} |
if ($showfl == 'yes'){ |
$acct_attrs["fl"]["num"]++; |
$acct_attrs["fl"]["$num"]=$desc; |
} |
} |
if ($config['general_use_session'] == 'yes') |
session_register('acct_attrs'); |
} |
?> |
/web/acc/manager/lib/crypt/clear.php |
---|
0,0 → 1,6 |
<?php |
function da_encrypt($passwd) |
{ |
return $passwd; |
} |
?> |
/web/acc/manager/lib/crypt/md5.php |
---|
0,0 → 1,6 |
<?php |
function da_encrypt($passwd) |
{ |
return md5($passwd); |
} |
?> |
/web/acc/manager/lib/defaults.php |
---|
0,0 → 1,24 |
<?php |
unset($text_default_vals); |
unset($default_vals); |
if (isset($_SESSION['text_default_vals'])) |
$text_default_vals = $_SESSION['text_default_vals']; |
if (!isset($text_default_vals)){ |
$ARR=file("$config[general_default_file]"); |
foreach($ARR as $val) { |
$val=chop($val); |
if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val)) |
continue; |
list($key,$v)=preg_split("/:[[:space:]]*/",$val,2); |
$text_default_vals["$key"][0]="$v"; |
$text_default_vals["$key"]['count']++; |
} |
if (!isset($text_default_vals)) |
$text_default_vals["NOT_EXIST"][0] = '0'; |
if ($config['general_use_session'] == 'yes') |
session_register('text_default_vals'); |
} |
$default_vals = $text_default_vals; |
if (is_file("../lib/$config[general_lib_type]/defaults.php")) |
include("../lib/$config[general_lib_type]/defaults.php"); |
?> |
/web/acc/manager/lib/functions.php |
---|
6,6 → 6,7 |
return "0 seconds"; |
$d = $time/86400; |
$d = floor($d); |
$str = ''; |
if ($d){ |
$str .= "$d days, "; |
$time = $time % 86400; |
24,8 → 25,9 |
} |
if ($time) |
$str .= "$time seconds, "; |
$str = ereg_replace(', $','',$str); |
$str = preg_replace('/, $/','',$str); |
return $str; |
} |
115,8 → 117,8 |
} |
function check_defaults($val,$op,$def) |
{ |
for($i=0;$i<$def[count];$i++){ |
if ($val == $def[$i] && ($op == '' || $op == $def[operator][$i])) |
for($i=0;$i<$def['count'];$i++){ |
if ($val == $def[$i] && ($op == '' || $op == $def['operator'][$i])) |
return 1; |
} |
/web/acc/manager/lib/lang/default/utf8.php |
---|
0,0 → 1,11 |
<?php |
function init_decoder() |
{ |
return 0; |
} |
function decode_string($line,$k) |
{ |
return $line; |
} |
?> |
/web/acc/manager/lib/lang/el/utf8.php |
---|
0,0 → 1,91 |
<?php |
function init_encoder() |
{ |
$k = array( |
"~@"=>"", "~A"=>"", "~B"=>"", "~C"=>"", "~D"=>"", "~E"=>" ", |
"~F"=>"", "~G"=>"", "~H"=>"", "~I"=>"", "~J"=>"", "~K"=>"", |
"~L"=>"", "~M"=>"", "~N"=>"", "~O"=>"", "~P"=>"", "~Q"=>"", |
"~R"=>"", "~S"=>"", "~T"=>"", "~U"=>"", "~V"=>"", "~W"=>"", |
"~^"=>"Â", "~_"=>"Â", "| "=>" ", "¡"=>"ʽ", "¢"=>"ʼ", "£"=>"£", |
"¤"=>"�", "¥"=>"�", "¦"=>"¦", "§"=>"§", "¨"=>"¨", "©"=>"©", |
"ª"=>"�", "«"=>"«", "¬"=>"¬", ""=>"Â", "®"=>"�", "¯"=>"â", |
"°"=>"°", "±"=>"±", "²"=>"²", "³"=>"³", "´"=>"Î", "µ"=>"Î ", |
"¶"=>"Î", "·"=>"·", "¸"=>"Î", "¹"=>"Î", "º"=>"Î", "»"=>"»", |
"¼"=>"Î", "½"=>"½", "¾"=>"Î", "¿"=>"Î", "À"=>"Î", "Á"=>"Î", |
"Â"=>"Î", "Ã"=>"Î", "Ä"=>"Î", "Å"=>"Î", "Æ"=>"Î", "Ç"=>"Î", |
"È"=>"Î", "É"=>"Î", "Ê"=>"Î", "Ë"=>"Î", "Ì"=>"Î", "Í"=>"Î", |
"Î"=>"Î", "Ï"=>"Î", "Ð"=>"Î ", "Ñ"=>"Ρ", "Ò"=>"�", "Ó"=>"Σ", |
"Ô"=>"Τ", "Õ"=>"Î¥", "Ö"=>"Φ", "×"=>"Χ", "Ø"=>"Ψ", "Ù"=>"Ω", |
"Ú"=>"Ϊ", "Û"=>"Ϋ", "Ü"=>"ά", "Ý"=>"Î", "Þ"=>"ή", "ß"=>"ί", |
"à"=>"ΰ", "á"=>"α", "â"=>"β", "ã"=>"γ", "ä"=>"δ", "å"=>"ε", |
"æ"=>"ζ", "ç"=>"η", "è"=>"θ", "é"=>"ι", "ê"=>"κ", "ë"=>"λ", |
"ì"=>"μ", "í"=>"ν", "î"=>"ξ", "ï"=>"ο", "ð"=>"Ï", "ñ"=>"Ï", |
"ò"=>"Ï", "ó"=>"Ï", "ô"=>"Ï", "õ"=>"Ï ", "ö"=>"Ï", "÷"=>"Ï", |
"ø"=>"Ï", "ù"=>"Ï", "ú"=>"Ï", "û"=>"Ï", "ü"=>"Ï", "ý"=>"Ï", |
"þ"=>"Ï", "~X"=>"Â", "~Y"=>"Â", "~Z"=>"Â", "~["=>"Â", "~]"=>"Â" |
); |
return $k; |
} |
function init_decoder() |
{ |
$k = array( |
""=>"~@", ""=>"~A", ""=>"~B", ""=>"~C", ""=>"~D", " "=>"~E", |
""=>"~F", ""=>"~G", ""=>"~H", ""=>"~I", ""=>"~J", ""=>"~K", |
""=>"~L", ""=>"~M", ""=>"~N", ""=>"~O", ""=>"~P", ""=>"~Q", |
""=>"~R", ""=>"~S", ""=>"~T", ""=>"~U", ""=>"~V", ""=>"~W", |
"Â"=>"~^", "Â"=>"~_", " "=>"| ", "ʽ"=>"¡", "ʼ"=>"¢", "£"=>"£", |
"�"=>"¤", "�"=>"¥", "¦"=>"¦", "§"=>"§", "¨"=>"¨", "©"=>"©", |
"�"=>"ª", "«"=>"«", "¬"=>"¬", "Â"=>"", "�"=>"®", "â"=>"¯", |
"°"=>"°", "±"=>"±", "²"=>"²", "³"=>"³", "Î"=>"´", "Î "=>"µ", |
"Î"=>"¶", "·"=>"·", "Î"=>"¸", "Î"=>"¹", "Î"=>"º", "»"=>"»", |
"Î"=>"¼", "½"=>"½", "Î"=>"¾", "Î"=>"¿", "Î"=>"À", "Î"=>"Á", |
"Î"=>"Â", "Î"=>"Ã", "Î"=>"Ä", "Î"=>"Å", "Î"=>"Æ", "Î"=>"Ç", |
"Î"=>"È", "Î"=>"É", "Î"=>"Ê", "Î"=>"Ë", "Î"=>"Ì", "Î"=>"Í", |
"Î"=>"Î", "Î"=>"Ï", "Î "=>"Ð", "Ρ"=>"Ñ", "�"=>"Ò", "Σ"=>"Ó", |
"Τ"=>"Ô", "Î¥"=>"Õ", "Φ"=>"Ö", "Χ"=>"×", "Ψ"=>"Ø", "Ω"=>"Ù", |
"Ϊ"=>"Ú", "Ϋ"=>"Û", "ά"=>"Ü", "Î"=>"Ý", "ή"=>"Þ", "ί"=>"ß", |
"ΰ"=>"à", "α"=>"á", "β"=>"â", "γ"=>"ã", "δ"=>"ä", "ε"=>"å", |
"ζ"=>"æ", "η"=>"ç", "θ"=>"è", "ι"=>"é", "κ"=>"ê", "λ"=>"ë", |
"μ"=>"ì", "ν"=>"í", "ξ"=>"î", "ο"=>"ï", "Ï"=>"ð", "Ï"=>"ñ", |
"Ï"=>"ò", "Ï"=>"ó", "Ï"=>"ô", "Ï "=>"õ", "Ï"=>"ö", "Ï"=>"÷", |
"Ï"=>"ø", "Ï"=>"ù", "Ï"=>"ú", "Ï"=>"û", "Ï"=>"ü", "Ï"=>"ý", |
"Ï"=>"þ", "Â"=>"~X", "Â"=>"~Y", "Â"=>"~Z", "Â"=>"~[", "Â"=>"~]" |
); |
return $k; |
} |
function encode_string($line,$k) |
{ |
for($i=0;$i<strlen($line);$i++){ |
$c = $line{$i}; |
$val = $k["$c"]; |
$c = ($val != "") ? "$val" : "$c"; |
$new_line .= $c; |
} |
return $new_line; |
} |
function decode_string($line,$k) |
{ |
$line = preg_replace("/&/","&&",$line); |
$line = preg_replace("/([,+0-9.\/() -])/", "%\\1", $line); |
$mline = chunk_split($line, 2, " "); |
$chars = explode(" ", $mline); |
foreach ($chars as $c){ |
$val = $k["$c"]; |
$c = ($val != "") ? "$val" : "$c"; |
$new_line .= $c; |
} |
$new_line = preg_replace("/%%/", " ", $new_line); |
$new_line = preg_replace("/%([,+0-9.\/() -])/", "\\1", $new_line); |
$new_line = preg_replace("/%/", " ",$new_line); |
$new_line = preg_replace("/&&/","&",$new_line); |
return $new_line; |
} |
?> |
/web/acc/manager/lib/operators.php |
---|
0,0 → 1,42 |
<?php |
$op_eq = '='; |
$op_set = ':='; |
$op_add = '+='; |
$op_eq2 = '=='; |
$op_ne = '!='; |
$op_gt = '>'; |
$op_ge = '>='; |
$op_lt = '<'; |
$op_le = '<='; |
$op_regeq = '=~'; |
$op_regne = '!~'; |
$op_exst = '=*'; |
$op_nexst = '!*'; |
// Check the operator if it is allowed for this type of |
// attribute (check or reply). |
// Arguments: |
// $op: The operator |
// $type: 1(check),2(reply) |
// Return value:0 for OK, -1 for error |
function check_operator($op,$type) |
{ |
switch($op){ |
case '=': |
case ':=': |
case '+=': |
return 0; |
case '==': |
case '!=': |
case '>': |
case '>=': |
case '<': |
case '<=': |
case '=~': |
case '!~': |
case '=*': |
case '!*': |
return ($type == 1) ? 0 : -1; |
} |
} |
?> |
/web/acc/manager/lib/sql/attrmap.php |
---|
0,0 → 1,37 |
<?php |
#Read sql attribute map |
unset($attrmap); |
unset($rev_attrmap); |
unset($attr_type); |
if (isset($_SESSION['attrmap'])){ |
#If attrmap is set then the rest will also be set |
$attrmap = $_SESSION['attrmap']; |
$rev_attrmap =$_SESSION['rev_attrmap']; |
$attr_type = $_SESSION['attr_type']; |
} |
else{ |
$ARR = file("$config[general_sql_attrmap]"); |
foreach($ARR as $val){ |
$val=chop($val); |
if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val)) |
continue; |
list($type,$key,$v)=preg_split('/[[:space:]]+/',$val); |
$attrmap["$key"]=$v; |
$rev_attrmap["$v"] = $key; |
$attr_type["$key"]=$type; |
} |
if (isset($show_attrs)){ |
foreach($show_attrs as $key => $desc){ |
if (!isset($attrmap["$key"]) || $attrmap["$key"] == ''){ |
$attrmap["$key"] = $key; |
$attr_type["key"] = 'replyItem'; |
$rev_attrmap["$key"] = $key; |
} |
} |
} |
if ($config['general_use_session'] == 'yes'){ |
session_register('attrmap'); |
session_register('rev_attrmap'); |
session_register('attr_type'); |
} |
} |
/web/acc/manager/lib/sql/change_attrs.php |
---|
6,12 → 6,12 |
echo "<b>Could not include SQL library</b><br>\n"; |
exit(); |
} |
if ($config[sql_use_operators] == 'true'){ |
if ($config['sql_use_operators'] == 'true'){ |
$use_ops=1; |
$text1 = 'AND op ='; |
$text2 = ',op'; |
} |
$link = @da_sql_pconnect($config); |
$link = da_sql_pconnect($config); |
if ($link){ |
foreach($show_attrs as $key => $desc){ |
if ($attrmap["$key"] == 'none') |
26,7 → 26,7 |
$name = $attrmap["$key"] . $i; |
while(isset($$name)){ |
$val=$$name; |
$val = da_sql_escape_string($val); |
$val = da_sql_escape_string($link, $val); |
$op_name = $name . '_op'; |
$i++; |
$j++; |
33,18 → 33,18 |
$name = $attrmap["$key"] . $i; |
$sql_attr=$attrmap["$key"]; |
$query_key = ($user_type == 'group') ? 'groupname' : 'username'; |
if ($attr_type["$key"] == 'checkItem'){ |
$table = ($user_type == 'group') ? $config[sql_groupcheck_table] : $config[sql_check_table]; |
if (isset($attr_type["$key"]) && $attr_type["$key"] == 'checkItem'){ |
$table = ($user_type == 'group') ? $config['sql_groupcheck_table'] : $config['sql_check_table']; |
$type = 1; |
} |
else if ($attr_type["$key"] == 'replyItem'){ |
$table = ($user_type == 'group') ? $config[sql_groupreply_table] : $config[sql_reply_table]; |
else if (isset($attr_type["$key"]) && $attr_type["$key"] == 'replyItem'){ |
$table = ($user_type == 'group') ? $config['sql_groupreply_table'] : $config['sql_reply_table']; |
$type = 2; |
} |
if ($use_ops){ |
$op_val = $$op_name; |
if ($op_val != ''){ |
$op_val = da_sql_escape_string($op_val); |
$op_val = da_sql_escape_string($link, $op_val); |
if (check_operator($op_val,$type) == -1){ |
echo "<b>Invalid operator ($op_val) for attribute $key</b><br>\n"; |
continue; |
52,25 → 52,26 |
$op_val2 = ",'$op_val'"; |
} |
} |
$sql_attr = da_sql_escape_string($sql_attr); |
$val = da_sql_escape_string($val); |
$sql_attr = da_sql_escape_string($link, $sql_attr); |
$val = da_sql_escape_string($link, $val); |
// if we have operators, the operator has changed and the corresponding value exists then update |
if ($use_ops && isset($item_vals["$key"][operator][$j]) && |
$op_val != $item_vals["$key"][operator][$j] ){ |
$res = @da_sql_query($link,$config, |
if ($use_ops && isset($item_vals["$key"]['operator'][$j]) && |
$op_val != $item_vals["$key"]['operator'][$j] ){ |
$res = da_sql_query($link,$config, |
"UPDATE $table SET op = '$op_val' WHERE $query_key = '$login' |
AND attribute = '$sql_attr' AND value = '$val';"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)) |
if (!$res || !da_sql_affected_rows($link,$res,$config)) |
echo "<b>Operator change failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
$chkdef = (isset($default_vals["$key"])) ? check_defaults($val,$op_val,$default_vals["$key"]) : 0; |
// if value is the same as that in the sql database do nothing |
if ($val == $item_vals["$key"][$j]) |
if (isset($item_vals["$key"]) && $val == $item_vals["$key"][$j]) |
continue; |
// if value is null or equals the default value and corresponding value exists then delete |
else if ((check_defaults($val,$op_val,$default_vals["$key"]) || $val == '' || ($sql_attr == "Filter-Id" && $val == "None")) && isset($item_vals["$key"][$j])){ |
$res = @da_sql_query($link,$config, |
else if (($chkdef || $val == '' || ($sql_attr == "Filter-Id" && $val == "None")) && isset($item_vals["$key"][$j])){ |
$res = da_sql_query($link,$config, |
"DELETE FROM $table WHERE $query_key = '$login' AND attribute = '$sql_attr';"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)) |
if (!$res || !da_sql_affected_rows($link,$res,$config)) |
echo "<b>Delete failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
// if value is null or equals the default value then don't add it |
80,16 → 81,16 |
else{ |
if (isset($item_vals["$key"][$j])){ |
$old_val = $item_vals["$key"][$j]; |
$old_val = da_sql_escape_string($old_val); |
$res = @da_sql_query($link,$config, |
$old_val = da_sql_escape_string($link, $old_val); |
$res = da_sql_query($link,$config, |
"UPDATE $table SET value = '$val' WHERE $query_key = '$login' AND |
attribute = '$sql_attr' AND value = '$old_val';"); |
} |
else |
$res = @da_sql_query($link,$config, |
$res = da_sql_query($link,$config, |
"INSERT INTO $table ($query_key,attribute,value $text2) |
VALUES ('$login','$sql_attr','$val' $op_val2);"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)) |
if (!$res || !da_sql_affected_rows($link,$res,$config)) |
echo "<b>Change failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
} |
/web/acc/manager/lib/sql/change_info.php |
---|
0,0 → 1,57 |
<?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(); |
} |
$link = da_sql_pconnect($config); |
$fail = 0; |
if ($link){ |
if ($config['sql_use_user_info_table'] == 'true'){ |
$res = da_sql_query($link,$config, |
"SELECT username FROM $config[sql_user_info_table] WHERE |
username = '$login';"); |
if ($res){ |
$Fcn = (isset($Fcn)) ? da_sql_escape_string($link, $Fcn) : ''; |
$Fmail = (isset($Fmail)) ? da_sql_escape_string($link, $Fmail) : ''; |
$Fou = (isset($Fou)) ? da_sql_escape_string($link, $Fou) : ''; |
$Fhomephone = (isset($Fhomephone)) ? da_sql_escape_string($link, $Fhomephone) : ''; |
$Ftelephonenumber = (isset($Ftelephonenumber)) ? da_sql_escape_string($link, $Ftelephonenumber) : ''; |
$Fmobile = (isset($Fmobile)) ? da_sql_escape_string($link, $Fmobile) : ''; |
if (!da_sql_num_rows($res,$config)){ |
$res = da_sql_query($link,$config, |
"INSERT INTO $config[sql_user_info_table] |
(username,name,mail,department,homephone,workphone,mobile) VALUES |
('$login','$Fcn','$Fmail','$Fou','$Ftelephonenumber','$Fhomephone','$Fmobile');"); |
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"; |
$fail = 1; |
} |
} |
else{ |
$res = da_sql_query($link,$config, |
"UPDATE $config[sql_user_info_table] SET name = '$Fcn',Mail = '$Fmail', |
department = '$Fou', homephone = '$Fhomephone', workphone = '$Ftelephonenumber', |
mobile = '$Fmobile' WHERE username = '$login';"); |
if (!$res || !da_sql_affected_rows($link,$res,$config)){ |
echo "<b>Could not update user information in user info table: " . da_sql_error($link,$config) . "</b><br>\n"; |
$fail = 1; |
} |
} |
} |
else{ |
echo "<b>Could not find user in user info table: " . da_sql_error($link,$config) . "</b><br>\n"; |
$fail = 1; |
} |
if ($fail == 0) |
echo "<b>User information updated successfully</b><br>\n"; |
} |
else |
echo "<b>Cannot use the user info table. Check the sql_use_user_info_table directive in admin.conf</b><br>\n"; |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
?> |
/web/acc/manager/lib/sql/change_passwd.php |
---|
0,0 → 1,52 |
<?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 ($config[sql_use_operators] == 'true'){ |
$text1 = ',op'; |
$text2 = ",':='"; |
$text3 = ", op = ':='"; |
} |
else{ |
$text1 = ''; |
$text2 = ''; |
$text3 = ''; |
} |
$link = da_sql_pconnect($config); |
if ($link){ |
if (is_file("../lib/crypt/$config[general_encryption_method].php")){ |
include("../lib/crypt/$config[general_encryption_method].php"); |
$passwd = da_encrypt($passwd); |
$passwd = da_sql_escape_string($passwd); |
$res = da_sql_query($link,$config, |
"SELECT 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 ($row){ |
$res = da_sql_query($link,$config, |
"UPDATE $config[sql_check_table] SET value = '$passwd' $text3 WHERE |
attribute = '$config[sql_password_attribute]' AND username = '$login';"); |
if (!$res || !da_sql_affected_rows($link,$res,$config)) |
echo "<b>Error while changing password: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
else{ |
$res = da_sql_query($link,$config, |
"INSERT INTO $config[sql_check_table] (attribute,value,username $text1) |
VALUES ('$config[sql_password_attribute]','$passwd','$login' $text2);"); |
if (!$res || !da_sql_affected_rows($link,$res,$config)) |
echo "<b>Error while changing password: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
} |
else |
echo "<b>Error while executing query: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
else |
echo "<b>Could not open encryption library file</b><br>\n"; |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
?> |
/web/acc/manager/lib/sql/create_group.php |
---|
6,23 → 6,23 |
echo "<b>Could not include SQL library</b><br>\n"; |
exit(); |
} |
if ($config[sql_use_operators] == 'true'){ |
include("../lib/operators.php"); |
if ($config['sql_use_operators'] == 'true'){ |
include_once("../lib/operators.php"); |
$text = ',op'; |
$passwd_op = ",':='"; |
} |
$da_abort=0; |
$op_val2 = ''; |
$link = @da_sql_pconnect($config); |
$link = da_sql_pconnect($config); |
if ($link){ |
$Members = preg_split("/[\n\s]+/",$members,-1,PREG_SPLIT_NO_EMPTY); |
if (!empty($Members)){ |
foreach ($Members as $member){ |
$member = da_sql_escape_string($member); |
$res = @da_sql_query($link,$config, |
$member = da_sql_escape_string($link, $member); |
$res = da_sql_query($link,$config, |
"INSERT INTO $config[sql_usergroup_table] (username,groupname) |
VALUES ('$member','$login');"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)){ |
if (!$res || !da_sql_affected_rows($link,$res,$config)){ |
echo "<b>Unable to add user $member in group $login: " . da_sql_error($link,$config) . "</b><br>\n"; |
$da_abort=1; |
} |
30,10 → 30,10 |
} |
else |
{ |
$res = @da_sql_query($link,$config, |
$res = da_sql_query($link,$config, |
"INSERT INTO $config[sql_usergroup_table] (username,groupname) |
VALUES ('$login','$login');"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)) |
if (!$res || !da_sql_affected_rows($link,$res,$config)) |
{ |
echo "<b>Unable to add user $member in group $login: " . da_sql_error($link,$config) . "</b><br>\n"; |
$da_abort=1; |
55,20 → 55,20 |
$attr_type["$key"] = 'replyItem'; |
$rev_attrmap["$key"] = $key; |
} |
if ($attr_type["$key"] == 'checkItem'){ |
if (isset($attr_type["$key"]) && $attr_type["$key"] == 'checkItem'){ |
$table = "$config[sql_groupcheck_table]"; |
$type = 1; |
} |
else if ($attr_type["$key"] == 'replyItem'){ |
else if (isset($attr_type["$key"]) && $attr_type["$key"] == 'replyItem'){ |
$table = "$config[sql_groupreply_table]"; |
$type = 2; |
} |
$val = $$attrmap["$key"]; |
$val = da_sql_escape_string($val); |
$val = da_sql_escape_string($link, $val); |
$op_name = $attrmap["$key"] . '_op'; |
$op_val = $$op_name; |
if ($op_val != ''){ |
$op_val = da_sql_escape_string($op_val); |
$op_val = da_sql_escape_string($link, $op_val); |
if (check_operator($op_val,$type) == -1){ |
echo "<b>Invalid operator ($op_val) for attribute $key</b><br>\n"; |
coninue; |
75,12 → 75,13 |
} |
$op_val2 = ",'$op_val'"; |
} |
if ($val == '' || check_defaults($val,$op_val,$default_vals["$key"])) |
$chkdef = (isset($default_vals["$key"])) ? check_defaults($val,$op_val,$default_vals["$key"]) : 0; |
if ($val == '' || $chkdef) |
continue; |
$res = @da_sql_query($link,$config, |
$res = da_sql_query($link,$config, |
"INSERT INTO $table (attribute,value,groupname $text) |
VALUES ('$attrmap[$key]','$val','$login' $op_val2);"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)) |
if (!$res || !da_sql_affected_rows($link,$res,$config)) |
echo "<b>Query failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
echo "<b>Le groupe $login a été correctement créé</b><br>\n"; |
/web/acc/manager/lib/sql/create_user.php |
---|
1,4 → 1,4 |
<?php |
<?php |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php")) |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php"); |
else{ |
6,7 → 6,7 |
exit(); |
} |
include_once('../lib/functions.php'); |
if ($config[sql_use_operators] == 'true'){ |
if ($config['sql_use_operators'] == 'true'){ |
include_once("../lib/operators.php"); |
$text = ',op'; |
$passwd_op = ",':='"; |
13,7 → 13,7 |
} |
$da_abort=0; |
$op_val2 = ''; |
$link = @da_sql_pconnect($config); |
$link = da_sql_pconnect($config); |
if ($link){ |
if (is_file("../lib/crypt/$config[general_encryption_method].php")){ |
include_once("../lib/crypt/$config[general_encryption_method].php"); |
21,31 → 21,31 |
$passwd_imp = $passwd; |
/*Fin Ajout*/ |
$passwd = da_encrypt($passwd); |
$passwd = da_sql_escape_string($passwd); |
$res = @da_sql_query($link,$config, |
$passwd = da_sql_escape_string($link, $passwd); |
$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)){ |
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; |
} |
if ($config[sql_use_user_info_table] == 'true' && !$da_abort){ |
$res = @da_sql_query($link,$config, |
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)){ |
$Fcn = da_sql_escape_string($Fcn); |
$Fmail = da_sql_escape_string($Fmail); |
$Fou = da_sql_escape_string($Fou); |
$Fhomephone = da_sql_escape_string($Fhomephone); |
$Fworkphone = da_sql_escape_string($Fworkphone); |
$Fmobile = da_sql_escape_string($Fmobile); |
$res = @da_sql_query($link,$config, |
if (!da_sql_num_rows($res,$config)){ |
$Fcn = (isset($Fcn)) ? da_sql_escape_string($link, $Fcn) : ''; |
$Fmail = (isset($Fmail)) ? da_sql_escape_string($link, $Fmail) : ''; |
$Fou = (isset($Fou)) ? da_sql_escape_string($link, $Fou) : ''; |
$Fhomephone = (isset($Fhomephone)) ? da_sql_escape_string($link, $Fhomephone) : ''; |
$Ftelephonenumber = (isset($Ftelephonenumber)) ? da_sql_escape_string($link, $Ftelephonenumber) : ''; |
$Fmobile = (isset($Fmobile)) ? da_sql_escape_string($link, $Fmobile) : ''; |
$res = da_sql_query($link,$config, |
"INSERT INTO $config[sql_user_info_table] |
(username,name,mail,department,homephone,workphone,mobile) VALUES |
('$login','$Fcn','$Fmail','$Fou','$Fhomephone','$Ftelephonenumber','$Fmobile');"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)) |
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 |
54,17 → 54,17 |
else |
echo "<b>Could not add user information in user info table: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
if ($Fgroup != ''){ |
$Fgroup = da_sql_escape_string($Fgroup); |
$res = @da_sql_query($link,$config, |
if (isset($Fgroup) && $Fgroup != ''){ |
$Fgroup = da_sql_escape_string($link, $Fgroup); |
$res = da_sql_query($link,$config, |
"SELECT username FROM $config[sql_usergroup_table] |
WHERE username = '$login' AND groupname = '$Fgroup';"); |
if ($res){ |
if (!@da_sql_num_rows($res,$config)){ |
$res = @da_sql_query($link,$config, |
if (!da_sql_num_rows($res,$config)){ |
$res = da_sql_query($link,$config, |
"INSERT INTO $config[sql_usergroup_table] |
(username,groupname) VALUES ('$login','$Fgroup');"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)) |
if (!$res || !da_sql_affected_rows($link,$res,$config)) |
echo "<b>Could not add user to group $Fgroup. SQL Error</b><br>\n"; |
} |
else |
74,7 → 74,7 |
echo "<b>Could not add user to group $Fgroup: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
if (!$da_abort){ |
if ($Fgroup != '') |
if (isset($Fgroup) && $Fgroup != '') |
require('../lib/defaults.php'); |
foreach($show_attrs as $key => $attr){ |
if ($attrmap["$key"] == 'none') |
86,15 → 86,15 |
$attr_type["$key"] = 'replyItem'; |
$rev_attrmap["$key"] = $key; |
} |
if ($attr_type["$key"] == 'checkItem'){ |
if (isset($attr_type["$key"]) && $attr_type["$key"] == 'checkItem'){ |
$table = "$config[sql_check_table]"; |
$type = 1; |
} |
else if ($attr_type["$key"] == 'replyItem'){ |
else if (isset($attr_type["$key"]) && $attr_type["$key"] == 'replyItem'){ |
$table = "$config[sql_reply_table]"; |
$type = 2; |
} |
$val = $$attrmap["$key"]; |
$val = (isset($$attrmap["$key"])) ? $$attrmap["$key"] : ''; |
/*Ajout en vue de l'impression des données (thank's to Geoffroy MUSITELLI)*/ |
if($key == "Session-Timeout") $sto_imp = $val; |
if($key == "Max-All-Session") $mas_imp = $val; |
101,11 → 101,11 |
if($key == "Max-Daily-Session") $mds_imp = $val; |
if($key == "Max-Monthly-Session") $mms_imp = $val; |
/*Fin Ajout*/ |
$val = da_sql_escape_string($val); |
$val = da_sql_escape_string($link, $val); |
$op_name = $attrmap["$key"] . '_op'; |
$op_val = $$op_name; |
$op_val = (isset($$op_name)) ? $$op_name : ''; |
if ($op_val != ''){ |
$op_val = da_sql_escape_string($op_val); |
$op_val = da_sql_escape_string($link, $op_val); |
if (check_operator($op_val,$type) == -1){ |
echo "<b>Invalid operator ($op_val) for attribute $key</b><br>\n"; |
continue; |
112,12 → 112,13 |
} |
$op_val2 = ",'$op_val'"; |
} |
if ($val == '' || check_defaults($val,$op_val,$default_vals["$key"])) |
$chkdef = (isset($default_vals["$key"])) ? check_defaults($val,$op_val,$default_vals["$key"]) : 0; |
if ($val == '' || $chkdef) |
continue; |
$res = @da_sql_query($link,$config, |
"INSERT INTO $table (attribute,value,username $text) |
VALUES ('$attrmap[$key]','$val','$login' $op_val2);"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)) |
$sqlquery = "INSERT INTO $table (attribute,value,username $text) |
VALUES ('$attrmap[$key]','$val','$login' $op_val2);"; |
$res = da_sql_query($link,$config,$sqlquery); |
if (!$res || !da_sql_affected_rows($link,$res,$config)) |
echo "<b>Query failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
} |
/web/acc/manager/lib/sql/defaults.php |
---|
0,0 → 1,139 |
<?php |
require('../lib/sql/attrmap.php'); |
if ((isset($login) && $login != '') && (isset($user_type) && $user_type !== 'group')){ |
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 ($config['sql_use_operators'] == 'true'){ |
$op = ',op'; |
$use_op = 1; |
}else{ |
$op = ""; |
$use_op = 0; |
} |
$overwrite_defaults = 1; |
$stop = 0; |
$times = 0; |
do{ |
unset($item_vals); |
unset($member_groups); |
unset($tmp); |
$times++; |
$link = da_sql_pconnect($config); |
if ($link){ |
$res = da_sql_query($link,$config, |
"SELECT groupname FROM $config[sql_usergroup_table] WHERE username = '$login';"); |
if ($res){ |
while(($row = da_sql_fetch_array($res,$config))){ |
$group = $row['groupname']; |
$member_groups[$group] = $group; |
} |
if (isset($member_groups)) |
ksort($member_groups); |
} |
if (isset($member_groups)){ |
$in = '('; |
foreach ($member_groups as $group) |
$in .= "'$group',"; |
$in = substr($in,0,-1); |
$in .= ')'; |
$res = da_sql_query($link,$config, |
"SELECT attribute,value $op FROM $config[sql_groupcheck_table] |
WHERE groupname IN $in;"); |
if ($res){ |
while(($row = da_sql_fetch_array($res,$config))){ |
$attr = $row['attribute']; |
$val = $row['value']; |
if ($use_op){ |
$oper = $row['op']; |
$tmp["$attr"]['operator'][]="$oper"; |
} |
$tmp["$attr"][]="$val"; |
$tmp["$attr"]['count']++; |
} |
$res = da_sql_query($link,$config, |
"SELECT attribute,value $op FROM $config[sql_groupreply_table] |
WHERE groupname IN $in;"); |
if ($res){ |
while(($row = da_sql_fetch_array($res,$config))){ |
$attr = $row['attribute']; |
$val = $row['value']; |
if ($use_op){ |
$oper = $row['op']; |
$tmp["$attr"]['operator'][]="$oper"; |
} |
$tmp["$attr"][] = "$val"; |
$tmp["$attr"]['count']++; |
} |
} |
else |
echo "<b>Database query failed partially: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
if (isset($tmp)){ |
foreach(array_keys($tmp) as $val){ |
if ($val == '') |
continue; |
$key = $rev_attrmap["$val"]; |
if ($key == ''){ |
$key = $val; |
$attrmap["$key"] = $val; |
$attr_type["$key"] = 'replyItem'; |
$rev_attrmap["$val"] = $key; |
} |
if (!isset($default_vals["$key"]) || $overwrite_defaults){ |
if ($use_op) |
$default_vals["$key"]['operator'] = $tmp["$val"]['operator']; |
if ($tmp[$val][0] != '') |
$default_vals["$key"] = $tmp["$val"]; |
} |
} |
} |
} |
if ($times == 1){ |
if (!isset($config['sql_default_user_profile']) || $config['sql_default_user_profile'] == '') |
$stop = 1; |
else{ |
$saved_login = $login; |
$saved_member_groups = $member_groups; |
$login = $config['sql_default_user_profile']; |
$overwrite_defaults = 0; |
} |
} |
if ($times == 2){ |
$login = $saved_login; |
$member_groups = $saved_member_groups; |
$stop = 1; |
} |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
}while($stop == 0); |
} |
else{ |
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(); |
} |
unset($member_groups); |
$link = da_sql_pconnect($config); |
if ($link){ |
$res = da_sql_query($link,$config, |
"SELECT DISTINCT groupname FROM $config[sql_usergroup_table];"); |
if ($res){ |
while(($row = da_sql_fetch_array($res,$config))) |
$member_groups[] = $row['groupname']; |
} |
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"; |
} |
?> |
/web/acc/manager/lib/sql/delete_group.php |
---|
5,15 → 5,15 |
echo "<b>Could not include SQL library</b><br>\n"; |
exit(); |
} |
$link = @da_sql_pconnect($config); |
$link = da_sql_pconnect($config); |
if ($link){ |
$res = @da_sql_query($link,$config, |
$res = da_sql_query($link,$config, |
"DELETE FROM $config[sql_groupreply_table] WHERE groupname = '$login';"); |
if ($res){ |
$res = @da_sql_query($link,$config, |
$res = da_sql_query($link,$config, |
"DELETE FROM $config[sql_groupcheck_table] WHERE groupname = '$login';"); |
if ($res){ |
$res = @da_sql_query($link,$config, |
$res = da_sql_query($link,$config, |
"DELETE FROM $config[sql_usergroup_table] WHERE groupname = '$login';"); |
if ($res) |
echo "<b>Le groupe $login a été correctement supprimé</b><br>\n"; |
/web/acc/manager/lib/sql/delete_user.php |
---|
5,20 → 5,20 |
echo "<b>Could not include SQL library</b><br>\n"; |
exit(); |
} |
$link = @da_sql_pconnect($config); |
$link = da_sql_pconnect($config); |
if ($link){ |
$res = @da_sql_query($link,$config, |
$res = da_sql_query($link,$config, |
"DELETE FROM $config[sql_reply_table] WHERE username = '$login';"); |
if ($res){ |
$res = @da_sql_query($link,$config, |
$res = da_sql_query($link,$config, |
"DELETE FROM $config[sql_check_table] WHERE username = '$login';"); |
if ($res){ |
$res = @da_sql_query($link,$config, |
$res = da_sql_query($link,$config, |
"DELETE FROM $config[sql_usergroup_table] WHERE username = '$login';"); |
if (!$res) |
echo "<b>Error deleting user $login from user group table: " . da_sql_error($link,$config) . "</b><br>\n"; |
if ($config[sql_use_user_info_table] == 'true'){ |
$res = @da_sql_query($link,$config, |
if ($config['sql_use_user_info_table'] == 'true'){ |
$res = da_sql_query($link,$config, |
"DELETE FROM $config[sql_user_info_table] WHERE username = '$login';"); |
if ($res) |
echo "<b>L'usager $login a été correctement supprimé</b><br>\n"; |
/web/acc/manager/lib/sql/drivers/mysql/functions.php |
---|
16,90 → 16,89 |
function da_sql_host_connect($server,$config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
if ($config['sql_use_http_credentials'] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
$SQL_user = $config['sql_username']; |
$SQL_passwd = $config['sql_password']; |
} |
if ($config[sql_connect_timeout] != 0) |
@ini_set('mysql.connect_timeout',$config[sql_connect_timeout]); |
if ($config[sql_debug] == 'true') |
if ($config['sql_connect_timeout'] != 0) |
ini_set('mysql.connect_timeout',$config['sql_connect_timeout']); |
if ($config['sql_debug'] == 'true') |
print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n"; |
return @mysql_connect("$server:$config[sql_port]",$SQL_user,$SQL_passwd); |
return mysqli_connect("$server:$config[sql_port]",$SQL_user,$SQL_passwd,$config['sql_database']); |
} |
function da_sql_connect($config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
if (isset($config['sql_use_http_credentials']) && $config['sql_use_http_credentials'] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
$SQL_user = $config['sql_username']; |
$SQL_passwd = $config['sql_password']; |
} |
if ($config[sql_connect_timeout] != 0) |
@ini_set('mysql.connect_timeout',$config[sql_connect_timeout]); |
if ($config[sql_debug] == 'true') |
if ($config['sql_connect_timeout'] != 0) |
ini_set('mysql.connect_timeout',$config['sql_connect_timeout']); |
if ($config['sql_debug'] == 'true') |
print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n"; |
return @mysql_connect("$config[sql_server]:$config[sql_port]",$SQL_user,$SQL_passwd); |
return mysqli_connect("$config[sql_server]:$config[sql_port]",$SQL_user,$SQL_passwd,$config['sql_database']); |
} |
function da_sql_pconnect($config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
if (isset($config['sql_use_http_credentials']) && $config['sql_use_http_credentials'] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
$SQL_user = $config['sql_username']; |
$SQL_passwd = $config['sql_password']; |
} |
if ($config[sql_connect_timeout] != 0) |
@ini_set('mysql.connect_timeout',$config[sql_connect_timeout]); |
if ($config[sql_debug] == 'true') |
if ($config['sql_connect_timeout'] != 0) |
ini_set('mysql.connect_timeout',$config['sql_connect_timeout']); |
if ($config['sql_debug'] == 'true') |
print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n"; |
return @mysql_pconnect("$config[sql_server]:$config[sql_port]",$SQL_user,$SQL_passwd); |
return mysqli_connect($config['sql_server'],$SQL_user,$SQL_passwd,$config['sql_database'],$config['sql_port']); |
} |
function da_sql_close($link,$config) |
{ |
return @mysql_close($link); |
return mysqli_close($link); |
} |
function da_sql_escape_string($string) |
function da_sql_escape_string($link, $string) |
{ |
return @mysql_real_escape_string($string); |
return mysqli_real_escape_string($link, $string); |
} |
function da_sql_query($link,$config,$query) |
{ |
if ($config[sql_debug] == 'true') |
if ($config['sql_debug'] == 'true') |
print "<b>DEBUG(SQL,MYSQL DRIVER): Query: <i>$query</i></b><br>\n"; |
return @mysql_db_query($config[sql_database],$query,$link); |
return mysqli_query($link,$query); |
} |
function da_sql_num_rows($result,$config) |
{ |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: Num rows:: " . @mysql_num_rows($result) . "</b><br>\n"; |
return @mysql_num_rows($result); |
if ($config['sql_debug'] == 'true') |
print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: Num rows:: " . mysqli_num_rows($result) . "</b><br>\n"; |
return mysqli_num_rows($result); |
} |
function da_sql_fetch_array($result,$config) |
{ |
$row = array_change_key_case(@mysql_fetch_array($result, |
MYSQL_ASSOC),CASE_LOWER); |
if ($config[sql_debug] == 'true'){ |
$row = @array_change_key_case(mysqli_fetch_array($result, |
MYSQLI_ASSOC),CASE_LOWER); |
if ($config['sql_debug'] == 'true'){ |
print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: <pre>"; |
print_r($row); |
print "</b></pre>\n"; |
109,28 → 108,28 |
function da_sql_affected_rows($link,$result,$config) |
{ |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: Affected rows:: " . @mysql_affected_rows($result) . "</b><br>\n"; |
return @mysql_affected_rows($link); |
if ($config['sql_debug'] == 'true') |
print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: Affected rows:: " . mysqli_affected_rows($result) . "</b><br>\n"; |
return mysqli_affected_rows($link); |
} |
function da_sql_list_fields($table,$link,$config) |
{ |
return @mysql_list_fields($config[sql_database],$table); |
return da_sql_query($link, $config, "SHOW COLUMNS FROM $table"); |
} |
function da_sql_num_fields($fields,$config) |
{ |
return @mysql_num_fields($fields); |
return mysqli_num_fields($fields); |
} |
function da_sql_field_name($fields,$num,$config) |
{ |
return @mysql_field_name($fields,$num); |
return mysqli_fetch_field_direct($fields,$num); |
} |
function da_sql_error($link,$config) |
{ |
return @mysql_error($link); |
return mysqli_error($link); |
} |
?> |
/web/acc/manager/lib/sql/find.php |
---|
8,18 → 8,19 |
unset($found_users); |
$link = @da_sql_pconnect($config); |
$link = da_sql_pconnect($config); |
if ($link){ |
$search = da_sql_escape_string($search); |
if (!is_numeric($max)) |
$search = da_sql_escape_string($link, $search); |
if (!isset($max) || !is_numeric($max)) |
# $max = 10; |
# modif by MG fo Alcasar |
$max = 40; |
if ($max > 500) |
$max = 10; |
if (($search_IN == 'name' || $search_IN == 'department' || $search_IN == 'username') && |
$config[sql_use_user_info_table] == 'true'){ |
$res = @da_sql_query($link,$config, |
$config['sql_use_user_info_table'] == 'true'){ |
$res = da_sql_query($link,$config, |
"SELECT " . da_sql_limit($max,0,$config) . " username FROM $config[sql_user_info_table] WHERE |
lower($search_IN) LIKE '%$search%' " . |
# da_sql_limit($max,1,$config) . " " . da_sql_limit($max,2,$config) . " ;"); |
26,8 → 27,8 |
# modif by MG for Alcasar |
da_sql_limit($max,1,$config) . " " . da_sql_limit($max,1,$config) . " ;"); |
if ($res){ |
while(($row = @da_sql_fetch_array($res,$config))) |
$found_users[] = $row[username]; |
while(($row = da_sql_fetch_array($res,$config))) |
$found_users[] = $row['username']; |
} |
else |
"<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
38,15 → 39,15 |
$attrmap["$radius_attr"] = $radius_attr; |
$attr_type["$radius_attr"] = 'replyItem'; |
} |
$table = ($attr_type[$radius_attr] == 'checkItem') ? $config[sql_check_table] : $config[sql_reply_table]; |
$table = ($attr_type[$radius_attr] == 'checkItem') ? $config['sql_check_table'] : $config['sql_reply_table']; |
$attr = $attrmap[$radius_attr]; |
$attr = da_sql_escape_string($attr); |
$res = @da_sql_query($link,$config, |
$attr = da_sql_escape_string($link, $attr); |
$res = da_sql_query($link,$config, |
"SELECT " . da_sql_limit($max,0,$config) . " username FROM $table WHERE attribute = '$attr' |
AND value LIKE '%$search%' " . da_sql_limit($max,1,$config) . " " . da_sql_limit($max,2,$config) . " ;"); |
if ($res){ |
while(($row = @da_sql_fetch_array($res,$config))) |
$found_users[] = $row[username]; |
while(($row = da_sql_fetch_array($res,$config))) |
$found_users[] = $row['username']; |
} |
else |
"<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
/web/acc/manager/lib/sql/functions.php |
---|
0,0 → 1,35 |
<?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(); |
} |
require_once('../lib/xlat.php'); |
function connect2db($config) |
{ |
$link=da_sql_pconnect($config); |
return $link; |
} |
function get_user_info($link,$user,$config) |
{ |
if ($link && $config['sql_use_user_info_table'] == 'true'){ |
$user = da_sql_escape_string($link, $user); |
$res=da_sql_query($link,$config, |
"SELECT name FROM $config[sql_user_info_table] WHERE username = '$user';"); |
if ($res){ |
$row = da_sql_fetch_array($res,$config); |
if ($row) |
return $row['name']; |
} |
} |
} |
function closedb($link,$config) |
{ |
return 1; |
} |
?> |
/web/acc/manager/lib/sql/group_admin.php |
---|
0,0 → 1,46 |
<?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(); |
} |
$link = da_sql_pconnect($config); |
if ($link){ |
if (isset($del_members)){ |
foreach ($del_members as $del){ |
$del = da_sql_escape_string($link, $del); |
$res = da_sql_query($link,$config, |
"DELETE FROM $config[sql_usergroup_table] WHERE username = '$del' AND groupname = '$login';"); |
if (!$res) |
echo "<b>Could not delete user $del from group: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
} |
if ($new_members != ''){ |
$Members = preg_split("/[\n\s]+/",$new_members,-1,PREG_SPLIT_NO_EMPTY); |
if (!empty($Members)){ |
foreach ($Members as $new_member){ |
$new_member = da_sql_escape_string($link, $new_member); |
$res = da_sql_query($link,$config, |
"SELECT username FROM $config[sql_usergroup_table] WHERE |
username = '$new_member' AND groupname = '$login';"); |
if ($res){ |
if (da_sql_num_rows($res,$config)) |
echo "<b>User $new_member already is a member of the group</b><br>\n"; |
else{ |
$res = da_sql_query($link,$config, |
"INSERT INTO $config[sql_usergroup_table] (groupname,username) |
VALUES ('$login','$new_member');"); |
if (!$res) |
echo "<b>Error while adding user $new_member to group: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
} |
else |
echo "<b>Could not add new member $new_member: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
} |
} |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
?> |
/web/acc/manager/lib/sql/group_change.php |
---|
0,0 → 1,40 |
<?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(); |
} |
$link = da_sql_pconnect($config); |
if ($link){ |
if (isset($member_groups) && isset($edited_groups)){ |
$del_groups = array_diff($member_groups,$edited_groups); |
if (isset($del_groups)){ |
foreach ($del_groups as $del){ |
$del = da_sql_escape_string($del); |
$res = da_sql_query($link,$config, |
"DELETE FROM $config[sql_usergroup_table] WHERE username = '$login' AND groupname = '$del';"); |
if (!$res) |
echo "<b>Could not delete user $login from group $del: " . da_sql_error($link,$config) . "</b><br>\n"; |
else |
echo "<b>User $login deleted from group $del</b><br>\n"; |
} |
} |
$new_groups = array_diff($edited_groups,$member_groups); |
if (isset($new_groups)){ |
foreach($new_groups as $new){ |
$new = da_sql_escape_string($new); |
$res = da_sql_query($link,$config, |
"INSERT INTO $config[sql_usergroup_table] (groupname,username) |
VALUES ('$new','$login');"); |
if (!$res) |
echo "<b>Error while adding user $login to group $login: " . da_sql_error($link,$config) . "</b><br>\n"; |
else |
echo "<b>User $login added to group $new</b><br>\n"; |
} |
} |
} |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
?> |
/web/acc/manager/lib/sql/group_info.php |
---|
6,7 → 6,7 |
echo "<b>Could not include SQL library</b><br>\n"; |
exit(); |
} |
if ($config[sql_use_operators] == 'true'){ |
if ($config['sql_use_operators'] == 'true'){ |
$op = ',op'; |
$use_op = 1; |
}else{ |
14,18 → 14,18 |
$use_op = 0; |
} |
$group_exists = 'no'; |
$link = @da_sql_pconnect($config); |
$link = da_sql_pconnect($config); |
if ($link){ |
if ($login == ''){ |
if (!isset($login) || $login == ''){ |
unset($existing_groups); |
$res = @da_sql_query($link,$config, |
$res = da_sql_query($link,$config, |
"SELECT COUNT(*) as counter,groupname FROM $config[sql_usergroup_table] |
GROUP BY groupname;"); |
if ($res){ |
while(($row = @da_sql_fetch_array($res,$config))){ |
$name = $row[groupname]; |
$existing_groups["$name"] = $row[counter]; |
while(($row = da_sql_fetch_array($res,$config))){ |
$name = $row['groupname']; |
$existing_groups["$name"] = $row['counter']; |
} |
if (isset($existing_groups)) |
ksort($existing_groups); |
39,14 → 39,15 |
unset($group_members); |
unset($existing_groups); |
$res = @da_sql_query($link,$config, |
$res = da_sql_query($link,$config, |
"SELECT attribute,value $op FROM $config[sql_groupcheck_table] WHERE groupname = '$login';"); |
if ($res){ |
if (@da_sql_num_rows($res,$config)) |
if (da_sql_num_rows($res,$config)) |
$group_exists = 'yes'; |
while(($row = @da_sql_fetch_array($res,$config))){ |
$attr = $row[attribute]; |
$val = $row[value]; |
while(($row = da_sql_fetch_array($res,$config))){ |
$attr = $row['attribute']; |
$val = $row['value']; |
if(!isset($tmp["$attr"]['count'])) $tmp["$attr"]['count'] = 0; |
/*Ajout en vue de l'impression des données (thank's to Geoffroy MUSITELLI)*/ |
if($attr == "Max-All-Session") $mas_imp = $val; |
if($attr == "Max-Daily-Session") $mds_imp = $val; |
54,40 → 55,41 |
if($attr == "Expiration") $Expiration = $val; |
/*Fin Ajout*/ |
if ($use_op){ |
$oper = $row[op]; |
$tmp["$attr"][operator][]="$oper"; |
$oper = $row['op']; |
$tmp["$attr"]['operator'][]="$oper"; |
} |
$tmp["$attr"][]="$val"; |
$tmp["$attr"][count]++; |
$tmp["$attr"]['count']++; |
} |
$res = @da_sql_query($link,$config, |
$res = da_sql_query($link,$config, |
"SELECT attribute,value $op FROM $config[sql_groupreply_table] WHERE groupname = '$login';"); |
if ($res){ |
if (@da_sql_num_rows($res,$config)) |
if (da_sql_num_rows($res,$config)) |
$group_exists = 'yes'; |
while(($row = @da_sql_fetch_array($res,$config))){ |
$attr = $row[attribute]; |
$val = $row[value]; |
while(($row = da_sql_fetch_array($res,$config))){ |
$attr = $row['attribute']; |
$val = $row['value']; |
if(!isset($tmp["$attr"]['count'])) $tmp["$attr"]['count'] = 0; |
/*Ajout en vue de l'impression des données (thank's to Geoffroy MUSITELLI)*/ |
if($attr == "Session-Timeout") $sto_imp = $val; |
/*Fin Ajout*/ |
if ($use_op){ |
$oper = $row[op]; |
$tmp["$attr"][operator][]="$oper"; |
$oper = $row['op']; |
$tmp["$attr"]['operator'][]="$oper"; |
} |
$tmp["$attr"][] = "$val"; |
$tmp["$attr"][count]++; |
$tmp["$attr"]['count']++; |
} |
} |
else |
echo "<b>Database query failed partially: " . da_sql_error($link,$config) . "</b><br>\n"; |
$res = @da_sql_query($link,$config, |
$res = da_sql_query($link,$config, |
"SELECT username FROM $config[sql_usergroup_table] WHERE groupname = '$login' ORDER BY username;"); |
if ($res){ |
if (@da_sql_num_rows($res,$config)) |
if (da_sql_num_rows($res,$config)) |
$group_exists = 'yes'; |
while(($row = @da_sql_fetch_array($res,$config))){ |
$member = $row[username]; |
while(($row = da_sql_fetch_array($res,$config))){ |
$member = $row['username']; |
$group_members[] = "$member"; |
} |
} |
105,9 → 107,9 |
$rev_attrmap["$val"] = $key; |
} |
$item_vals["$key"] = $tmp[$val]; |
$item_vals["$key"][count] = $tmp[$val][count]; |
$item_vals["$key"]['count'] = $tmp[$val]['count']; |
if ($use_op) |
$item_vals["$key"][operator] = $tmp[$val][operator]; |
$item_vals["$key"]['operator'] = $tmp[$val]['operator']; |
} |
} |
} |
/web/acc/manager/lib/sql/nas_list.php |
---|
0,0 → 1,62 |
<?php |
require('/etc/freeradius-web/config.php'); |
require_once('../lib/functions.php'); |
unset($da_name_cache); |
if (isset($_SESSION['da_name_cache'])) |
$da_name_cache = $_SESSION['da_name_cache']; |
if ($config[sql_nas_table] != ''){ |
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(); |
} |
$link = da_sql_pconnect($config); |
if ($link){ |
$auth_user = $_SERVER["PHP_AUTH_USER"]; |
$extra = ''; |
if (isset($mappings[$auth_user][nasdb])){ |
$NAS_ARR = array(); |
$NAS_ARR = preg_split('/,/',$mappings[$auth_user][nasdb]); |
$extra = 'WHERE nasname IN ('; |
foreach ($NAS_ARR as $nas) |
$extra .= "'$nasname',"; |
unset($NAS_ARR); |
$extra = rtrim($extra,","); |
$extra .= ')'; |
} |
$search = da_sql_query($link,$config, |
"SELECT * FROM $config[sql_nas_table] $extra;"); |
if ($search){ |
while($row = da_sql_fetch_array($search,$config)){ |
$num = 0; |
$my_nas_name = $row['nasname']; |
if ($my_nas_name != ''){ |
$nas_list[$my_nas_name]['name'] = $my_nas_name; |
$nas_server = $da_name_cache[$my_nas_name]; |
if (!isset($nas_server)){ |
if (!check_ip($my_nas_name)) |
$nas_server = @gethostbyname($my_nas_name); |
else |
$nas_server = $my_nas_name; |
if (!isset($da_name_cache) && $config[general_use_session] == 'yes'){ |
$da_name_cache[$my_nas_name] = $nas_server; |
session_register('da_name_cache'); |
} |
} |
if ($nas_server != $my_nas_name || check_ip($nas_server)) |
$nas_list[$my_nas_name]['ip'] = $nas_server; |
$nas_list[$my_nas_name]['port_num'] = $row['ports']; |
$nas_list[$my_nas_name]['community'] = $row['community']; |
$nas_list[$my_nas_name]['model'] = $row['description']; |
} |
} |
} |
} |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
} |
?> |
/web/acc/manager/lib/sql/password_check.php |
---|
7,17 → 7,17 |
exit(); |
} |
if ($action == 'checkpass'){ |
$link = @da_sql_pconnect($config); |
if (isset($action) && $action == 'checkpass'){ |
$link = da_sql_pconnect($config); |
if ($link){ |
$res = @da_sql_query($link,$config, |
$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); |
$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]; |
$enc_passwd = $row['value']; |
$passwd = da_encrypt($passwd,$enc_passwd); |
if ($passwd == $enc_passwd) |
$msg = '<font color=blue><b>YES It is that</b></font>'; |
/web/acc/manager/lib/sql/user_info.php |
---|
0,0 → 1,122 |
<?php |
require('../lib/sql/attrmap.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 ($config['sql_use_operators'] == 'true'){ |
$op = ',op'; |
$use_op = 1; |
}else{ |
$op = ""; |
$use_op = 0; |
} |
$user_exists = 'no'; |
$cn = '-'; |
$cn_lang = '-'; |
$address = '-'; |
$address_lang = '-'; |
$homeaddress = '-'; |
$homeaddress_lang = '-'; |
$fax = '-'; |
$url = '-'; |
$ou = '-'; |
$ou_lang = '-'; |
$title = '-'; |
$title_lang = '-'; |
$telephonenumber = '-'; |
$homephone = '-'; |
$mobile = '-'; |
$mail = '-'; |
$mailalt = '-'; |
$user_password_exists = 'no'; |
unset($item_vals); |
unset($tmp); |
$link = da_sql_pconnect($config); |
if ($link){ |
$res = da_sql_query($link,$config, |
"SELECT attribute,value $op FROM $config[sql_check_table] WHERE username = '$login';"); |
if ($res){ |
if (da_sql_num_rows($res,$config)) |
$user_exists = 'yes'; |
while(($row = da_sql_fetch_array($res,$config))){ |
$attr = $row['attribute']; |
$val = $row['value']; |
if(!isset($tmp["$attr"]['count'])) $tmp["$attr"]['count'] = 0; |
if ($attr == $config['sql_password_attribute'] && $val != '') |
$user_password_exists = 'yes'; |
if ($use_op){ |
$oper = $row['op']; |
$tmp["$attr"]['operator'][]="$oper"; |
} |
$tmp["$attr"][]="$val"; |
$tmp["$attr"]['count']++; |
} |
$res = da_sql_query($link,$config, |
"SELECT attribute,value $op FROM $config[sql_reply_table] WHERE username = '$login';"); |
if ($res){ |
if (da_sql_num_rows($res,$config)) |
$user_exists = 'yes'; |
while(($row = da_sql_fetch_array($res,$config))){ |
$attr = $row['attribute']; |
$val = $row['value']; |
if(!isset($tmp["$attr"]['count'])) $tmp["$attr"]['count'] = 0; |
if ($use_op){ |
$oper = $row['op']; |
$tmp["$attr"]['operator'][]="$oper"; |
} |
$tmp["$attr"][] = "$val"; |
$tmp["$attr"]['count']++; |
} |
if ($config['sql_use_user_info_table'] == 'true'){ |
$res = da_sql_query($link,$config, |
"SELECT * FROM $config[sql_user_info_table] WHERE username = '$login';"); |
if ($res){ |
if (da_sql_num_rows($res,$config)){ |
$user_exists = 'yes'; |
$user_info = 1; |
} |
if (($row = da_sql_fetch_array($res,$config))){ |
$cn = ($row['name'] != '') ? $row['name'] : '-'; |
$telephonenumber = ($row['workphone'] != '') ? $row['workphone'] : '-'; |
$homephone = ($row['homephone'] != '') ? $row['homephone'] : '-'; |
$ou = ($row['department'] != '') ? $row['department'] : '-'; |
$mail = ($row['mail'] != '') ? $row['mail'] : '-'; |
$mobile = ($row['mobile'] != '') ? $row['mobile'] : '-'; |
} |
} |
else |
echo "<b>Database query failed partially: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
} |
else |
echo "<b>Database query failed partially: " . da_sql_error($link,$config) . "</b><br>\n"; |
if (isset($tmp)){ |
foreach(array_keys($tmp) as $val){ |
if ($val == '') |
continue; |
if(isset($rev_attrmap["$val"])) $key = $rev_attrmap["$val"]; |
if ($key == ''){ |
$key = $val; |
$attrmap["$key"] = $val; |
$attr_type["$key"] = 'replyItem'; |
$rev_attrmap["$val"] = $key; |
} |
$item_vals["$key"] = $tmp[$val]; |
if(isset($tmp["$attr"]['count']) && isset($item_vals["$key"]['count'])) $item_vals["$key"]['count'] = $tmp[$val]['count']; |
if ($use_op) |
$item_vals["$key"]['operator'] = $tmp[$val]['operator']; |
} |
} |
} |
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"; |
?> |
/web/acc/manager/lib/xlat.php |
---|
0,0 → 1,16 |
<?php |
function xlat($filter,$login,$config) |
{ |
$string = $filter; |
if ($filter != ''){ |
$string = preg_replace('/%u/',$login,$string); |
$string = preg_replace('/%U/',$_SERVER["PHP_AUTH_USER"],$string); |
$string = preg_replace('/%ma/',$mappings[$http_user]['accounting'],$string); |
$string = preg_replace('/%mu/',$mappings[$http_user]['userdb'],$string); |
$string = preg_replace('/%mn/',$mappings[$http_user]['nasdb'],$string); |
$string = preg_replace('/%mN/',$mappings[$http_user]['nasadmin'],$string); |
} |
return $string; |
} |
?> |