【发布时间】:2012-09-07 09:12:57
【问题描述】:
我需要一些帮助。
我有一个联系表格,我想在其中添加一些验证码,没有 GD 库。我添加了一些图像作为指南,但现在有静态图像。我想要做的是循环输出与隐藏字段中的代码(随机数)匹配的图像,例如,如果随机数为“18301”,将显示每个数字的适当图像,here到目前为止是我的代码:
<label for="captcha">Type the code you see (*):<br />
<?php (do a loop here){ ?>
<img src="images/0<?php echo $num; ?>.gif" width="18" height="30" />
<?php } ?>
<img src="images/00.gif" width="18" height="30" />
<img src="images/01.gif" width="18" height="30" />
<img src="images/08.gif" width="18" height="30" />
<img src="images/03.gif" width="18" height="30" />
<img src="images/00.gif" width="18" height="30" />
<img src="images/01.gif" width="19" height="30" /> =</label>
<span id="spryCaptcha">
<input type="text" name="captcha" id="captcha" tabindex="70" />
<input name="hiddenCode" type="hidden" value="<?php echo rand(000000,999999); ?>"/>
我怎样才能做到这一点,以便每次都会出现正确的图像并检查用户的输入是否与他/她每次看到的代码相匹配??
【问题讨论】:
-
如果垃圾邮件机器人读取您的图像文件名怎么办?
-
大声笑,你当前的实现很糟糕
-
验证码的静态图像?没门!!! (或生成数百万个随机名称的验证码......)
标签: php forms security captcha contact