首页 \ 问答 \ 验证码不工作在php,聪明(Captcha not working in php , smarty)

验证码不工作在php,聪明(Captcha not working in php , smarty)

我正在尝试在我的网站上实现验证码,但它始终给出错误 - captcha-sol错误。

请看我的代码

require_once('recaptchalib.php');
$publickey = "xxxxxxxxxxxxxx";
$privatekey = "xxxxxxxxxxxxxxxxxxxxxxxxx";

$resp = recaptcha_check_answer ($privatekey,$_SERVER["REMOTE_ADDR"],$_POST["recaptcha_challenge_field"],$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
            echo "You got it!";
    } else {

            echo "Error=". $resp->error;
    }

请在这里查看这是一个Ajax电话


I am trying to implement a captcha in my web site , but it is always giving an error incorrect-captcha-sol.

Please see my code

require_once('recaptchalib.php');
$publickey = "xxxxxxxxxxxxxx";
$privatekey = "xxxxxxxxxxxxxxxxxxxxxxxxx";

$resp = recaptcha_check_answer ($privatekey,$_SERVER["REMOTE_ADDR"],$_POST["recaptcha_challenge_field"],$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
            echo "You got it!";
    } else {

            echo "Error=". $resp->error;
    }

Please check here It is an Ajax call


原文:https://stackoverflow.com/questions/16387150
更新时间:2022-03-22 18:03

最满意答案

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
// Convert your value to IntegerValue and Save it
[prefs setInteger:[eventSelected.eventId integerValue] forKey:@"currentEvent"];
// Dont forget to synchronize UserDefaults
[prefs synchronize];

// To Access this value
NSLog(@"%d",[prefs integerForKey:@"currentEvent"]);

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
// Convert your value to IntegerValue and Save it
[prefs setInteger:[eventSelected.eventId integerValue] forKey:@"currentEvent"];
// Dont forget to synchronize UserDefaults
[prefs synchronize];

// To Access this value
NSLog(@"%d",[prefs integerForKey:@"currentEvent"]);

相关问答

更多
  • 我没有注意到NSUserDefaults代码本身有什么问题,尽管它只是在加载视图时抓取值,而不是在值更新时。 要解决此问题,您可以发送通知,让所有其他感兴趣的视图控制器知道状态更改。 在 - [NewEntry saveButton:]中,在NSUserDefaults中保存值后,添加 [[NSNotificationCenter defaultCenter] postNotificationName:@"ValuesChanged" ...
  • 你目前比较两个指针。 使用NSNumber的方法来实际比较两者: if([someNSNumberValue isEqualToNumber:[NSNumber numberWithBool:NO]]) { // ... } 要从NSNumber获取bool值,请使用-(BOOL)boolValue : BOOL b = [num boolValue]; 这样比较会比较容易, if([num boolValue] == NO) { // ... } You currently comp ...
  • 如果您通过按下主页按钮(在模拟器或设备上)终止您的应用程序,则NSUserDefaults将被保存。 如果您通过在Xcode(模拟器或设备)中按“停止”终止您的应用程序,则NSUserDefaults 可能会被保存,但是很有可能不会。 NSUserDefaults会定期NSUserDefaults任何更改,如果在过程持久化之前终止进程,那么它们将会消失。 你可以通过调用来强制保存: [[NSUserDefaults standardUserDefaults] synchronize]; 附录: 在iOS4 ...
  • 你开始使用@"Phase is Known"和一个小写的i 。 然后用大写的I切换到@"Phase Is Known" 。 这显然不匹配,因此您不会检索保存的值。 您应该将每个NSUserDefaults密钥保存在某个全局可访问的常量中,这样就不会像这样进行拼写错误。 You start off using @"Phase is Known" with a lower-case i. Then you switch to @"Phase Is Known" with an upper-case I. Thi ...
  • NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; // Convert your value to IntegerValue and Save it [prefs setInteger:[eventSelected.eventId integerValue] forKey:@"currentEvent"]; // Dont forget to synchronize UserDefaults [prefs synchronize]; ...
  • 要将NSNumber转换为int ,请使用以下代码: NSNumber number = [NSNumber numberWithInt:10]; //Pass integer value to NSNumber int intNumber = [number intValue]; // Get integer value back from NSNumber 通过这种方式,您可以将NSNumber转换为int 。 To get NSNumber into int, use the the ...
  • 您不能直接在NSUserDefaults存储NSURL ,只能存储NSData , NSString , NSNumber , NSDate , NSArray或NSDictionary ; 此外,任何NSArray或NSDictionary可能只包含这些类型的对象。 您必须将NSURL转换为这些类型之一,很可能通过使用absoluteString将它们转换为NSString。 You can't directly store an NSURL in NSUserDefaults, only NSData, ...
  • 你绝对应该使用其他机制。 NSUserDefaults适用于较小的值,但对于较大的值,您可以使用文件系统。 例如: NSString* path = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0]; path = [path stringByAppendingPathComponent:@"Private Documents"]; path ...
  • 答案来自rmaddy - 谢谢! 我需要查看索引,而不是数组的实际值。 NSInteger indexText = [numbers indexOfObject:[NSNumber numberWithInteger:textsize]]; 所以我把它放进去,然后返回了我想要的滑块位置的索引。 Answer comes from rmaddy - Thanks! I needed to look at the index, rather than the actual value of the array ...
  • 我猜你忘了将检索到的高分保存到变量中: let highscore = NSUserDefaults.standardUserDefaults().integerForKey("highscore") I guess you forgot to save retrieved highs score to the variable: let highscore = NSUserDefaults.standardUserDefaults().integerForKey("highscore")

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)