<?php
$banners = Array
(
  "http://localhost/banners/image1.gif",
  "http://localhost/banners/image2.gif",
  "http://localhost/banners/image3.gif"
);

$links = Array
(
  "http://helion.pl/ksiazki/101ps2.htm",
  "http://helion.pl/ksiazki/php102.htm",
  "http://helion.pl/ksiazki/cwjas2.htm"
);

if(!isSet($_GET['id']) || !is_numeric($_GET['id'])){
  $id = 0;
}
else{
  $id = $_GET['id'];
}

if($id < 0 || $id >= count($banners)){
  $id = 0;
}

$img = $banners[$id];
$link = $links[$id];

if(++$id >= count($banners)){
  $id = 0;
}

echo "$img\n$link\n$id";
?>