function flood_control($field, $table, $where)
{
    global $userdata, $settings, $locale;
    $flood = false;
    if (!iSUPERADMIN && !iADMIN && (!defined("iMOD") || !iMOD)) {
        $result = dbquery("SELECT MAX(" . $field . ") AS last_post FROM " . $table . " WHERE " . $where);
        if (dbrows($result)) {
            $data = dbarray($result);
            if (time() - $data['last_post'] < $settings['flood_interval']) {
                $flood = true;
                $result = dbquery("INSERT INTO " . DB_FLOOD_CONTROL . " (flood_ip, flood_timestamp) VALUES ('" . USER_IP . "', '" . time() . "')");
                if (dbcount("(flood_ip)", DB_FLOOD_CONTROL, "flood_ip='" . USER_IP . "'") > 4) {
                    if (iMEMBER && $settings['flood_autoban'] == "1") {
                        require_once INCLUDES . "sendmail_include.php";
                        require_once INCLUDES . "suspend_include.php";
                        $result = dbquery("UPDATE " . DB_USERS . " SET user_status='4', user_actiontime='0' WHERE user_id='" . $userdata['user_id'] . "'");
                        suspend_log($userdata['user_id'], 4, $locale['global_440'], true);
                        $message = str_replace("[USER_NAME]", $userdata['user_name'], $locale['global_442']);
                        sendemail($userdata['user_name'], $userdata['user_email'], $settings['siteusername'], $settings['siteemail'], $locale['global_441'], $message);
                    } elseif (!iMEMBER) {
                        $result = dbquery("INSERT INTO " . DB_BLACKLIST . " (blacklist_ip, blacklist_email, blacklist_reason) VALUES ('" . USER_IP . "', '', '" . $locale['global_440'] . "')");
                    }
                }
            }
        }
    }
    return $flood;
}
Beispiel #2
0
function unsuspend_log($user_id, $type, $reason = "", $system = false)
{
    global $userdata;
    // Pre v7.01 check
    $result = dbquery("SELECT suspend_id FROM " . DB_SUSPENDS . " \n\t\tWHERE suspended_user='******' AND suspend_type='{$type}' AND reinstate_date='0'\n\t\tLIMIT 1");
    if (!dbrows($result)) {
        suspend_log($user_id, $type, "", true, false);
    }
    $result = dbquery("UPDATE " . DB_SUSPENDS . " SET \n\t\t\treinstating_admin='" . (!$system ? $userdata['user_id'] : 0) . "', \n\t\t\treinstate_reason='{$reason}', \n\t\t\treinstate_date='" . time() . "', \n\t\t\treinstate_ip='" . (!$system ? USER_IP : 0) . "',\n\t\t\treinstate_ip_type='" . (!$system ? USER_IP_TYPE : 0) . "'\t\t\t\n\t\tWHERE \n\t\t\tsuspended_user='******' AND suspend_type='{$type}' AND reinstate_date='0'");
}
Beispiel #3
0
function flood_control($field, $table, $where, $debug = FALSE)
{
    global $userdata, $settings, $locale, $defender;
    $flood = FALSE;
    if (!iSUPERADMIN && !iADMIN && (!defined("iMOD") || !iMOD) || $debug) {
        $result = dbquery("SELECT MAX(" . $field . ") AS last_post FROM " . $table . " WHERE " . $where);
        if (dbrows($result)) {
            $time = time();
            $data = dbarray($result);
            if ($time - $data['last_post'] < $settings['flood_interval']) {
                $defender->stop();
                addNotice('warning', sprintf($locale['flood'], countdown($settings['flood_interval'] - ($time - $data['last_post']))));
                $flood = TRUE;
                $result = dbquery("INSERT INTO " . DB_FLOOD_CONTROL . " (flood_ip, flood_ip_type, flood_timestamp) VALUES ('" . USER_IP . "', '" . USER_IP_TYPE . "', '" . time() . "')");
                // This should be in settings, "After how many flood offences take action" then a setting for what action to take
                if (dbcount("(flood_ip)", DB_FLOOD_CONTROL, "flood_ip='" . USER_IP . "'") > 4) {
                    if (!$debug) {
                        if (iMEMBER && $settings['flood_autoban'] == "1") {
                            require_once INCLUDES . "sendmail_include.php";
                            require_once INCLUDES . "suspend_include.php";
                            $result = dbquery("UPDATE " . DB_USERS . " SET user_status='4', user_actiontime='0' WHERE user_id='" . $userdata['user_id'] . "'");
                            suspend_log($userdata['user_id'], 4, $locale['global_440'], TRUE);
                            $message = str_replace("[USER_NAME]", $userdata['user_name'], $locale['global_442']);
                            $message = str_replace("[USER_IP]", USER_IP, $message);
                            $message = str_replace("[USER_IP]", USER_IP, $message);
                            $message = str_replace("[SITE_EMAIL]", $settings['siteemail'], $message);
                            $message = str_replace("[SITEUSERNAME]", $settings['siteusername'], $message);
                            $subject = str_replace("[SITENAME]", $settings['sitename'], $locale['global_441']);
                            sendemail($userdata['user_name'], $userdata['user_email'], $settings['siteusername'], $settings['siteemail'], $subject, $message);
                        } elseif (!iMEMBER) {
                            $result = dbquery("INSERT INTO " . DB_BLACKLIST . " (blacklist_ip, blacklist_ip_type, blacklist_email, blacklist_reason) VALUES ('" . USER_IP . "', '" . USER_IP_TYPE . "', '', '" . $locale['global_440'] . "')");
                        }
                    } else {
                        addNotice('info', "DEBUG MESSAGE: Triggered flood control action due to repeated offences. This could've resulted in a ban or suspenstion");
                    }
                }
            }
        }
    }
    return $flood;
}
Beispiel #4
0
    $result = dbquery("SELECT user_status FROM " . DB_USERS . " WHERE user_id='" . $user_id . "' AND user_level<'103'");
    if (dbrows($result)) {
        $udata = dbarray($result);
        if ($udata['user_status'] == 7) {
            $result = dbquery("UPDATE " . DB_USERS . " SET user_status='0', user_actiontime='0' WHERE user_id='" . $user_id . "'");
            unsuspend_log($user_id, 7);
        } else {
            require_once LOCALE . LOCALESET . "admin/members_email.php";
            require_once INCLUDES . "sendmail_include.php";
            $code = md5($response_required . $data['user_password']);
            $message = str_replace("[CODE]", $code, $locale['email_deactivate_message']);
            $message = str_replace("[USER_NAME]", $data['user_name'], $message);
            $message = str_replace("[USER_ID]", $data['user_id'], $message);
            if (sendemail($data['user_name'], $data['user_email'], $settings['siteusername'], $settings['siteemail'], $locale['email_deactivate_subject'], $message)) {
                $result = dbquery("UPDATE " . DB_USERS . " SET user_status='7', user_actiontime='" . $response_required . "' WHERE user_id='" . $user_id . "'");
                suspend_log($user_id, 7);
            }
        }
        redirect(USER_MANAGEMENT_SELF);
    } else {
        redirect(USER_MANAGEMENT_SELF);
    }
} else {
    opentable($locale['400']);
    if (isset($_GET['search_text']) && preg_check("/^[-0-9A-Z_@\\s]+\$/i", $_GET['search_text'])) {
        $user_name = " user_name LIKE '" . stripinput($_GET['search_text']) . "%' AND";
        $list_link = "search_text=" . stripinput($_GET['search_text']);
    } elseif (isset($_GET['sortby']) && preg_check("/^[0-9A-Z]\$/", $_GET['sortby'])) {
        $user_name = $_GET['sortby'] == "all" ? "" : " user_name LIKE '" . stripinput($_GET['sortby']) . "%' AND";
        $list_link = "sortby=" . stripinput($_GET['sortby']);
    } else {
Beispiel #5
0
                }
                if (isset($_POST['downloads']) == '1') {
                    user_posts_migrate($user_primary_id, $user_temp_id, DB_DOWNLOADS, 'download_user', $locale['118']);
                }
                if (isset($_POST['photos']) == '1') {
                    user_posts_migrate($user_primary_id, $user_temp_id, DB_PHOTOS, 'photo_user', $locale['119']);
                }
                if (isset($_POST['user_level']) == '1') {
                    user_rights_migrate($user_primary_id, $user_temp_id);
                }
                if (isset($_POST['del_user']) == '1') {
                    $result = dbquery("DELETE FROM " . DB_USERS . " WHERE user_id='{$user_temp_id}'");
                } else {
                    require_once INCLUDES . "suspend_include.php";
                    $result = dbquery("UPDATE " . DB_USERS . " SET user_status='7' WHERE user_id='{$user_temp_id}'");
                    suspend_log($user_temp_id, '7', $locale['121']);
                }
            } else {
                echo "<div class='well text-center'>" . $locale['122'] . "</div>\n";
            }
        } else {
            echo "<div class='well text-center'>" . $locale['123'] . "</div>\n";
        }
    }
}
opentable($locale['100']);
user_posts_migrate_console();
closetable();
function user_posts_migrate_console()
{
    global $aidlink, $locale;