1<?php
2error_reporting(0);
3$isSameHost = strcasecmp($_SERVER['HTTP_HOST'], parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST)) === 0;
4$isColorSet = array_key_exists('color', $_GET);
5if ($isSameHost && $isColorSet) {
6
7    list($red, $green, $blue) = str_split($_GET['color'], 2);
8
9    $img = imagecreate(16, 16);
10    imagefill($img, 0, 0, imagecolorallocate($img, hexdec($red), hexdec($green), hexdec($blue)));
11    header('Content-type: image/png');
12    header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 60*60*24*365) . ' GMT');
13    imagepng($img);
14    imagedestroy($img);
15}
16