コード例 #1
0
                        <label for="password">Password:</label>
                        <input type="password" class="form-control" id="password" name="password" />
                    </div>
                </div>
                <div id="login"><input type="submit" value="Login" /></div>
            </form>
        <?php 
} else {
    ?>
            <div id="usercp">
                <div class="pull-right" style="padding-top: 3px;"><input type="submit" id="logout" value="Logout" /></div>
                <nav>
                    <ul id="nav">
                        <li><a href="index.php">Home</a></li>
                        <?php 
    if (Privilege::hasAdmin($_SESSION['privileges'])) {
        ?>
                            <li><a>Config</a>
                                <ul>
                                    <li><a href="groups.php">Groups</a></li>
                                    <li><a href="rules.php">Rules</a></li>
                                    <li><a href="lang.php">Lang</a></li>
                                    <li><a href="magic.php">Magic</a></li>
                                </ul>
                            </li>
                        <?php 
    }
    ?>
                        <li><a href="account.php">Account</a>
                        <?php 
    if (Privilege::hasSuperAdmin($_SESSION['privileges'])) {
コード例 #2
0
<?php

session_start();
require_once "Privilege.php";
if ($_SESSION['online'] && Privilege::hasAdmin($_SESSION['privileges'])) {
    require_once "../config.php";
    $id = $_POST['id'];
    $name = $_POST['name'];
    $level = $_POST['level'];
    $color = $_POST['color'];
    $actions = $_POST['actions'];
    if (empty($name) || empty($level) || empty($color) || empty($actions)) {
        echo "You left something blank!";
    } else {
        if ($id == "new") {
            $stmt = $db->prepare("INSERT INTO " . $prefix . "groups(name,level,color,actions) VALUES(?,?,?,?)");
            $stmt->bind_param("siss", $name, $level, $color, $actions);
        } else {
            $stmt = $db->prepare("UPDATE " . $prefix . "groups SET name=?,level=?,color=?,actions=? WHERE id = ?");
            $stmt->bind_param("sissi", $name, $level, $color, $actions, $id);
        }
        if ($stmt->execute()) {
            echo "Group saved.";
        } else {
            echo "Could not save group.";
        }
        $stmt->close();
    }
}