<?php
  session_start
();

  
header('Pragma: ');
  
header('Cache-Control: ');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Human Input Validation Example</title>
</head>
<body>
<?
  $msg 
false;

  if(isset(
$_POST['hiv_word'])){
    
//check that hiv word matches
    
if(strlen($_SESSION['hiv_word'])>&& $_POST['hiv_word']!=$_SESSION['hiv_word']){
        
$msg 'Please type the text from the image into the Image Text field exactly as it appears.';
    } else {
        unset(
$_SESSION['hiv_word']);
        
$msg 'You have successfully matched the image word.  Try another!';
    }
  }

  if(
$msg!==false){
      echo 
"<span style=\"color: #F00\">".htmlspecialchars($msg)."</span>";
  }
?>
<form action="<?=$PHP_SELF?>" method="POST">
<script language="javascript">
var i=0;
</script>
<table>
<tr><td valign="top">Image Text:</td><td valign="top"><input type="text" maxlength="6" name="hiv_word" style="width: 150px"></td><td width="1"><img id="hiv" src="hiv.php?r=0" style="border: solid 1px"></td><td>(<a onCLick="document.getElementById('hiv').src='hiv.php?r='+(++i);">new image</a>)</td></tr>
<tr><td /><td><input style="border: 1px solid" type="submit" value="Submit"></td></tr>
</table>
</form>
</body>
</html>