Subversion Repositories ALCASAR

Rev

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

Rev 1805 Rev 1831
Line 9... Line 9...
9
if ($link){
9
if ($link){
10
	if (isset($member_groups) && isset($edited_groups)){
10
	if (isset($member_groups) && isset($edited_groups)){
11
		$del_groups = array_diff($member_groups,$edited_groups);
11
		$del_groups = array_diff($member_groups,$edited_groups);
12
		if (isset($del_groups)){
12
		if (isset($del_groups)){
13
			foreach ($del_groups as $del){
13
			foreach ($del_groups as $del){
14
				$del = da_sql_escape_string($del);
14
				$del = da_sql_escape_string($link,$del);
15
				$res = da_sql_query($link,$config,
15
				$res = da_sql_query($link,$config,
16
			"DELETE FROM $config[sql_usergroup_table] WHERE username = '$login' AND groupname = '$del';");
16
			"DELETE FROM $config[sql_usergroup_table] WHERE username = '$login' AND groupname = '$del';");
17
				if (!$res)
17
				if (!$res)
18
					echo "<b>Could not delete user $login from group $del: " . da_sql_error($link,$config) . "</b><br>\n";
18
					echo "<b>Could not delete user $login from group $del: " . da_sql_error($link,$config) . "</b><br>\n";
19
				else
19
				else
Line 21... Line 21...
21
			}
21
			}
22
		}
22
		}
23
		$new_groups = array_diff($edited_groups,$member_groups);
23
		$new_groups = array_diff($edited_groups,$member_groups);
24
		if (isset($new_groups)){
24
		if (isset($new_groups)){
25
			foreach($new_groups as $new){
25
			foreach($new_groups as $new){
26
				$new = da_sql_escape_string($new);
26
				$new = da_sql_escape_string($link,$new);
27
				$res = da_sql_query($link,$config,
27
				$res = da_sql_query($link,$config,
28
				"INSERT INTO $config[sql_usergroup_table] (groupname,username)
28
				"INSERT INTO $config[sql_usergroup_table] (groupname,username)
29
				VALUES ('$new','$login');");
29
				VALUES ('$new','$login');");
30
				if (!$res)
30
				if (!$res)
31
					echo "<b>Error while adding user $login to group $login: " . da_sql_error($link,$config) . "</b><br>\n";
31
					echo "<b>Error while adding user $login to group $login: " . da_sql_error($link,$config) . "</b><br>\n";