<?php

//$file = 'firmware.bin';

//historie produkcnich verzi
//5.7027.1098 - do 20.8.2018
//5.11011.1475 - od 20.8.2018
//5.17009.1694 do 28.3.2019
if($_GET["output"]=="text"){
  $file="migration.txt";


$testmacs=Array('001AD0455B02',
	'001AD03387E0','001AD0449FD8',
	'001AD0326DEA','001AD0339DE8','001AD0326E0F','001AD04395B4','001AD04397BE',
	'001AD0326F34','001AD0326F39','001AD04633FB','001AD0449D0A','001AD0455B75',
	'001AD0453330','001AD0453954','001AD0326F39','001AD0461F58','001AD04539C9','001AD0326E8A',
        '001AD0452B91','001AD0339F2D','001AD04395F5','001AD0326FBB','001AD0326EA9',
        '001AD0339A27','001AD04539CF','001AD0453330','001AD0326ED7','001AD0453379','001AD0455B4F',
	'001AD0326E96','001AD0449EDC','001AD04397C6','001AD045378C','001AD0452F8E','001AD0455CD3','001AD03386C5','001AD0452D7D','001AD04635B0',
	'001AD03385C2','001AD0453384','001AD04396E3','001AD0326DA4','001AD045354A','001AD0338635','001AD04634A4','001AD0452C6E'




);

  if($_GET["current_firmware_version"]=="5.19003.1856"){ // active version
     $file="";
  }

  if(in_array($_GET["mac"],$testmacs)){
     $file="migration-test.txt";
      if($_GET["current_firmware_version"]=="5.20017.1970"){ // active test version      
//    if($_GET["current_firmware_version"]=="5.20000.1920"){ // active test version
//    if($_GET["current_firmware_version"]=="5.19009.1872"){ // active test version
//    if($_GET["current_firmware_version"]=="5.18005.1795"){ // active test version
//    if($_GET["current_firmware_version"]=="5.15005.1583"){ // active test version
//    if($_GET["current_firmware_version"]=="5.14002.1545"){ // active test version
       $file="";
    }

  }



}


if (file_exists($file)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="'.basename($file).'"');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    readfile($file);
    exit;
}

?>
