作者shadowjohn (3WA问题解决专家)
看板PHP
标题Re: [请益] 图形验证的功能
时间Sat Oct 2 00:12:03 2010
印了你的 session 得到下面的内容
sigmyjz|1285948732
print_r($_POST); //检查你的传值
Array ( [customer_name] => test [customer_email] => abc
[customer_phone] => dee [message] => asdfasdf
[captcha_response] => sigmyjz
^^^^^^^^^^^^^^^^ 注意,我输入的东西 ~
[x] => 38 [y] => 19 )
Verify failed. correct code is sigmyjz, you
if($ara[0] == $_POST['code'])
简单的说~
你 contact-us.html 你给GD验证码输入的那个框
<input type="text" id="captcha_response" name="captcha_response">
^^^^^^^^^^^^^^^^
你传的 POST 的 index , 取名叫 captcha_response
但你比对检查,却用「$_POST['code']」
如此一来,当然比对错误啊~
if($ara[0] == $_POST['code'])
改成
if($ara[0] == $_POST['captcha_response'])
应该就功德半满了~
--
3WA训练家的工作室
宗旨:诸葛单中,谢谢
个人布弱格 网址:
http://3wa.tw
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 123.240.83.60
1F:推 iozz:谢谢,改到头昏,才发觉更新了测试档案,却没更新主机档案这 10/02 09:49
2F:→ iozz:个地方的错误,也就是我一直再用正确的档案在debug, 难怪... 10/02 09:51