<?php

/**
Securimage Test Script
Version 1.0 - 01/02/2008

Upload this PHP script to your web server and call it from the browser.
The script will tell you if you meet the requirements for running Securimage.

http://www.phpcaptcha.org
*/


if (isset(Array['testimage']) && Array['testimage'] == '1') {
  
 = imagecreate(225, 225);
  
 = imagecolorallocate(, 255, 255, 255);
  
 = imagecolorallocate(, 0, 0, 0);
 
  
   = imagecolorallocate(, 255,   0,   0);
  
 = imagecolorallocate(,   0, 255,   0);
  
  = imagecolorallocate(,   0,   0, 255);

  
// draw the head
  
imagearc(, 100, 120, 200, 200,  0, 360, );
  
// mouth
  
imagearc(, 100, 120, 150, 150, 25, 155, );
  
// left and then the right eye
  
imagearc(,  60,  95,  50,  50,  0, 360, );
  
imagearc(, 140,  95,  50,  50,  0, 360, );

  
imagestring(, 5, 15, 1, 'Securimage Will Work!!', );
  
imagestring(, 2, 5, 20, ':) :) :)', );
  
imagestring(, 2, 5, 30, ':) :)', );
  
imagestring(, 2, 5, 40, ':)', );

  
imagestring(, 2, 150, 20, '(: (: (:', );
  
imagestring(, 2, 168, 30, '(: (:', );
  
imagestring(, 2, 186, 40, '(:', );

  
imagepng(, null, 3);
  exit;
}

function 
print_status()
{
  if (
) {
    echo 
"<span style="color: #00f">Yes!</span>";
  } else {
    echo 
"<span style="color: #f00; font-weight: bold">No</span>";
  }
}

?>
<html>
<head>
  <title>Securimage Test Script</title>
</head>

<body>

<h2>Securimage Test Script</h2>
<p>
  This script will test your PHP installation to see if Securimage will run on your server.
</p>

<ul>
  <li>
    <strong>GD Support:</strong>
    <?php print_status( = extension_loaded('gd')); ?>
  </li>
  <?php if ()  = gd_info(); else  = array(); ?>
  <?php if (): ?>
  <li>
    <strong>GD Version:</strong>
    <?php echo ['GD Version']; ?>
  </li>
  <?php endif; ?>
  <li>
    <strong>TTF Support (FreeType):</strong>
    <?php print_status( && ['FreeType Support']); ?>
    <?php if ( && ['FreeType Support'] == false): ?>
    <br />No FreeType support.  Cannot use TTF fonts, but you can use GD fonts
    <?php endif; ?>
  </li> 
  <li>
    <strong>JPEG Support:</strong>
    <?php print_status( && ['JPG Support']); ?>
  </li>
  <li>
    <strong>PNG Support:</strong>
    <?php print_status( && ['PNG Support']); ?>
  </li>
  <li>
    <strong>GIF Read Support:</strong>
    <?php print_status( && ['GIF Read Support']); ?>
  </li>
  <li>
    <strong>GIF Create Support:</strong>
    <?php print_status( && ['GIF Create Support']); ?>
  </li>
 
</ul>

<?php if (): ?>
Since you can see this...<br /><br />
<img src="<?php echo Array['PHP_SELF']; ?>?testimage=1" alt="Test Image" align="bottom" />
<?php else: ?>
Based on the requirements, you do not have what it takes to run Securimage :(
<?php endif; ?>

</body>
</html>