Exemple #1
1
function disableAccount()
{
    $id = intval($_POST['disableAccount']);
    if ($id == 0) {
        die("error");
    }
    if (isset($_SESSION['superadmin']) || isset($_SESSION['admin']) && 2 > intval(getUserDataByID($id)['status'])) {
        disableAcc($id);
    } else {
        die("error");
    }
}
Exemple #2
0
function getUserData($user, $product, $typeobj, $begin_ts, $end_ts)
{
    $result = array();
    if ($typeobj) {
        foreach ($typeobj as $type_cube => $selectedkeys) {
            //parse and get type ,cube
            list($type, $cube) = explode("", $type_cube);
            //calc id
            $id = md5($user . $product . $type . $cube);
            $iddata = getUserDataByID($id, $begin_ts, $end_ts, $selectedkeys);
            if ($iddata) {
                //attention: compress data or calcvalues in any order is ok;
                //bear in mind if compress first the process will be faster
                //while calcValue first,the values is much more precise
                compressIDDatas($iddata, $begin_ts, $end_ts);
                calcIDValues($iddata);
                restrictIDUsersData($iddata);
                $result[$type_cube] = $iddata;
            }
        }
    }
    return $result;
}
/**
 * This function checks if the current logged-in user can delete the account by id.
 * @return boolean
 */
function canDeleteAccount($id)
{
    if (isset($_SESSION['superadmin'])) {
        return true;
    }
    if (!isset($_SESSION['admin']) || !isset($_SESSION['loggedin']) || intval(getUserDataByID($id)['status']) >= 2) {
        return false;
    }
    $myId = $_SESSION['uid'];
    global $mysql;
    $query = "SELECT * FROM 1fx_servers_user_map WHERE user_id={$id} AND server_id IN (SELECT server_id FROM 1fx_servers_user_map WHERE user_id={$myId})";
    $result = mysqli_query($mysql, $query);
    return intval(mysqli_num_rows($result)) > 0;
}