Exemple #1
0
        $result = $db->sql_query($sql);
        // update the user table with new status
        $sql = 'UPDATE ' . USERS_TABLE . ' SET user_warnings = "' . $config['max_user_bancard'] . '",  user_active = "0" WHERE user_id="' . $poster_id . '"';
        $result = $db->sql_query($sql);
        // Better kill all the sessions!
        $sql = 'DELETE FROM ' . SESSIONS_TABLE . ' WHERE session_user_id="' . $poster_id . '"';
        $result = $db->sql_query($sql);
        $message = $lang['Ban_update_red'];
        $e_temp = 'ban_block';
        //$e_subj = $lang['Card_banned'];
        // Delete notifications for user
        if (!class_exists('class_notifications')) {
            include IP_ROOT_PATH . 'includes/class_notifications.' . PHP_EXT;
            $class_notifications = new class_notifications();
        }
        $class_notifications->delete_user_notifications($poster_id);
    } else {
        $sql = 'UPDATE ' . USERS_TABLE . ' SET user_warnings = "' . $config['max_user_bancard'] . '",  user_active = "0" WHERE user_id="' . $poster_id . '"';
        $result = $db->sql_query($sql);
        $no_error = false;
        $already_banned = true;
    }
} elseif ($mode == 'warn') {
    $founder_id = defined('FOUNDER_ID') ? FOUNDER_ID : get_founder_id();
    if ($user->data['user_level'] != ADMIN && !$is_auth['auth_ban'] || $poster_id == $founder_id) {
        message_die(GENERAL_ERROR, $lang['Not_Authorized']);
    }
    // Get user basic data
    $sql = 'SELECT user_active, user_warnings, user_level FROM ' . USERS_TABLE . ' WHERE user_id="' . $poster_id . '"';
    $result = $db->sql_query($sql);
    $the_user = $db->sql_fetchrow($result);
     if (!$in_banlist && $user_list[$i] != ANONYMOUS && $user_list[$i] != $founder_id) {
         $kill_session_sql .= ($kill_session_sql != '' ? ' OR ' : '') . "session_user_id = " . $user_list[$i];
         $ban_insert_array = array('ban_userid' => $user_list[$i], 'ban_by_userid' => $user->data['user_id'], 'ban_start' => time());
         $sql = "INSERT INTO " . BANLIST_TABLE . " " . $db->sql_build_insert_update($ban_insert_array, true);
         $db->sql_query($sql);
         $sql = "UPDATE " . USERS_TABLE . " SET user_warnings = " . $config['max_user_bancard'] . " WHERE user_id = " . $user_list[$i];
         $db->sql_query($sql);
     }
 }
 if (!empty($user_list)) {
     // Delete notifications for banned users
     if (!class_exists('class_notifications')) {
         include IP_ROOT_PATH . 'includes/class_notifications.' . PHP_EXT;
         $class_notifications = new class_notifications();
     }
     $class_notifications->delete_user_notifications($user_list);
 }
 for ($i = 0; $i < sizeof($ip_list); $i++) {
     $in_banlist = false;
     for ($j = 0; $j < sizeof($current_banlist); $j++) {
         if ($ip_list[$i] == $current_banlist[$j]['ban_ip']) {
             $in_banlist = true;
         }
     }
     if (!$in_banlist) {
         // Mighty Gorgon: we don't use this replacement any more...
         /*
         if (preg_match('/(255\.)|(\.255)/is', $ip_list[$i]))
         {
         	$kill_ip_sql = "session_ip LIKE '" . str_replace('.', '', preg_replace('/(255\.)|(\.255)/is', '%', $ip_list[$i])) . "'";
         }