<?php
$banners = Array
(
  0 => "http://localhost/banners/image1.gif",
  1 => "http://localhost/banners/image2.gif",
  2 => "http://localhost/banners/image3.gif",
  3 => "http://localhost/banners/image1.gif",
  4 => "http://localhost/banners/image2.gif",
  5 => "http://localhost/banners/image3.gif",
  6 => "http://localhost/banners/image1.gif",
  7 => "http://localhost/banners/image2.gif",
  8 => "http://localhost/banners/image3.gif",
  9 => "http://localhost/banners/image1.gif",
  10 => "http://localhost/banners/image2.gif",
  11 => "http://localhost/banners/image3.gif",
  12 => "http://localhost/banners/image1.gif",
  13 => "http://localhost/banners/image2.gif",
  14 => "http://localhost/banners/image3.gif",
  15 => "http://localhost/banners/image1.gif",
  16 => "http://localhost/banners/image2.gif",
  17 => "http://localhost/banners/image3.gif",
  18 => "http://localhost/banners/image1.gif",
  19 => "http://localhost/banners/image2.gif",
  20 => "http://localhost/banners/image3.gif",
  21 => "http://localhost/banners/image1.gif",
  22 => "http://localhost/banners/image2.gif",
  23 => "http://localhost/banners/image3.gif"
);

$links = Array
(
  0 => "http://helion.pl/ksiazki/101ps2.htm",
  1 => "http://helion.pl/ksiazki/php102.htm",
  2 => "http://helion.pl/ksiazki/cwjas2.htm",
  3 => "http://helion.pl/ksiazki/101ps2.htm",
  4 => "http://helion.pl/ksiazki/php102.htm",
  5 => "http://helion.pl/ksiazki/cwjas2.htm",
  6 => "http://helion.pl/ksiazki/101ps2.htm",
  7 => "http://helion.pl/ksiazki/php102.htm",
  8 => "http://helion.pl/ksiazki/cwjas2.htm",
  9 => "http://helion.pl/ksiazki/101ps2.htm",
  10 => "http://helion.pl/ksiazki/php102.htm",
  11 => "http://helion.pl/ksiazki/cwjas2.htm",
  12 => "http://helion.pl/ksiazki/101ps2.htm",
  13 => "http://helion.pl/ksiazki/php102.htm",
  14 => "http://helion.pl/ksiazki/cwjas2.htm",
  15 => "http://helion.pl/ksiazki/101ps2.htm",
  16 => "http://helion.pl/ksiazki/php102.htm",
  17 => "http://helion.pl/ksiazki/cwjas2.htm",
  18 => "http://helion.pl/ksiazki/101ps2.htm",
  19 => "http://helion.pl/ksiazki/php102.htm",
  20 => "http://helion.pl/ksiazki/cwjas2.htm",
  21 => "http://helion.pl/ksiazki/101ps2.htm",
  22 => "http://helion.pl/ksiazki/php102.htm",
  23 => "http://helion.pl/ksiazki/cwjas2.htm"
);

if(isSet($_GET['hour'])){
  $hour = $_GET['hour'];
  if($hour >= 0 && $hour <= 23){
    $img = $banners[$hour];
    $link = $links[$hour];
    echo "$img\n$link";
  }
  else{
    echo "error\nNieprawidłowy parametr skryptu.";
  }
}
else{
  echo "error\nNieprawidłowe wywołanie skryptu.";
}
?>