function processCheckAwards()
{
    // This script will check for Backend awards
    global $cfg;
    $connection = @mysql_connect($cfg->get('db_host'), $cfg->get('db_user'), $cfg->get('db_pass'));
    @mysql_select_db($cfg->get('db_name'), $connection) or die("Database Error: " . mysql_error());
    // Import Backend Awards Data
    require 'includes/data.awards.php';
    // Check for Backend Awards Data
    if (!isset($backendawardsdata)) {
        $backendawardsdata = array_merge(buildBackendAwardsData('bf2'), buildBackendAwardsData('xpack'));
    }
    $startTime = microtime_float();
    $pids_arr = $_POST['selitems'];
    showLog("Checking Player Backend Awards");
    $query = "SELECT `id` FROM player";
    if ($pids_arr) {
        $pids = implode(", ", $pids_arr);
        $query .= " WHERE id IN ({$pids})";
    } else {
        showLog("ERROR:<font color='red'>ERROR:</font> No Players Selected!");
        return;
    }
    $result = mysql_query($query);
    if (mysql_num_rows($result) > 0) {
        while ($rowp = mysql_fetch_array($result)) {
            $pid = $rowp['id'];
            showLog(" -> Found Player ({$pid})");
            $playerStartTime = microtime_float();
            // Calculate Awards
            foreach ($backendawardsdata as $award) {
                // Check if Player already has Award
                $query = "SELECT awd, level FROM awards WHERE (id = " . $pid . ") AND (awd = {$award[0]})";
                $awdresult = mysql_query($query);
                if (!$awdresult) {
                    showLog("<font color='red'>ERROR:</font> " . mysql_error());
                    showLog("Query String: " . $query);
                }
                // Check if player has award
                if (mysql_num_rows($awdresult) > 0) {
                    $rowawd = mysql_fetch_array($awdresult);
                }
                // Check Criteria
                $chkcriteria = false;
                foreach ($award[3] as $criteria) {
                    if ($award[2] == 2) {
                        // Can receive multiple times
                        if (mysql_num_rows($awdresult) > 0) {
                            $where = str_replace($awards_substr, $rowawd['level'] + 1, $criteria[3]);
                        } else {
                            $where = str_replace($awards_substr, 1, $criteria[3]);
                        }
                    } else {
                        $where = $criteria[3];
                    }
                    $query = "SELECT {$criteria[1]} AS checkval FROM {$criteria[0]}\n" . "WHERE (id = " . $pid . ") AND ({$where})\n" . "ORDER BY id;";
                    $chkresult = mysql_query($query);
                    if (!$chkresult) {
                        showLog("<font color='red'>ERROR:</font>  ERROR: " . mysql_error() . "\n");
                        showLog("Query String: " . $query);
                    }
                    if (mysql_num_rows($chkresult) > 0) {
                        $rowchk = mysql_fetch_array($chkresult);
                        if ($rowchk['checkval'] >= $criteria[2]) {
                            $chkcriteria = true;
                            break;
                        } else {
                            $chkcriteria = false;
                            break;
                        }
                    }
                }
                if ($chkcriteria && mysql_num_rows($awdresult) == 0) {
                    showLog("    - Award Missing ({$award[0]})");
                    // Insert information
                    $query = "INSERT INTO awards SET\r\n\t\t\t\t\t\tid = " . $pid . ",\r\n\t\t\t\t\t\tawd = {$award[0]},\r\n\t\t\t\t\t\tlevel = 1,\r\n\t\t\t\t\t\tearned = " . time() . ",\r\n\t\t\t\t\t\tfirst = 0;";
                    if (!mysql_query($query)) {
                        showLog("<font color='red'>ERROR:</font> " . mysql_error());
                        showLog("Query String: " . $query);
                    }
                } elseif (!$chkcriteria && mysql_num_rows($awdresult) > 0) {
                    if ($rowawd['awd'] == $award[0]) {
                        showLog("    - Has Award ({$award[0]}), but does not meet requirements!");
                        // Delete information
                        $query = "DELETE FROM awards\r\n\t\t\t\t\t\t\tWHERE (id = " . $pid . " AND awd = {$award[0]});";
                        if (!mysql_query($query)) {
                            showLog("<font color='red'>ERROR:</font> " . mysql_error());
                            showLog("Query String: " . $query);
                        }
                    }
                } elseif ($chkcriteria) {
                    showLog("    - Has Award ({$award[0]}), requirements met!");
                }
            }
            showLog("    Processing Time ({$pid}): " . (microtime_float() - $playerStartTime));
        }
        showLog("Done! :)");
    } else {
        showLog("<font color='red'>ERROR:</font>  No Data Found!");
    }
    // Close database connection
    @mysql_close($connection);
    showLog("Total Processing Time: " . (microtime_float() - $startTime));
}
// Make key/value pairs
$prefix = $gooddata[0];
$mapname = strtolower($gooddata[1]);
for ($x = 2; $x < count($gooddata); $x += 2) {
    $data[$gooddata[$x]] = $gooddata[$x + 1];
}
// Check for Complete Snapshot data
if ($data['EOF'] != 1) {
    $errmsg = "SNAPSHOT Data NOT complete!";
    ErrorLog($errmsg, 1);
    die(_ERR_RESPONSE . $errmsg);
}
// Import Backend Awards Data
require 'includes/data.awards.php';
$awardsdata = buildAwardsData($data['v']);
$backendawardsdata = buildBackendAwardsData($data['v']);
// Generate SNAPSHOT Filename
$mapdate = date('Ymd_Hi', (int) $data['mapstart']);
$stats_filename = '';
if ($prefix != '') {
    $stats_filename .= $prefix . '-';
}
$stats_filename .= $mapname . '_' . $mapdate . $cfg->get('stats_ext');
// SNAPSHOT Data OK
$errmsg = "SNAPSHOT Data Complete ({$mapname}:{$mapdate})";
ErrorLog($errmsg, 3);
// Create SNAPSHOT backup file
if ($data['import'] != 1) {
    $file = @fopen(chkPath($cfg->get('stats_logs')) . $stats_filename, 'wb');
    @fwrite($file, $rawdata);
    @fclose($file);