在 Flash 中实现验证码
我正在开发一个 Flash 注册表,我需要合并动态“验证码”图像以进行确认。 任何人都可以推荐执行此操作的最佳解决方案吗?
I'm developing a flash registration form and I need to incorporate dynamic 'captcha' images for confirmation.
Can anyone recommend a best solution for doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
验证码用于防止机器人提交 html 表单,这很容易实现,因为 html 很容易以编程方式理解和处理。对于 Flash 应用程序来说情况并非如此。如果机器人不是专门针对您的网站而设计的,那么它通常很难提交 Flash 表单。
因此,在使用 Flash 应用程序时,您无需担心验证码解决的垃圾邮件问题。
Captcha is used to prevent bots from submitting html forms which is easily accomplished since html is easily understood and processed programmatically. The same is not true for a Flash application. It would be difficult for a bot to generically submit Flash forms if it was not specifically made to target your site.
Therefore you don't need to worry about the spam problem captcha solves when working with a Flash application.
制作强大的验证码并不是一项简单的任务。对于机器人来说失败一定很困难,但对于人类来说成功却足够容易......我会看看现有的系统并可能使用它们。 reCAPTCHA 很受欢迎 http://recaptcha.net/ 。也许可以通过闪存使用它,但我还没有研究过。
Making a strong captcha is not a trivial task. It must be hard enough for bots to fail, but easy enough for humans to succeed... I would take a look at existing systems and possibly use them. reCAPTCHA is popular http://recaptcha.net/ . It might be possible to use it through flash, but I have not looked into it.
实际上,它与 HTML 表单中的验证码没有什么不同。
假设您在服务器上使用 php,并且有一个 captcha.php 脚本,可以生成验证码图像并将其值保存在会话中。在 HTML 表单中,您可以使用一个元素并将其 src 设置为 captcha.php。用户将用他们在图像中看到的文本填写字段。在接收帖子的脚本中,您将检查用户输入是否与会话值匹配。
在 Flash 形式中,它是完全相同的。您调用 captcha.php 加载图像并要求用户输入额外的字段。然后,当您将数据发布到服务器时,您将传递用户在验证码字段中键入的值,并且服务器将其与您调用 captcha.php 时存储在会话中的值进行匹配。
因此,基本上,它与 HTML 表单中的相同。
It's not that different from a captcha in an HTML form, really.
Suppose you're using php on the server and you have a captcha.php scritp that generates the captcha image and saves its value in the session. In an HTML form, you'd use an element and set its src to captcha.php. The user would fill up a field with the text they see in the image. In the script that receives the post, you'd check if the user input matches the session value.
In a flash form, it's exactly the same. You load the image calling captcha.php and ask the user to type the extra field. Then, when you post the data to the server you pass the value typed by the user in the captcha field and the server matches that against the value it has stored in the session when you called captcha.php.
So, basically, it's the same as in an HTML form.
机器人很可能不会为您的网站编写。如果需要,只需简单地“帮我添加这两个数字,k?”就很简单了。
老实说,我怀疑有人会在你的网站上写字母识别来注册几百次= /
你应该更担心有人反汇编[或无论flash术语是什么]你的.swf并简单地发送“注册”消息到你的服务器=/
是的,我试图暗示验证码必须应用于服务器端,或者,实际上,它并不难绕过。
Chances are, bots aren't going to be written for your website. If the need ever arises, a simple "add these two numbers for me, k?" would be simple enough.
In all honesty, i doubt someone would write letter recognition to sign up a few hundred times on your website =/
You should be more worried about someone disassembling [or whatever the flash term is] your .swf s and simply sending "register" messages to your server =/
And yes, by that, i tried to imply that Captcha must be applied server side, or, really, its not that hard to go around.
我们强烈需要将 CAPTCHA 实施到 Flash 动画/表单中。
最需要注意的一点是,FF 或 IE(不记得是哪一个)不会通过 Web 服务调用发回任何 cookie。因此,如果您将表单提交到 .Net Web 服务,则无法使用 http 请求的会话状态来存储验证码文本,然后将用户在提交时输入的验证码值与 Web 服务进行比较(启用会话的 Web 方法) )
我们实现了以下内容:
,将令牌和用户输入的验证码值与表中的值进行比较。这种方法对我们来说非常有效。
它也是网络农场安全的。
We had a strong need to implement CAPTCHA into a flash animation/form.
The most important point to note is that either FF or IE (can’t remember which one) doesn’t send any cookies back with a web service call. So if you’re submitting your form to a .Net web service you can’t use the session state of the http request to store the captcha text and then compare the user entered captcha value on submttion to the web service (session enabled web method)
We implemented the following:
This approach works very well for us.
It’s also web farm safe.