CodeIgniter reCaptcha 问题
好吧,我在这个网站上看到过类似的问题,但他们没有我在这个特定问题上寻找的所有手持细节!
我在使用 reCaptcha 的 JS 版本和为 CodeIgniter 1.7.1 制作的 PHP 版本之间徘徊。
使用 JS 版本,我将其显示在生成的 HTML 中,但我不确定如何将正确的结果传递给 PHP形式。目前,周围的表单仅在 PHP 中发布是否有“任何”文本输入,而不是是否是正确的文本。我可以监视验证码文本输入字段以查看是否提交了任何内容,但这不会检查实际的 javascript 以获得正确的结果。我需要一个 PHP 函数调用,可以从 javascript 使用 Recaptcha.create 生成的 HTML 中获取调用。
您可能会想:既然 codeigniter 是 PHP 的,为什么不直接使用 PHP 版本的 recaptcha 呢? CodeIgniter 结构是我处理过的最不直观的 PHP 和 MVC 结构。在我正在编辑的这个网站上查找必要的函数调用已经变成了逆向工程练习。
我还有一个 PHP 版本,在这里制作 https://github.com/seanmcgary/Codeigniter-ReCaptcha,就像经典的 CodeIgniter 风格一样,文档基本上不存在。我知道该版本适用于 CodeIgniter 1.7,但我不知道它是什么版本的 reCaptcha。
请不要将我链接到 codeigniter wiki,仅提供相关帮助。
实现 JS 版本和部分 PHP 版本变得很复杂,因为一个版本可能更实用。所以想请教一下各位,谢谢!
Okay all, I have seen similar questions asked on this site, but they don't have all the handholding details I'm looking for on this particular issue!
I am in limbo between using the JS version of reCaptcha and a PHP version made for CodeIgniter 1.7.1
With the JS version I have it displayed within the generated HTML but I'm not sure how to get the proper result passed through to the PHP form. The surrounding form currently only posts in the PHP whether there was "any" text input, not if it was proper text. I can monitor the captcha text input field to see if anything was submitted, but this doesn't check the actual javascript for a proper result. I need a PHP function call that can get a call from the HTML that the javascript generates with Recaptcha.create.
You might be thinking: Since codeigniter is PHP why not just use the PHP version of recaptcha? Well the CodeIgniter structure is the most unintuitive PHP and MVC structure I've dealt with. Finding the necessary function calls on this site I am editing has turned into a reverse engineering exercise.
I also have a PHP version, made here https://github.com/seanmcgary/Codeigniter-ReCaptcha, and just like in classic CodeIgniter flavor, the documentation is basically nonexistent. I know that version is for CodeIgniter 1.7, but I don't know what version of reCaptcha it is.
Please don't link me to the codeigniter wiki, just relevant assistance.
It is becoming convoluted to work on implementing the JS version, and parts of a PHP version because one version might be more practical. So I'm asking you guys, thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有我的想法 recaptcha 如何在 Codigniter 上工作。我无法清楚地向您解释,但我希望您能理解下面的代码:
将此代码添加到您的配置文件中
将此代码添加到您的验证表单中
,并且不要忘记将此代码添加到 recaptcha 将验证的控制器中
将此代码添加到表单中哪里会出现 recaptcha
并且不要忘记 Javascript
如果您想从主页到模式中出现两次 recaptcha 将此代码添加到您的模式中
添加此代码在您想要 recaptcha 出现的位置
这就是我能做的 ^_^
演示: https://www.waraywarayako.ph/
I have my on idea how recaptcha works on Codigniter. I cannot explain it to you clearly but I hope you can understand this codes below:
Add this to your config files
Add this code to your validation form
and dont forget to add this to the controller where the recaptcha will validate
Add this codes to the form where recaptcha will appear
And don`t forget the Javascript
And if you want to appear recaptcha twice from main page to modal add this code to your modal
add this code for where you want recaptcha will appear
This is all I can do ^_^
Demo: https://www.waraywarayako.ph/
这篇 wiki 文章和库非常简单。因为您不需要的只是一个链接,这里有一些来自 wiki 文章的示例代码可以帮助您入门。
该代码确实非常不言自明。使用公钥和私钥设置您的配置,然后在控制器中加载验证码和密码。 form_validation 库并根据验证状态显示正确的视图。
配置/recaptcha:
控制器:
This wiki article and library are extremely simple. Because you don't want just a link here is some sample code from the wiki article to get you started.
The code is really quite self explanatory. Set up your config with your public and private keys, then in your controller load the recaptcha & form_validation libraries and show the proper view depending on the status of the validation.
config/recaptcha:
controller: