1
爲什麼下面的PHP代碼,刪除一些CAPTCHA圖像,並允許其他幾個圖像保留在服務器上?PHP梨CAPTCHA
僞代碼
//process_form.php
PHP
session_start()
$radiobutton = '';
$captcha_set = false;
IF POST SUBMIT
IF empty text1 && empty text2
echo error msg, include HTML FORM
ELSE IF empty radiobtn
echo error msg, include HTML FORM
ELSE IF
isset POST[phrase] isstring POST[phrase] isset SESSION[phrase]
strlen POST[phrase] > 0 strlen SESSION[phrase] > 0
POST[phrase] == SESSION[phrase]
$captcha_set = true;
if ($captcha_set)
{
unset($_SESSION['phrase']);
unlink(sha1(session_id()) . '.png');
}
SQL INSERT
ELSE
echo error msg, include HTML FORM
ELSE
include HTML FORM
/PHP
HTML FORM
PHP
Require Once Text/Captcha.php
PEAR Capthca Options
/PHP
HTML
FORM
PHP
echo '<img src="' . sha1(session_id()) . '.png?' . time() . '" />';
/PHP
/FORM /HTML
我重新解釋了最初的問題。 – rrrfusco 2010-11-12 12:45:46