Coldfusion 9 中的 Jquery 花式验证码

发布于 2024-08-22 07:25:32 字数 314 浏览 5 评论 0原文

我知道 Coldfusion 8 和 9 应该能够运行 PHP 代码;虽然我还没有测试过这个。我想知道是否可以使用 JQuery Fancy Captcha: http: ColdFusion 应用程序中的 //www.webdesignbeach.com/beachbar/ajax-fancy-captcha-jquery-plugin。如果是,如何实施?

谢谢 维森特

I know Coldfusion 8 and 9 should be able to run PHP codes; although I have not testing this yet. I would like to know if is possible to use JQuery Fancy Captcha: http://www.webdesignbeach.com/beachbar/ajax-fancy-captcha-jquery-plugin in a ColdFusion application. If yes, how could it be implemented?

Thanks
Vicente

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

皇甫轩 2024-08-29 07:25:32

此引用中描述的所有服务器作业:

它调用 captcha.php 文件并获取
随机数。 php文件刚刚生成
简单的数字并将其放入会话中。
当 AJAX 获得该数字时,它会创建
基于该数字的项目。

因此,这里是他们在 CFML 中的 PHP 示例的一个快速且未经真正测试的端口:

<cflock scope="session" type="exclusive" timeout="5">

    <cfif StructKeyExists(form, "captcha") AND StructKeyExists(session, "captcha") AND form.captcha EQ session.captcha>

        <!--- YOUR CODE GOES HERE --->
        Passed!

        <!--- this line makes session free, we recommend you to keep it --->
        <cfset StructDelete(session, "captcha") />

    <cfelseif StructKeyExists(form, "captcha")>

        Failed!

    <cfelse>

        <!--- in case that form isn't submitted this file will create a random number and save it in session --->

        <cfset session.captcha = RandRange(0,4) />
        <cfoutput>#session.captcha#</cfoutput>

    </cfif>

</cflock>

请注意,从 0 到 4 的生成范围并不是很好,因为它的大小很小(经常重复)。但也许对于这种情况来说就足够了。

All server job described in this quote:

It calls captcha.php file and gets a
random number. Php file just generates
simple number and put it in session.
When AJAX got that number it creates
items based on that number.

So here's a quick and not really tested port of their PHP example in CFML:

<cflock scope="session" type="exclusive" timeout="5">

    <cfif StructKeyExists(form, "captcha") AND StructKeyExists(session, "captcha") AND form.captcha EQ session.captcha>

        <!--- YOUR CODE GOES HERE --->
        Passed!

        <!--- this line makes session free, we recommend you to keep it --->
        <cfset StructDelete(session, "captcha") />

    <cfelseif StructKeyExists(form, "captcha")>

        Failed!

    <cfelse>

        <!--- in case that form isn't submitted this file will create a random number and save it in session --->

        <cfset session.captcha = RandRange(0,4) />
        <cfoutput>#session.captcha#</cfoutput>

    </cfif>

</cflock>

Please note that geenrated range from 0 to 4 is not really good, because of its small size (repeats often). But maybe it is just enough for this case.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文