session_start();
// You need a unique string that identifies the user. The easiest way is to
// simply use the session ID. But because sending session IDs to other servers
// can be a security problem, we use only a part of the session ID here.
// This is still a quasi-unique string, so it works just as well.
$captcha_id = substr(session_id(), 0, 15); // first 15 characters of the session ID
?>
Bitte geben sie den Text des Bildes ein:
if ($_POST['captcha_answer']) {
// remove anything except letters and numbers (security)
$answer = preg_replace('/[^a-z0-9]+/i', '', $_POST['captcha_answer']);
// check answer
// if you get an error message because your provider has diabled allow_url_fopen,
// please use the myfile() function from the following website instead of file():
// http://www.klamm.de/crashforum/showpost.php?p=1041750&postcount=5
if (implode(file("http://captchator.com/captcha/check_answer/".$captcha_id."/".$answer)) == '1') {
echo 'Answer correct!
';
} else {
echo 'Wrong answer, please try again.
';
}
}
?>