* Default values in SQL are now extracted from the group membership. Added a lib/sql/defaults.php3 file.
As a result the default operator is not '=' anymore but whatever we find in the group check and reply tables.
* In lib/sql/user_info.php3 set user_exists in more than one places.
* Add support for the '=*' and '!*' operators
* Added a HELP_WANTED file describing what are the major things missing which people could contribute.
* Updated TODO
Alex Savguira: alexs@ravdata.com
Ido Shavit
-Patches for auto generate password and sql group support
+Patches for auto generate password
+Ver 1.50:
+* Add support for groups in SQL. Added several new files and modified a few more.
+* Default values in SQL are now extracted from the group membership. Added a lib/sql/defaults.php3 file.
+ As a result the default operator is not '=' anymore but whatever we find in the group check and reply tables.
+* In lib/sql/user_info.php3 set user_exists in more than one places.
+* Add support for the '=*' and '!*' operators
+* Added a HELP_WANTED file describing what are the major things missing which people could contribute.
+* Updated TODO
Ver 1.30:
* Add limit of results returned in accounting.php3
* Fix a bug in time2strclock() in lib/functions.php3. Seconds ammount more than 9 would not show.
--- /dev/null
+What you can contribute:
+
+o Billing and statistics pages. Fancy bars and diagrams are needed for dialup_admin to be complete.
+
+o Documentation.
+
+o Attribute help pages like those that already exist.
sql db if it cannot get user info from the nas server
* Check out dbx library. It seems very promising for database independent code.
We 'll see where it goes.
+* Add billing and statistics pages. Billing is a must. The page should also create
+ reports which could be printed or sent by email to the users containing their billing
+ information. We also need more statistics pages with fancy bars and diagrams. Ideas
+ are welcome.
#Callback-Id
#Framed-IPX-Network
#Class
-Session-Timeout Session Timeout
-Idle-Timeout Idle Timeout
+Session-Timeout <a href="help/session_timeout_help.html" target=st_help onclick=window.open("help/session_timeout_help.html","st_help","width=600,height=170,toolbar=no,scrollbars=no,resizable=yes") title="Session Timeout Help Page"><font color="blue">Session Timeout</font></a>
+Idle-Timeout <a href="help/idle_timeout_help.html" target=it_help onclick=window.open("help/idle_timeout_help.html","it_help","width=600,height=170,toolbar=no,scrollbars=no,resizable=yes") title="Idle Timeout Help Page"><font color="blue">Idle Timeout</font></a>
#Termination-Action
#Login-LAT-Service
#Login-LAT-Node
<a id="a9" href="user_new.php3" target="content" title="Create New User">New User</a>
</td></tr>
<tr align=left><td><img src="images/black.gif" vspace=2 hspace=0 width=80 height=1></td></tr>
+</form>
+<form action="group_admin.php3" method=get target="content">
+ <tr align=left><td id="menu11" onmouseover='myin("11");' onmouseout='myout("11");'>
+ <a id="a11" href="group_admin.php3" target="content" title="Group Administration">Edit Group</a>
+ <img align=top src="images/black.gif" vspace=7 hspace=0 width=1 height=1><br>
+ <input type="text" size=11 name="login" target="content">
+ </td></tr>
+ <tr align=left><td id="menu12" onmouseover='myin("12");' onmouseout='myout("12");'>
+ <a id="a12" href="group_new.php3" target="content" title="Create New Group">New Group</a>
+ </td></tr>
+ <tr align=left><td><img src="images/black.gif" vspace=2 hspace=0 width=80 height=1></td></tr>
<tr align=left><td id="menu10" onmouseover='myin("10");' onmouseout='myout("10");'>
<a id="a10" href="user_test.php3?login=da_server_test&test_user=1" target="content" title="Check Server Response">Check Server</a>
</td></tr>
--- /dev/null
+<?php
+require('../conf/config.php3');
+if ($config[general_lib_type] != 'sql'){
+ echo <<<EOM
+<title>Group Administration Page</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<b>This page is only available if you are using sql as general library type</b>
+</body>
+</html>
+EOM;
+ exit();
+}
+
+if (is_file("../lib/$config[general_lib_type]/group_info.php3")){
+ include("../lib/$config[general_lib_type]/group_info.php3");
+ if ($group_exists == 'no'){
+ echo <<<EOM
+<title>Group Administration Page</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<form action="group_admin.php3" method=get>
+<b>Group Name </b>
+<input type="text" size=10 name="login" value="$login">
+<b> does not exist</b><br>
+<input type=submit class=button value="Show Group">
+</body>
+</html>
+EOM;
+ exit();
+ }
+}
+?>
+
+<html>
+<head>
+<title>Group Administration Page</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=550 cellpadding=0 cellspacing=0>
+<tr valign=top>
+<td align=center><img src="images/title2.gif"></td>
+</tr>
+</table>
+<table border=0 width=400 cellpadding=0 cellspacing=2>
+
+<?php
+include("../html/group_toolbar.html.php3");
+?>
+
+</table>
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=200>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Group <?php echo $login ?> Administration</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+
+<?php
+if ($do_changes == 1){
+ if (is_file("../lib/$config[general_lib_type]/group_admin.php3"))
+ include("../lib/$config[general_lib_type]/group_admin.php3");
+ if (is_file("../lib/$config[general_lib_type]/group_info.php3"))
+ include("../lib/$config[general_lib_type]/group_info.php3");
+}
+?>
+
+
+ <form method=post>
+ <input type=hidden name=login value=<?php echo $login ?>>
+ <input type=hidden name=do_changes value=0>
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+<tr>
+<td align=right bgcolor="#d0ddb0">
+Group Members (Check to Delete)
+</td>
+<td>
+<select name=del_members[] multiple size=5>
+<?php
+foreach ($group_members as $member){
+ echo "<option value=\"$member\">$member\n";
+}
+?>
+</select>
+</td>
+</tr>
+<tr>
+<td align=right bgcolor="#d0ddb0">
+New Group Member
+</td>
+<td>
+<input type=text name=new_member value="" size=25>
+</td>
+</tr>
+ </table>
+<br>
+<input type=submit class=button value="Commit Changes" OnClick="this.form.do_changes.value=1">
+</form>
+</td></tr>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<?php
+if ($show == 1){
+ header("Location: group_admin.php3?login=$login");
+ exit;
+}
+require('../conf/config.php3');
+require('../lib/attrshow.php3');
+require('../lib/defaults.php3');
+
+if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
+ $colspan=2;
+ $show_ops=1;
+}else{
+ $show_ops = 0;
+ $colspan=1;
+}
+
+?>
+
+<html>
+<head>
+<title>New group creation page</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=550 cellpadding=0 cellspacing=0>
+<tr valign=top>
+<td align=center><img src="images/title2.gif"></td>
+</tr>
+</table>
+
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=200>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Preferences for new group</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+
+<?php
+if (is_file("../lib/$config[general_lib_type]/group_info.php3"))
+ include("../lib/$config[general_lib_type]/group_info.php3");
+if ($create == 1){
+ if ($group_exists != "no"){
+ echo <<<EOM
+<b>The group <i>$login</i> already exists in the group database</b>
+EOM;
+ }
+ else{
+ if (is_file("../lib/$config[general_lib_type]/create_group.php3"))
+ include("../lib/$config[general_lib_type]/create_group.php3");
+ if (is_file("../lib/$config[general_lib_type]/group_info.php3"))
+ include("../lib/$config[general_lib_type]/group_info.php3");
+ }
+}
+?>
+ <form method=post>
+ <input type=hidden name=create value="0">
+ <input type=hidden name=show value="0">
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+<?php
+ echo <<<EOM
+ <tr>
+ <td align=right colspan=$colspan bgcolor="#d0ddb0">
+ Group name
+ </td><td>
+ <input type=text name="login" value="$login" size=35>
+ </td>
+ </tr>
+ <tr>
+ <td align=right colspan=$colspan bgcolor="#d0ddb0">
+ First member
+ </td><td>
+ <input type=text name="member" value="" size=35>
+ </td>
+ </tr>
+
+EOM;
+ foreach($show_attrs as $key => $desc){
+ $name = $attrmap["$key"];
+ if ($name == 'none')
+ continue;
+ $oper_name = $name . '_op';
+ $val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"];
+ print <<<EOM
+<tr>
+<td align=right bgcolor="#d0ddb0">
+$desc
+</td>
+EOM;
+
+ if ($show_ops)
+ print <<<EOM
+<td>
+<select name=$oper_name>
+<option selected value="=">=
+<option value=":=">:=
+<option value="+=">+=
+<option value="==">==
+<option value="!=">!=
+<option value=">">>
+<option value=">=">>=
+<option value="<"><
+<option value="<="><=
+<option value="=~">=~
+<option value="!~">!~
+
+</select>
+</td>
+EOM;
+
+ print <<<EOM
+<td>
+<input type=text name="$name" value="$val" size=35>
+</td>
+</tr>
+EOM;
+ }
+?>
+ </table>
+<br>
+<input type=submit class=button value="Create" OnClick="this.form.create.value=1">
+<br><br>
+<input type=submit class=button value="Show Group" OnClick="this.form.show.value=1">
+</form>
+ </td></tr>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Idle Timeout Help Page</title>
+<link rel="stylesheet" href="../style.css">
+</head>
+<body bgcolor="#80a040" background="../images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=400>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th><font color="white">Idle Timeout Help Page</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>
+<br>
+<center>
+<pre>
+ This Attribute sets the maximum number of consecutive seconds of
+ idle connection allowed to the user before termination of the
+ session or prompt.
+</pre>
+</td></tr>
+<tr><td align=center>
+<a href="javascript:window.close();"><b>Close Window</b></a>
+</td></tr>
+</center>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Session Timeout Help Page</title>
+<link rel="stylesheet" href="../style.css">
+</head>
+<body bgcolor="#80a040" background="../images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=400>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th><font color="white">Session Timeout Help Page</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>
+<br>
+<center>
+<pre>
+ This Attribute sets the maximum number of seconds of service to be
+ provided to the user before termination of the session or prompt.
+</pre>
+</td></tr>
+<tr><td align=center>
+<a href="javascript:window.close();"><b>Close Window</b></a>
+</td></tr>
+</center>
+</table>
+</tr>
+</table>
+</body>
+</html>
<?php
require('../conf/config.php3');
-if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
- include("../lib/$config[general_lib_type]/user_info.php3");
+if ($type != 'group')
+ if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
+ include("../lib/$config[general_lib_type]/user_info.php3");
+else
+ if (is_file("../lib/$config[general_lib_type]/group_info.php3"))
+ include("../lib/$config[general_lib_type]/group_info.php3");
+
+$whatis = ($user_type == 'group') ? 'group' : 'user';
+$whatisL = ($user_type == 'group') ? 'Group' : 'User';
echo <<<EOM
<html>
<head>
-<title>delete user $login ($cn)</title>
+EOM;
+
+if ($user_type != 'group')
+ echo "<title>delete user $login ($cn)</title>\n";
+else
+ echo "<title>delete group $login</title>\n";
+
+echo <<<EOM
<link rel="stylesheet" href="style.css">
</head>
<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
<table border=0 width=400 cellpadding=0 cellspacing=2>
EOM;
-include("../html/user_toolbar.html.php3");
+if ($user_type != 'group')
+ include("../html/user_toolbar.html.php3");
+else
+ include("../html/group_toolbar.html.php3");
print <<<EOM
</table>
<td bgcolor="black" width=200>
<table border=0 width=100% cellpadding=2 cellspacing=0>
<tr bgcolor="#907030" align=right valign=top><th>
- <font color="white">User $login Deletion</font>
+ <font color="white">$whatisL $login Deletion</font>
</th></tr>
</table>
</td></tr>
EOM;
if ($delete_user == 1){
- if (is_file("../lib/$config[general_lib_type]/delete_user.php3"))
- include("../lib/$config[general_lib_type]/delete_user.php3");
+ if ($user_type != 'group'){
+ if (is_file("../lib/$config[general_lib_type]/delete_user.php3"))
+ include("../lib/$config[general_lib_type]/delete_user.php3");
+ }
+ else{
+ if (is_file("../lib/$config[general_lib_type]/delete_group.php3"))
+ include("../lib/$config[general_lib_type]/delete_group.php3");
+ }
echo <<<EOM
</td></tr>
</table>
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
<tr>
<td align=center>
-Are you sure you want to delete user <?php echo $login; ?> ?
+Are you sure you want to delete <?php echo "$whatis $login"; ?> ?
</td>
</tr>
</table>
<?php
+if ($edit_group == 1){
+ header("Location: group_admin.php3?login=$group_to_edit");
+ exit;
+}
require('../conf/config.php3');
require('../lib/attrshow.php3');
require('../lib/defaults.php3');
-if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
- include("../lib/$config[general_lib_type]/user_info.php3");
+if ($user_type != 'group'){
+ if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
+ include("../lib/$config[general_lib_type]/user_info.php3");
+}
+else{
+ if (is_file("../lib/$config[general_lib_type]/group_info.php3"))
+ include("../lib/$config[general_lib_type]/group_info.php3");
+}
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
$colspan=2;
$show_ops = 1;
echo <<<EOM
<html>
<head>
-<title>subscription configuration for $login ($cn)</title>
+EOM;
+
+if ($user_type != 'group')
+ echo " <title>subscription configuration for $login ($cn)</title>\n";
+else
+ echo " <title>subscription configuration for $login</title>\n";
+
+echo <<<EOM
<link rel="stylesheet" href="style.css">
</head>
<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
EOM;
-include("password_generator.jsc");
+if ($user_type != 'group')
+ include("password_generator.jsc");
echo <<<EOM
<center>
<table border=0 width=400 cellpadding=0 cellspacing=2>
EOM;
-include("../html/user_toolbar.html.php3");
+if ($user_type != 'group')
+ include("../html/user_toolbar.html.php3");
+else
+ include("../html/group_toolbar.html.php3");
print <<<EOM
</table>
if ($change == 1){
if (is_file("../lib/$config[general_lib_type]/change_attrs.php3"))
include("../lib/$config[general_lib_type]/change_attrs.php3");
- if ($passwd != '' && is_file("../lib/$config[general_lib_type]/change_passwd.php3"))
- include("../lib/$config[general_lib_type]/change_passwd.php3");
- if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
- include("../lib/$config[general_lib_type]/user_info.php3");
+ if ($user_type != 'group'){
+ if ($passwd != '' && is_file("../lib/$config[general_lib_type]/change_passwd.php3"))
+ include("../lib/$config[general_lib_type]/change_passwd.php3");
+ if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
+ include("../lib/$config[general_lib_type]/user_info.php3");
+ }
+ else{
+ if (is_file("../lib/$config[general_lib_type]/group_info.php3"))
+ include("../lib/$config[general_lib_type]/group_info.php3");
+ }
}
else if ($badusers == 1){
if (is_file("../lib/add_badusers.php3"))
?>
<form method=post>
<input type=hidden name=login value=<?php print $login ?>>
+ <input type=hidden name=user_type value=<?php print $user_type ?>>
<input type=hidden name=change value="0">
<input type=hidden name=add value="0">
<input type=hidden name=badusers value="0">
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+<?php
+if ($user_type != 'group'){
+ echo <<<EOM
<tr>
-<td align=right colspan=<?php print $colspan ?> bgcolor="#d0ddb0">
+<td align=right colspan=$colspan bgcolor="#d0ddb0">
User Password (changes only)
</td>
<td>
<input type=password name=passwd value="" size=40>
</td>
</tr>
-<?php
+EOM;
+}
foreach($show_attrs as $key => $desc){
$name = $attrmap["$key"];
if ($name == 'none')
}
else{
$vals[] = $default_vals["$key"];
- $ops[] = '=';
+ $ops[] = ($default_vals["$key"][operator] != '') ? $default_vals["$key"][operator] : '=';
}
if ($add && $name == $add_attr){
array_push($vals, $default_vals["$key"]);
<option $selected[$op_le] value="<="><=
<option $selected[$op_regeq] value="=~">=~
<option $selected[$op_regne] value="!~">!~
+<option $selected[$op_exst] value="=*">=*
+<option $selected[$op_nexst] value="!*">!*
</select>
</td>
EOM;
</select>
</td>
</tr>
+
+<?php
+if (isset($member_groups)){
+ echo <<<EOM
+<tr>
+<input type=hidden name=edit_group value=0>
+<td align=right colspan=$colspan bgcolor="#d0ddb0">
+Member of
+</td>
+<td>
+<select name="group_to_edit">
+EOM;
+ foreach ($member_groups as $group){
+ echo "<option value=\"$group\">$group\n";
+ }
+ echo <<<EOM
+</select>
+
+<input type=submit class=button value="Edit Group" OnClick="this.form.edit_group.value=1">
+</td>
+</tr>
+EOM;
+}
+?>
</table>
<br>
<input type=submit class=button value=Change OnClick="this.form.change.value=1">
+<?php
+if ($user_type != 'group'){
+ echo <<<EOM
<br><br>
<input type=submit class=button value="Add to Badusers" OnClick="this.form.badusers.value=1">
<br><br>
<input type="button" class=button value="Auto/Password" OnClick="generatepassword(this.form.passwd,8);">
+EOM;
+}
+?>
</form>
</td></tr>
</table>
--- /dev/null
+<?php
+print <<<EOM
+<tr valign=top>
+<td align=center bgcolor="black" width=100>
+<a href="group_admin.php3?login=$login" title="Administer Group"><font color="white"><b>ADMIN</b></font></a></td>
+<td align=center bgcolor="black" width=100>
+<a href="user_edit.php3?login=$login&user_type=group" title="Edit Group Dialup Settings"><font color="white"><b>EDIT</b></font></a></td>
+<td align=center bgcolor="black" width=100>
+<a href="user_delete.php3?login=$login&user_type=group" title="Delete Group"><font color="white"><b>DELETE</b></font></a></td>
+</tr>
+EOM;
+?>
$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).
case '<=':
case '=~':
case '!~':
+ case '=*':
+ case '!*':
return ($type == 1) ? 0 : -1;
}
}
$name = $attrmap["$key"] . $i;
$sql_attr=$attrmap["$key"];
+ $query_key = ($user_type == 'group') ? 'GroupName' : 'UserName';
if ($attr_type["$key"] == 'checkItem'){
- $table = $config[sql_check_table];
+ $table = ($user_type == 'group') ? $config[sql_groupcheck_table] : $config[sql_check_table];
$type = 1;
}
else if ($attr_type["$key"] == 'replyItem'){
- $table = $config[sql_reply_table];
+ $table = ($user_type == 'group') ? $config[sql_groupreply_table] : $config[sql_reply_table];
$type = 2;
}
if ($use_ops){
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 UserName = '$login'
+ "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))
echo "<b>Operator change failed for attribute $key</b><br>\n";
// if value is null and corresponding value exists then delete
else if (($val == $default_vals["$key"] || $val == '') && isset($item_vals["$key"][$j])){
$res = @da_sql_query($link,$config,
- "DELETE FROM $table WHERE UserName = '$login' AND Attribute = '$sql_attr';");
+ "DELETE FROM $table WHERE $query_key = '$login' AND Attribute = '$sql_attr';");
if (!$res || !@da_sql_affected_rows($link,$res,$config))
echo "<b>Delete failed for attribute $key</b><br>\n";
}
if (isset($item_vals["$key"][$j])){
$old_val = $item_vals["$key"][$j];
$res = @da_sql_query($link,$config,
- "UPDATE $table SET Value = '$val' WHERE UserName = '$login' AND
+ "UPDATE $table SET Value = '$val' WHERE $query_key = '$login' AND
Attribute = '$sql_attr' AND Value = '$old_val';");
}
else
$res = @da_sql_query($link,$config,
- "INSERT INTO $table (UserName,Attribute,Value $text2)
+ "INSERT INTO $table ($query_key,Attribute,Value $text2)
VALUES ('$login','$sql_attr','$val' $op_val2);");
if (!$res || !@da_sql_affected_rows($link,$res,$config))
echo "<b>Change failed for attribute $key</b><br>\n";
--- /dev/null
+<?php
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo "<b>Could not include SQL library</b><br>\n";
+ exit();
+}
+if ($config[sql_use_operators] == 'true'){
+ include("../lib/operators.php3");
+ $text = ',op';
+ $passwd_op = ",':='";
+}
+$da_abort=0;
+$link = @da_sql_pconnect($config);
+if ($link){
+ $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)){
+ echo "<b>Unable to add group $login. SQL error</b><br>\n";
+ $da_abort=1;
+ }
+ if (!$da_abort){
+ foreach($show_attrs as $key => $attr){
+ if ($attrmap["$key"] == 'none')
+ continue;
+ if ($attr_type[$key] == 'checkItem'){
+ $table = "$config[sql_groupcheck_table]";
+ $type = 1;
+ }
+ else if ($attr_type[$key] == 'replyItem'){
+ $table = "$config[sql_groupreply_table]";
+ $type = 2;
+ }
+ $val = $$attrmap["$key"];
+ $op_name = $attrmap["$key"] . '_op';
+ $op_val = $$op_name;
+ if ($op_val != ''){
+ if (check_operator($op_val,$type) == -1){
+ echo "<b>Invalid operator ($op_val) for attribute $key</b><br>\n";
+ coninue;
+ }
+ $op_val = ",'$op_val'";
+ }
+ if ($val == '' || $val == $default_vals["$key"])
+ continue;
+ $res = @da_sql_query($link,$config,
+ "INSERT INTO $table (Attribute,Value,GroupName $text)
+ VALUES ('$attrmap[$key]','$val','$login' $op_val);");
+ if (!$res || !@da_sql_affected_rows($link,$res,$config))
+ echo "<b>Query failed for attribute $key</b><br>\n";
+ }
+ }
+ echo "<b>Group created successfully</b><br>\n";
+}
+else
+ echo "<b>Could not connect to database</b><br>\n";
+?>
--- /dev/null
+<?php
+require('../lib/sql/attrmap.php3');
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+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;
+}
+unset($item_vals);
+unset($tmp);
+$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)))
+ $member_groups[] = $row[GroupName];
+ }
+ if (isset($member_groups)){
+ foreach ($member_groups as $group){
+ $res = @da_sql_query($link,$config,
+ "SELECT Attribute,Value $op FROM $config[sql_groupcheck_table] WHERE GroupName = '$group';");
+ 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 = '$group';");
+ 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</b><br>\n";
+ }
+ else
+ echo "<b>Database query failed</b><br>\n";
+ foreach($attrmap as $key => $val){
+ if (isset($tmp[$val])){
+ if ($tmp[$val][0] != '')
+ $default_vals["$key"] = $tmp[$val][0];
+ if ($use_op)
+ if ($tmp[$val][operator][0] != '')
+ $default_vals["$key"][operator] = $tmp[$val][operator][0];
+ }
+ }
+ }
+ }
+}
+else
+ echo "<b>Could not connect to database</b><br>\n";
+?>
--- /dev/null
+<?php
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo "<b>Could not include SQL library</b><br>\n";
+ exit();
+}
+$link = @da_sql_pconnect($config);
+if ($link){
+ $res = @da_sql_query($link,$config,
+ "DELETE FROM $config[sql_groupreply_table] WHERE GroupName = '$login';");
+ if ($res){
+ $res = @da_sql_query($link,$config,
+ "DELETE FROM $config[sql_groupcheck_table] WHERE GroupName = '$login';");
+ if ($res){
+ $res = @da_sql_query($link,$config,
+ "DELETE FROM $config[sql_usergroup_table] WHERE GroupName = '$login';");
+ if ($res)
+ echo "<b>Group $login deleted successfully</b><br>\n";
+ else
+ echo "<b>Error deleting group $login from usergroup table</b><br>\n";
+ }
+ else
+ echo "<b>Error deleting group $login from group check table</b><br>\n";
+ }
+ else
+ echo "<b>Error deleting group $login from group reply table</b><br>\n";
+}
+else
+ echo "<b>Could not connect to database</b><br>\n";
+?>
$res = @da_sql_query($link,$config,
"DELETE FROM $config[sql_check_table] WHERE UserName = '$login';");
if ($res){
+ $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</b><br>\n";
if ($config[sql_use_user_info_table] == 'true'){
$res = @da_sql_query($link,$config,
"DELETE FROM $config[sql_user_info_table] WHERE UserName = '$login';");
--- /dev/null
+<?php
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+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){
+ $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. SQL Error</b><br>\n";
+ }
+ }
+ if ($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</b><br>\n";
+ }
+ }
+ else
+ echo "<b>Could not add new member $new_member. SQL Error</b><br>\n";
+ }
+}
+else
+ echo "<b>Could not connect to database</b><br>\n";
+?>
--- /dev/null
+<?php
+require('../lib/sql/attrmap.php3');
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+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;
+}
+$group_exists = 'no';
+unset($item_vals);
+unset($tmp);
+unset($group_members);
+$link = @da_sql_pconnect($config);
+if ($link){
+ $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))
+ $group_exists = 'yes';
+ 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 = '$login';");
+ if ($res){
+ if (@da_sql_num_rows($res,$config))
+ $group_exists = 'yes';
+ 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</b><br>\n";
+ $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))
+ $group_exists = 'yes';
+ while(($row = @da_sql_fetch_array($res,$config))){
+ $member = $row[UserName];
+ $group_members[] = "$member";
+ }
+ }
+ else
+ echo "<b>Database query failed partially</b><br>\n";
+ foreach($attrmap as $key => $val){
+ if (isset($tmp[$val])){
+ $item_vals["$key"] = $tmp[$val];
+ $item_vals["$key"][count] = $tmp[$val][count];
+ if ($use_op)
+ $item_vals["$key"][operator] = $tmp[$val][operator];
+
+ }
+ }
+
+ }
+ else
+ echo "<b>Database query failed</b><br>\n";
+}
+else
+ echo "<b>Could not connect to database</b><br>\n";
+?>
$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];
$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';
if (($row = @da_sql_fetch_array($res,$config))){
$cn = ($row[Name]) ? $row[Name] : '-';
$telephonenumber = ($row[WorkPhone]) ? $row[WorkPhone] : '-';