示例#1
0
}
/****************************************************************/
printheader("Groups of PhpLabware");
navbar($USER["permissions"]);
// when the 'Add a new Group' button has been chosen:
if ($add) {
    group_form("", "");
} elseif ($mod == "true") {
    group_form($groupid, $groupname);
} else {
    // print header of table
    echo "<table border=\"1\" align=center >\n";
    echo "<caption>\n";
    // first handle addition of a new group
    if ($submit == "Add Group") {
        if ($test = add_new_group($db, $groupname)) {
            echo "</caption>\n</table>\n";
            echo "<table align='center'><caption>{$test}</caption></table>";
            group_form("", $groupname);
            printfooter();
            exit;
        }
    } elseif ($submit == "Modify Group") {
        if ($test = modify_group($db, $groupid, $groupname)) {
            echo "</caption>\n</table>\n";
            echo "<table align='center'><caption>{$test}</caption></table>";
            group_form($groupid, $groupname);
            printfooter();
            exit;
        }
    } elseif ($_POST) {
示例#2
0
    $userId = $_SESSION['user'];
    if (!check_rights("2")) {
        print_lack_of_privledge_warning();
    }
}
?>
<h2>Group Management</h2> <p> Adding/Modifying and deleting groups ... </p>

<form action="<? print $PHP_SELF; ?>" method="post">

<?
$sessionToken = $_SESSION["token"];

if (($action == 1) && ($sessionToken == $formToken)) {
    $totalUsers = trim ($totalUsers, ",");
    add_new_group($groupname, $totalUsers);
    $sessionToken  = $sessionToken + 1;
    $_SESSION["token"] = $sessionToken;

}
elseif (($action == 2) && ($sessionToken == $formToken)) {
    delete_group($groupname);
    $sessionToken  = $sessionToken + 1;
    $_SESSION["token"] = $sessionToken;

}
elseif (($action == 3) && ($sessionToken == $formToken)) {
    $totalUsers = trim ($totalUsers, ",");
    update_group($groupname, $totalUsers, $id);
    $sessionToken  = $sessionToken + 1;
    $_SESSION["token"] = $sessionToken;