예제 #1
0
function DeleteUnconfirmed()
{
    global $DB;
    $removed = 0;
    $result = $DB->Query('SELECT * FROM `tlx_accounts` WHERE `status`=? AND `date_added` <= ?', array(STATUS_UNCONFIRMED, gmdate(DF_DATETIME, TIME_NOW - 172800)));
    while ($account = $DB->NextRow($result)) {
        DeleteAccount($account['username'], $account);
        $removed++;
    }
    $DB->Free($result);
    return $removed;
}
예제 #2
0
function ProcessAccount(&$account, &$exception)
{
    global $configuration, $exceptions, $penalties, $DB, $config_id, $history_id;
    $removed = FALSE;
    $message = '';
    $penalty = 0x0;
    $reasons = array('connect' => "Connection error: {$account['http']->errstr}", 'forward' => "Redirecting URL: {$account['http']->response_headers['status']}", 'broken' => "Broken URL: {$account['http']->response_headers['status']}", 'blacklist' => "Blacklisted data: " . htmlspecialchars($account['blacklist_item']));
    // Determine the most strict penalty based on the infractions that were found
    foreach ($exceptions as $key => $value) {
        if ($exception & $value && $configuration['action_' . $key] >= $penalty) {
            $message = $reasons[$key];
            $penalty = intval($configuration['action_' . $key], 16);
        }
    }
    // Blacklist
    if ($penalty & $penalties['blacklist']) {
        $action = 'Blacklisted';
        $removed = TRUE;
        AutoBlacklist($account);
        DeleteAccount($account['username'], $account);
        // Update history
        $DB->Update('UPDATE `tlx_scanner_history` SET `exceptions`=`exceptions`+1,`blacklisted`=`blacklisted`+1 WHERE `history_id`=?', array($history_id));
    } else {
        if ($penalty & $penalties['delete']) {
            $action = 'Deleted';
            $removed = TRUE;
            DeleteAccount($account['username'], $account);
            // Update history
            $DB->Update('UPDATE `tlx_scanner_history` SET `exceptions`=`exceptions`+1,`deleted`=`deleted`+1 WHERE `history_id`=?', array($history_id));
        } else {
            if ($penalty & $penalties['disable']) {
                $action = 'Disabled';
                // Disable account
                $DB->Update('UPDATE `tlx_accounts` SET `disabled`=1 WHERE `username`=?', array($account['username']));
                // Update history
                $DB->Update('UPDATE `tlx_scanner_history` SET `exceptions`=`exceptions`+1,`disabled`=`disabled`+1 WHERE `history_id`=?', array($history_id));
            } else {
                if ($penalty & $penalties['report']) {
                    $action = 'Unchanged';
                    // Update history
                    $DB->Update('UPDATE `tlx_scanner_history` SET `exceptions`=`exceptions`+1 WHERE `history_id`=?', array($history_id));
                } else {
                    // Do nothing
                    $exception = 0x0;
                    return $removed;
                }
            }
        }
    }
    $DB->Update('INSERT INTO `tlx_scanner_results` VALUES (?,?,?,?,?,?,?)', array($config_id, $account['username'], $account['site_url'], $account['http']->response_headers['status'], gmdate(DF_DATETIME, TimeWithTz()), $action, $message));
    return $removed;
}
예제 #3
0
function tlxCategoryDelete()
{
    global $DB, $json, $C;
    VerifyPrivileges(P_CATEGORY_REMOVE, TRUE);
    if (!is_array($_REQUEST['category_id'])) {
        $_REQUEST['category_id'] = array($_REQUEST['category_id']);
    }
    foreach ($_REQUEST['category_id'] as $category_id) {
        $accounts =& $DB->FetchAll('SELECT * FROM `tlx_accounts` WHERE `category_id`=?', array($category_id));
        foreach ($accounts as $account) {
            DeleteAccount($username);
        }
        $DB->Update('DELETE FROM `tlx_categories` WHERE `category_id`=?', array($category_id));
    }
    echo $json->encode(array('status' => JSON_SUCCESS, 'message' => 'The selected categories have been deleted'));
}
    $result = UpdateAccount($mytoken, $mydomain, $_POST['firstname'], $_POST['lastname'], $_POST['username'], $_POST['password']);
    $show_result = TRUE;
}
/* Process Retrieve Account Request */
if (isset($_POST['RetrieveAccount'])) {
    $result = RetrieveAccount($mytoken, $mydomain, $_POST['username']);
    $show_result = TRUE;
}
/* Process Set Account Status Request */
if (isset($_POST['SetAccountStatus'])) {
    $result = SetAccountStatus($mytoken, $mydomain, $_POST['username'], $_POST['status']);
    $show_result = TRUE;
}
/* Process Delete Account Request */
if (isset($_POST['DeleteAccount'])) {
    $result = DeleteAccount($mytoken, $mydomain, $_POST['username']);
    $show_result = TRUE;
}
/* Process Create Alias Request */
if (isset($_POST['CreateAlias'])) {
    $result = CreateAlias($mytoken, $mydomain, $_POST['username'], $_POST['alias']);
    $show_result = TRUE;
}
/* Process Retrieve Alias Request */
if (isset($_POST['RetrieveAlias'])) {
    $result = RetrieveAlias($mytoken, $mydomain, $_POST['alias']);
    $show_result = TRUE;
}
/* Process Delete Alias Request */
if (isset($_POST['DeleteAlias'])) {
    $result = DeleteAlias($mytoken, $mydomain, $_POST['alias']);
예제 #5
0
 * Time: 16:30
 */
include "BD.php";
if (isset($_POST['Add_btn'])) {
    //si le bouton ajouter a été peser appelle la fontion add
    if ($_POST['email'] == "" || $_POST['password'] == "") {
        echo "<script> alert('email ou mot de passe invalide') </script>";
        Admin();
    } else {
        if (isset($_POST['admin'])) {
            AddAccount($_POST['email'], $_POST['password'], $_POST['admin']);
        } else {
            AddAccount($_POST['email'], $_POST['password'], 0);
        }
    }
} else {
    if (isset($_POST['Modify_btn'])) {
        //si le bouton modifier a été peser appelle la fontion modify
        if ($_POST['email'] == "" || $_POST['password'] == "") {
            echo "<script> alert('email ou mot de passe invalide') </script>";
            Admin();
        } else {
            ModifyAccount($_POST['Liste'], $_POST['email'], $_POST['password'], $_POST['admin']);
        }
    } else {
        if (isset($_POST['Delete_btn'])) {
            //si le bouton Supprimer a été peser appelle la fontion Delete
            DeleteAccount($_POST['Liste']);
        }
    }
}