Language: php (GeSHi-highlighted)<?PHP $tainted = $_GET["Author"]; if (isset($tainted)) { if (ctype_alpha($tainted)) { echo "Via ctype_alpha: " . $tainted . "<br>"; }else{ echo "Input failed via ctype_alpha.<br>"; }} if (isset($tainted)) { // The regular expression pattern for a Name $regExPattern = "/^[a-zA-Z\-\'\ ]+$/"; // If magic quotes are on we need to strip the \ from the value. if (get_magic_quotes_gpc()) { $tainted=stripslashes($tainted); } // find out if the submitted data matches the pattern...results go to an array preg_match($regExPattern, $tainted, $matchArray); if (!empty($matchArray)) { // if the array is not empty, the first element is the match. echo "Via regEx: " . $matchArray[0] . "<br>"; }else{ echo "Input failed via regEx.<br>"; }} // include the class filerequire_once "filterClass.php";// make a new GET object$page_get = new requestGet();// get the tainted input from "Author" using type "Name"$author = $page_get->getVarByType("Author", $type="name");// echo safe resultsecho "Via filterClass: " . $author . "<br>";?>