<?
$current_ver = 285;

for ($i = 1; $i <= $current_ver; $i++)
{
  $dir = substr(number_format($i / 1000, 3), 0, strlen(number_format($i / 1000, 3)) - 2) . '0';
  $version_new = number_format($i / 1000, 3);

  if (file_exists('../updates/' . $dir . '/ver_' . $version_new . '.zip'))
    $versions[] = $version_new;
}

$license['fffa683eaec156dd04cb037fe4832d69']['domain'] = 'marianek.pl';
$license['fffa683eaec156dd04cb037fe4832d69']['valid_to_date'] = '';
$license['fffa683eaec156dd04cb037fe4832d69']['valid_to_version'] = '';

$license['b11ad35d84d7eb2cc65cbc2528522dd1']['domain'] = 'cossmacznego.pl';
$license['b11ad35d84d7eb2cc65cbc2528522dd1']['valid_to_date'] = '';
$license['b11ad35d84d7eb2cc65cbc2528522dd1']['valid_to_version'] = '';

$license['e3b6c13dc0dcb9b83a04dfb0916d7d3b']['domain'] = 'shoppro.pro24.com.pl';
$license['e3b6c13dc0dcb9b83a04dfb0916d7d3b']['valid_to_date'] = '';
$license['e3b6c13dc0dcb9b83a04dfb0916d7d3b']['valid_to_version'] = '';

$update_key = $_GET['key'];
if (!isset($license[$_GET['key']]))
  die();

$valid_to_date = $license[$_GET['key']]['valid_to'];
if ($valid_to && $valid_to < date('Y-m-d'))
  die();

$versions = array_unique($versions);

$valid_to_version = $license[$_GET['key']]['valid_to_version'];
if ($valid_to_version)
{
  foreach ($versions as $ver)
    if ($ver <= $valid_to_version)
      echo $ver . PHP_EOL;
}
else
{
  foreach ($versions as $ver)
    echo $ver . PHP_EOL;
}



