Example #1
0
    errorpage("MYSQL DATABASE ERROR", mysqli_connect_error(), $charset, CMUM_TITLE, $_SERVER["REQUEST_URI"], CMUM_VERSION, CMUM_BUILD, CMUM_MOD);
    exit;
}
$sql = $mysqli->query("SELECT * FROM admins ORDER BY user");
while ($res = $sql->fetch_array()) {
    print "<tr>";
    print "<td>" . $res["user"] . "</td>";
    print "<td>" . $res["name"] . "</td>";
    if ($res["admlvl"] == "0") {
        print "<td>Administrator</td>";
    } elseif ($res["admlvl"] == "1") {
        print "<td>Manager</td>";
    } elseif ($res["admlvl"] == "2") {
        print "<td>Group manager</td>";
    }
    print "<td>" . idtogrp($res["ugroup"]) . "</td>";
    if ($res["enabled"] == "1") {
        print "<td><a id=\"admlnkenabled-" . $res["id"] . "\" href=\"javascript:void(0);\" onclick=\"disableadmin('" . $res["id"] . "');\"><div id=\"admenabled-" . $res["id"] . "\"><span class=\"label label-success\">Enabled</span></div></a></td>";
    } else {
        print "<td><a id=\"admlnkenabled-" . $res["id"] . "\" href=\"javascript:void(0);\" onclick=\"enableadmin('" . $res["id"] . "');\"><div id=\"admenabled-" . $res["id"] . "\"><span class=\"label label-important\">Disabled</span></div></a></td>";
    }
    print "<td>";
    print "<div class=\"btn-group pull-right\">";
    print "<button data-toggle=\"dropdown\" class=\"btn btn-small\">Actions <span class=\"caret\"></span></button>";
    print "<ul class=\"dropdown-menu\">";
    if ($res["enabled"] == "1") {
        print "<li><a href=\"admins.php?action=edit&uid=" . $res["id"] . "\">Edit</a><a href=\"admins.php?action=chpass&uid=" . $res["id"] . "\">Change password</a><a id=\"aadmenabled-" . $res["id"] . "\" href=\"javascript:void(0);\" onclick=\"disableadmin('" . $res["id"] . "');\">Disable</a><a href=\"admins.php?action=delete&uid=" . $res["id"] . "\">Delete</a></li>";
    } else {
        print "<li><a href=\"admins.php?action=edit&uid=" . $res["id"] . "\">Edit</a><a href=\"admins.php?action=chpass&uid=" . $res["id"] . "\">Change password</a><a id=\"aadmenabled-" . $res["id"] . "\" href=\"javascript:void(0);\" onclick=\"enableadmin('" . $res["id"] . "');\">Enable</a><a href=\"admins.php?action=delete&uid=" . $res["id"] . "\">Delete</a></li>";
    }
    print "</ul>";
Example #2
0
function expusrcsv($usrgrp)
{
    if (file_exists("config.php")) {
        require "config.php";
    } else {
        require "../config.php";
    }
    $csvout = "";
    $profvalues = "";
    $mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
    if (isset($usrgrp) && $usrgrp != "") {
        $usql = $mysqli->query("SELECT * FROM users WHERE usrgroup='" . $usrgrp . "'");
    } else {
        $usql = $mysqli->query("SELECT * FROM users");
    }
    while ($usrdata = $usql->fetch_array()) {
        $profiles = "";
        if ($usrdata["profiles"] == "") {
            $profiles = "";
        } else {
            $dbprof = unserialize($usrdata["profiles"]);
            if ($dbprof != "" && $dbprof != "N;") {
                foreach ($dbprof as $useprof) {
                    $psql = $mysqli->query("SELECT cspvalue FROM profiles WHERE id='" . $useprof . "'");
                    $profdata = $psql->fetch_array();
                    $profvalues .= $profdata["cspvalue"] . " ";
                }
                $profiles = trim($profvalues);
                $profdata = "";
                $profvalues = "";
            } else {
                $profiles = "";
            }
        }
        if ($usrdata["comment"] != "") {
            $comment = str_replace("\n", " ", $usrdata["comment"]);
            $comment = str_replace("\r", " ", $comment);
            $comment = preg_replace("/\\s+/", " ", $comment);
        } else {
            $comment = $usrdata["comment"];
        }
        $csvout .= $usrdata["user"] . ";" . $usrdata["password"] . ";" . $usrdata["displayname"] . ";" . $usrdata["ipmask"] . ";" . $profiles . ";" . $usrdata["maxconn"] . ";" . $usrdata["admin"] . ";" . $usrdata["enabled"] . ";" . $usrdata["mapexclude"] . ";" . $usrdata["debug"] . ";" . $comment . ";" . $usrdata["email"] . ";" . htmlspecialchars($usrdata["customvalues"]) . ";" . $usrdata["ecmrate"] . ";" . $usrdata["startdate"] . ";" . $usrdata["expiredate"] . ";" . idtogrp($usrdata["usrgroup"]) . ";" . $usrdata["boxtype"] . ";" . $usrdata["macaddress"] . ";" . $usrdata["serialnumber"] . ";" . $usrdata["added"] . ";" . idtoadmin($usrdata["addedby"]) . ";" . $usrdata["changed"] . ";" . idtoadmin($usrdata["changedby"]) . ";\n";
    }
    mysqli_close($mysqli);
    return trim($csvout);
}