if ($killmail == 403) {
         $mdb->remove('crestmails', $crestmail);
     } else {
         $crestmails->update($crestmail, array('$set' => array('processed' => null)));
     }
     continue;
 }
 if ($killmail == 415 || $killmail == 500 || $killmail == 403) {
     $crestmails->update($crestmail, array('$set' => array('processed' => true, 'errorCode' => $killmail)));
     continue;
 }
 unset($crestmail['npcOnly']);
 unset($killmail['zkb']);
 unset($killmail['_id']);
 if (!$mdb->exists('rawmails', ['killID' => (int) $id])) {
     $killsLastHour->add($id);
     $rawmails->save($killmail);
 }
 if (!validKill($killmail)) {
     $crestmail['npcOnly'] = true;
     $crestmail['processed'] = true;
     $crestmails->save($crestmail);
     continue;
 }
 $killID = @$killmail['killID'];
 if ($killID != 0) {
     $crestmail['processed'] = true;
     $crestmails->save($crestmail);
     $queueProcess->push($killID);
     ++$counter;
     $queueShare->push($killID);
Exemple #2
0
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] != 'https') {
    $uri = @$_SERVER['REQUEST_URI'];
    header("Location: https://zkillboard.com{$uri}");
    die;
}
$timer = new Timer();
// Starting Slim Framework
$app = new \Slim\Slim($config);
// Session
session_set_save_handler(new RedisSessionHandler(), true);
session_cache_limiter(false);
session_start();
$visitors = new RedisTtlCounter('ttlc:visitors', 300);
$visitors->add(IP::get());
$requests = new RedisTtlCounter('ttlc:requests', 300);
$requests->add(uniqid());
$load = getLoad();
// Check if the user has autologin turned on
if ($load < 20 && !User::isLoggedIn()) {
    User::autoLogin();
}
if ($load >= 20) {
    $uri = @$_SERVER['REQUEST_URI'];
    if ($uri != '') {
        $contents = $redis->get("cache:{$uri}");
        if ($contents !== false) {
            echo $contents;
            exit;
        }
        $_SERVER['requestDttm'] = $mdb->now();
        $qServer = new RedisQueue('queueServer');