session_start(); $captchaValidierungOk = false; if (ereg('^[a-z]{4}$', $_POST['captcha_code']) && !empty($_SESSION['captcha_code']) && ($_SESSION['captcha_code']==$_POST['captcha_code'])) { $captchaValidierungOk = true; } $code = ''; for ($i = 0; $i < 4; $i++) { $code .= chr(rand(97, 122)); } $_SESSION['captcha_code'] = $code; ?>