Please enter a URL like: http://www.alixaxel.com/wordpress/wp-content/2007/09/Dollar.php?note=SERIAL_NUMBER_HERE
<?php
/**
* Checks if the input string is a valid Dollar banknote serial number.
*
* @param string $string
* @return bool
*/
function Dollar($string)
{
$string = strtoupper(trim($string));
if (strlen($string) == 11)
{
$charset = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'V', 'U', 'W', 'X', 'Y', 'Z');
if (in_array($string[0], $charset))
{
$string = substr($string, 1);
}
else
{
return false;
}
}
if (strlen($string) == 10)
{
$charset = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L');
if (in_array($string[0], $charset))
{
$string = substr($string, 1);
}
else
{
return false;
}
if (is_numeric(substr($string, 0, 8)))
{
$string = substr($string, 8);
}
else
{
return false;
}
$charset = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', '*', 'P', 'Q', 'R', 'S', 'T', 'V', 'U', 'W', 'X', 'Y', 'Z');
if (in_array($string[0], $charset))
{
return true;
}
}
return false;
}
if (!empty($_GET['note']))
{
if (Dollar($_GET['note']) === true)
{
echo '<h2>This note appears to be valid.</h2>';
}
else
{
echo '<h2>This note is INVALID.</h2>';
}
}
else
{
echo '<h2>Please enter a URL like: http://www.alixaxel.com/wordpress/wp-content/2007/09/Dollar.php?note=SERIAL_NUMBER_HERE</h2>';
}
echo "<hr />";
highlight_file(__FILE__);
?>