예제 #1
0
function modifyDomainPerm($domainId, $userId, $admin)
{
    if (!$domainId || !$userId) {
        return FALSE;
    }
    if (!isDomainAdmin()) {
        return FALSE;
    }
    if ($userId == $_SESSION['user']['user_id']) {
        return FALSE;
    }
    if (!userIsActive($userId)) {
        return FALSE;
    }
    $user = getUserEmail($userId);
    if (!$user) {
        return FALSE;
    }
    $domain = getDomain($domainId);
    if (!$domain) {
        return FALSE;
    }
    $adminDomains = getAdminDomains();
    if (!in_array($domain, $adminDomains)) {
        return FALSE;
    }
    $params = array('user_id' => $userId, 'domain_id' => $domainId);
    if ($admin) {
        return db_insert('domain_administrators', $params, 'admin_id');
    } else {
        return db_delete('domain_administrators', $params);
    }
}
<?php

chdir("../database");
require_once "users.php";
if (isset($_GET["key"])) {
    $key = (string) $_GET["key"];
    if (!confirmationKeyIsValid($key)) {
        header('Location: ../index.php?welcome=0');
    } else {
        if (!userIsActive($key)) {
            activateUser($key);
            header('Location: ../index.php?welcome=1');
        } else {
            header('Location: ../index.php?welcome=2');
        }
    }
}