@ -35,26 +35,27 @@ function getOtherUserGroups($user) {
}
function displayUserGroups($action, $name, $ugname, $delete, $add) {
if($action === 'search') {
if($action === 'search') {
$username = validateName($name);
if ($delete !== NULL & & $delete >= 0) {
$qry = 'DELETE FROM user_gruppe_zuordnung WHERE user_id in (SELECT id FROM user WHERE nickname = \''.$username.
if($username !== NULL) {
if ($delete !== NULL & & $delete >= 0) {
$qry = 'DELETE FROM user_gruppe_zuordnung WHERE user_id in (SELECT id FROM user WHERE nickname = \''.$username.
'\') AND gruppen_id = '.$delete.';';
mysql_query($qry);
} else if($add !== NULL & & $add >= 0) {
$qry = 'INSERT INTO user_gruppe_zuordnung(user_id, gruppen_id)
mysql_query($qry);
} else if($add !== NULL & & $add >= 0) {
$qry = 'INSERT INTO user_gruppe_zuordnung(user_id, gruppen_id)
VALUES((SELECT id FROM user WHERE nickname = \''.$username.'\'), '.$add.');';
mysql_query($qry);
}
mysql_query($qry);
}
$usergroups = getUserGroups($username);
$notusergroups = getOtherUserGroups($username);
$usergroups = getUserGroups($username);
$notusergroups = getOtherUserGroups($username);
?>
?>
< form action = " <?php echo $_SERVER [ 'PHP_SELF' ]; ?> " method = "POST" >
< input name = "choose" value = "usergroups" type = "hidden" > < / input >
< input name = "action" value = "search" type = "hidden" > < / input >
< input name = "uname" value = " <?php echo $username ; ?> " type = "hidden" > </input >
< input name = "choose" value = "usergroups" type = "hidden" > < / input > < input
name="action" value="search" type="hidden">< / input > < input
name="uname" value="<?php echo $username ; ?> " type="hidden"> </input >
< table width = "80%" >
< tr >
< th align = "center" colspan = "3" > User <?php echo $username ; ?> </ th >
@ -107,7 +108,9 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
< / tr >
< / table >
< / form >
<?php
<?php } else {
echo 'Ungültiger Username!< br > < a href = '.$_SERVER[' PHP_SELF ' ] . ' ? choose = usergroups > Zurü ck< / a > ';
}
} else if($action === 'show') {
$username = validateName($ugname);
$sqlqry = 'SELECT u.nickname FROM user_gruppe_zuordnung ugz
@ -122,7 +125,7 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
< tr >
< td colspan = "3" >
< table border = "1" width = "100%" >
<?php
<?php
echo '< tr > ';
$x = 0;
while($row = mysql_fetch_assoc($usergroups_qry)){
@ -154,15 +157,15 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
} else {
?>
< form action = " <?php echo $_SERVER [ 'PHP_SELF' ]; ?> " method = "POST" >
< input name = "choose" value = "usergroups" type = "hidden" > < / input >
< input name = "action" value = "search" type = "hidden" > < / input >
< input name = "choose" value = "usergroups" type = "hidden" > < / input > < input
name="action" value="search" type="hidden"> < / input >
< table width = "80%" >
< tr >
< th align = "center" colspan = "3" > User suchen< / th >
< / tr >
< tr >
< td align = "center" > Username: < input name = "uname" value = "" / >
< input type = "submit" value = "search" / >
< td align = "center" > Username: < input name = "uname" value = "" / > < input
type="submit" value="search" />
< / td >
< / tr >
< tr >
@ -190,7 +193,7 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
< / tr >
< / table >
< / form >
<?php
<?php
}
}?>