掌上黄飞鸿之英雄有梦联盟上回复帖子是有请求来路不正确或表单验证串不符,怎么解决啊

7613查看|1回复
抱歉,您的请求来路不正确或表单验证串不符,无法提交 解决方法
阅读权限255
签到天数: <span style="color:#FF 天该用户今日未签到
马上注册,一起探讨正确快速的建站方法
才可以下载或查看,没有帐号?
一般出现 “抱歉,您的请求来路不正确或表单验证串不符,无法提交” 这种问题的地方都是在提交表单的时候出现的。因为 在提交表单的时候 会进行校验,submitcheck()函数,这个函数首先会校验表单中的formhash,如果formhash出现问题,那么就会出现“抱歉,您的请求来路不正确或表单验证串不符,无法提交” 这种问题。submitcheck()这个函数 放在 source\class\helper\helper_form.php 中。
解决方法:
第一种方法:
请检查你本地的时间是否和服务器的时间一致。如果不一致请同步时间,更新缓存。
第二种方法:
请检查你提交的表单中,是否有&input type=&hidden& name=&formhash& value=&{$formhash}&&,如果没有请手动添加上去。(这种情况一般会在IE6上面出现,其他浏览器正常。)
第三种方法:
打开“source\class\helper\helper_form.php”, 然后把“$_GET['formhash'] == formhash() ”修改为“$_G['formhash'] == formhash() ”。
第四种方法:
在提交的动作控制器中,去掉submitcheck()验证。 (此种方法需要对discuz的核心比较熟悉。)比如,在注册的时候,你需要找到“source\class\class_member.php”文件中register_ctl类中的on_register()方法,在if(!submitcheck('regsubmit', 0, $seccodecheck, $secqaacheck)) { }处,可以把submitcheck()换成if(isset($_POST)){ } .虽然不安全,但是也是一种解决方法。
Discuz!模板插件定制和项目外包等技术支持 QQ:,有偿服务
& & 全心全意为站长提供简单易懂的快速建站教程
阅读权限80
签到天数: 9 天该用户今日未签到
超级站长, 积分 11925, 距离下一级还需 18075 积分
在线时间44 小时
说的非常好啊,很具体。顶zb7论坛!
注册天数超过365天的论坛元老
拥有元宝超过8000的土豪大大
站帮网管理员
站帮网管理员
在站长互助版区帮助其他站长解决100次答疑
至尊站长勋章
拥有帮币超过10000的至尊站长
通过任务在聊吧发帖量达到1000帖的灌水达人们后使用快捷导航没有帐号?
1最近.用UC论坛模式上论坛回复帖子经常出现这样的情况: 抱歉,您的请求来路不正确或表单验证串不符,无法交。根本回复不了帖子。
2.发帖子用UC网盘上传附件,传不上去,页面跳转之后带不上去附件。
这些问题出现大概一周的时间了,前些天到UC论坛发帖子反馈也没有人答复解决。UC也不作为了,可能暗示着什么吧,可能有些东西要完蛋了。
签到天数: 720 天[LV.9]以坛为家II
当前用户组为 藕粉导师当前积分为 11201, 升到下一级还需要 8799 点。
沙发是我的
签到天数: 701 天[LV.9]以坛为家II
当前用户组为 藕粉导师当前积分为 19976, 升到下一级还需要 24 点。
签到天数: 208 天[LV.7]常住居民III
当前用户组为 藕粉导师当前积分为 9161, 升到下一级还需要 10839 点。
u3内核没有,灵动版倒是有
签到天数: 301 天[LV.8]以坛为家I
当前用户组为 藕粉达人当前积分为 6987, 升到下一级还需要 513 点。
我只用過靈動版。。
签到天数: 123 天[LV.7]常住居民III
当前用户组为 藕粉高阶当前积分为 1942, 升到下一级还需要 1258 点。
应该不会的~
签到天数: 150 天[LV.7]常住居民III
当前用户组为 藕粉达人当前积分为 4051, 升到下一级还需要 3449 点。
应该不会吧,,,
签到天数: 150 天[LV.7]常住居民III
当前用户组为 藕粉达人当前积分为 4051, 升到下一级还需要 3449 点。
这个应该属于网站后台问题吧……
签到天数: 332 天[LV.8]以坛为家I
当前用户组为 藕粉达人当前积分为 3758, 升到下一级还需要 3742 点。
毛线& && &&&
签到天数: 181 天[LV.7]常住居民III
当前用户组为 藕粉达人当前积分为 5948, 升到下一级还需要 1552 点。
U3内核可以上传,嘿嘿,估计是Uc用户增加了吧
好吧!状态栏时时显示 星期 月 日10种埋没你才能的生活方式,赶紧戒掉吧!推荐一个小浏览器Naked Browser ,非常好用壳浏览器做的最好的是 微 米浏览器,其它壳还在为臃肿的桌面兀自捉急吗? 10K最小桌面
12345678910
6_9帖子:30849
积分:66043清明上坟图帖子:12879
积分:61288primelo帖子:17597
积分:36395论坛发帖显示“抱歉,您的请求来路不正确或表单验证串不符,无法提交”怎么办_百度知道
论坛发帖显示“抱歉,您的请求来路不正确或表单验证串不符,无法提交”怎么办
时候还会显示500 internal server error浏览帖子时没有任何毛病,求助,就是不能发新帖,也可以编辑帖子
  请检查你提交的表单中,这个函数首先会校验表单中的 value=&quot。  第四种方法,您的请求来路不正确或表单验证串不符;{$formhash}&quot,你需要找到“source&#92.php 中:  第一种方法;regsubmit&#39, 0;helper&#92.虽然不安全。  第五种方法,那么就会出现“抱歉,其他浏览器正常,您的请求来路不正确或表单验证串不符,是否有&lt。  解决方法。)  第三种方法;; name=&class&#92,可以把submitcheck()换成if(isset($_POST)){ } ;helper&#92;input type=&formhash&#39。(这种情况一般会在IE6上面出现,在注册的时候;class&#92, $seccodecheck  一般出现 “抱歉:  请检查你本地的时间是否和服务器的时间一致;&class&#92;] == formhash() ”修改为“$_G[&#39, $secqaacheck)) { }处。  submitcheck()这个函数 放在 source&#92;formhash&quot,去掉submitcheck()验证,无法提交” 这种问题的地方都是在提交表单的时候出现的,如果formhash出现问题;helper_form:  在提交的动作控制器中;formhash&#39;hidden&quot,如果没有请手动添加上去.php”, 然后把“$_GET[&#39。如果不一致请同步时间;class_member,在if(,但是也是一种解决方法。  因为discuz 在提交表单的时候 会进行校验!submitcheck(&#39;] == formhash() ”:  打开“source&#92,更新缓存.php”文件中register_ctl类中的on_register()方法。  第二种方法。)比如,submitcheck()函数。 (此种方法需要对discuz的核心比较熟悉;;helper_form,无法提交” 这种问题
网络部主任
其他类似问题
论坛发帖的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁iOS 问题:kLXw_2132_saltkey=mMDzBLtN;kLXw_2132_auth=fcb8OE+ETEeW1ooNw2kIIw44ZvUngDkubC7e/MExfI7GdbEmbaoXRkAuwIBjA3mDsWBGwZKNkc+I/F4EAsyE; 这是接口文档指定得一个拼接后得cookie,我如何吧它发给服务器。我用了ios自带得请求方式,也用了asi,但是怎么做都不行,求大神指导,就一段简单得代码就可以了,url可以随便写,我就想知道如何将这段字符串cookie传给服务器识别。 -
kLXw_2132_saltkey=mMDzBLtN;kLXw_2132_auth=fcb8OE+ETEeW1ooNw2kIIw44ZvUngDkubC7e/MExfI7GdbEmbaoXRkAuwIBjA3mDsWBGwZKNkc+I/F4EAsyE; 这是接口文档指定得一个拼接后得cookie,我如何吧它发给服务器。我用了ios自带得请求方式,也用了asi,但是怎么做都不行,求大神指导,就一段简单得代码就可以了,url可以随便写,我就想知道如何将这段字符串cookie传给服务器识别。
共有 22 个回答
这不是一般的传输字符串吗?用http协议就可以了呀,比如用AFNetworking类库就可以很方便给服务器上传字符串啊。
登录后方可回复
NSString *postURL =[NSString stringWithFormat:@":8081/bbs/api/mobile/index.php?mobile=no&version=1&module=sendreply&replysubmit=yes&=%@&=%@&=&=%@&mobiletype=2",postTidStr,replaceTF.text,ForHas];
NSURL *url = [[NSURL alloc] initWithString:postURL];
ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url];
if (cookie) {
[request addRequestHeader:@"Cookie" value:cookieStr];
[request startSynchronous];
if (![request error]) {
NSString *jsonResult = [request responseString];
NSDictionary *lotteryResultDic = [jsonResult JSONValue];//对json编码的数据解码
NSLog(@"%@",[[lotteryResultDic objectForKey:@"Message"] objectForKey:@"messagestr"]);
这是我的操作,但是,还是验证失败
登录后方可回复
Using url-encode it first:
NSString* encodeURLString(NSString* str) {
NSString *result = (NSString *) CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)str, NULL, CFSTR("?=&+"), kCFStringEncodingUTF8);
return [result autorelease];
登录后方可回复
抱歉,您的请求来路不正确或表单验证串不符,无法提交
这是给我的提示,wo的cookie已经用正则表达式转换了,TRTM_2132_saltkey=ES1OrR1E;TRTM_2132_auth=6640Kkg12ZCiS2Xm/xDaGTTKL4l20VN+gmsLJ0aRNie7yiRyWzlBm36pFNld5lZmMPxVJHmlH4cYMbD1HoAHFZ这是转换后的结果,也就是那个cookieStr的直。
至于前面那个url 是带的参数,不需要正则表达式转换吧。结果还是前面那个提示。
登录后方可回复
NSString *postURL =[NSString stringWithFormat:@":8081/bbs/api/mobile/index.php?mobile=no&version=1&module=sendreply&replysubmit=yes&=%@&=%@&=&=%@&mobiletype=2", encodeURLString (postTidStr), encodeURLString(replaceTF.text), encodeURLString(ForHas)];
登录后方可回复
You need to encode the value that you want to pass into the URL link
For example, I want to pass the "key" with value "1 3":
NSString *postURL =[NSString stringWithFormat:@":8081/bbs/api/mobile/index.php?key=%@", encodeURLString(@"1 3")];
The post URL with the encoded value "1 3" will become ":8081/bbs/api/mobile/index.php?key=1 3"
The space " " will become " "
All the browser will auto do this encoding also, you can try to copy this link: ":8081/bbs/api/mobile/index.php?key=1 3" and then paste to Safai and then press enter to see the encoded URL
登录后方可回复
The post URL with the encoded value "1 3" will become ":8081/bbs/api/mobile/index.php?key=1%203"
The space " " will become "%20"
登录后方可回复
:8081/bbs/api/mobile/index.php?mobile=no&version=1&module=sendreply&replysubmit=yes&tid=25&= Bchdhggggdfffgffg&=&formhash=69e6acf6&mobiletype=2
这是我按照祢得方法操作后打印得url信息。TRTM_2132_saltkey=ixcByFTRTM_2132_auth=1573+uktnUK+s2/8n172m6zyFraeGh0/zpFP76/eDtgLmSJPHNX/nhWox650e7pmApJtu/jCkGhBAlC9KE3Waa53zQ;
这是带得cookieStr 打印得信息。
这两个貌似都对上了,没有空格,都通过祢得那个encodeString 操作了。但是还是提交失败。
这是我qq,可以加上聊聊嘛,现在我都不知道是论坛得问题还是我这边得问题了。麻烦了
登录后方可回复
Sorry for I am not using QQ
&=%@ &-----it should be "&=%@", right?
&=%@ &-----it should be "&=%@", right?
why there is the extra ";"
登录后方可回复
In iOS side, I think it should be correct if you have already used the encodeURLString function.
So I guess that the problem is coming from server side.
登录后方可回复
登录后方可回复
%20 is space
登录后方可回复
GET /bbs/api/mobile/index.php?mobile=no&version=1&module=secure&type=login
POST /bbs/api/mobile/index.php?mobile=no&version=1&module=login&loginsubmit=yes&loginfield=auto&submodule=checkpost
参数:password=111111&username=admin&formhash=c092f28f
登录成功后,会返回如下信息,此信息包含 cookie
Variables":{"cookiepre":"kLXw_2132_","auth":"fcb8OE+ETEeW1ooNw2kIIw44ZvUngDkubC7e\/MExfI7GdbEmbaoXRkAuwIBjA3mDsWBGwZKNkc+I\/F4EAsyE","saltkey":"mMDzBLtN"
实际的 cookie 应该由以上字符串拼接而成,拼接规则如下:
[cookiepre]saltkey=[saltkey];[cookiepre]auth=[auth];
对于上面的返回,实际应为:
kLXw_2132_saltkey=mMDzBLtN;kLXw_2132_auth=fcb8OE+ETEeW1ooNw2kIIw44ZvUngDkubC7e\/MExfI7GdbEmbaoXRkAuwIBjA3mDsWBGwZKNkc+I\/F4EAsyE;
同时,需要对以上 cookie 字符串进行编码,如采用:URLEncode,即实际 cookie 只由字母和数字组成,对于其它符号,则由转义符%xx代替。
对于以上cookie,最终值为:
kLXw_2132_saltkey=mMDzBLtN;kLXw_2132_auth=fcb8OE+ETEeW1ooNw2kIIw44ZvUngDkubC7e/MExfI7GdbEmbaoXRkAuwIBjA3mDsWBGwZKNkc+I/F4EAsyE;
POST /bbs/api/mobile/index.php?mobile=no&version=1&module=newthread&topicsubmit=yes&fid=2
参数:message=健康快乐快乐&formhash=eed1a8df&allownoticeauthor=1&=哈哈哈哈哈哈哈&mobiletype=2
需要带上 cookie
POST /bbs/api/mobile/index.php?mobile=no&version=1&module=sendreply&replysubmit=yes&tid=1
参数:message=你好啊&=&formhash=eed1a8df&mobiletype=2
需要带上 cookie
这是接口文档,现在我已经登陆成功,cookie也照样获取到了,前面可以看见,就是在回帖的时候,除了message
还要带上cookie 由于以前没做过,不知道选择asi的哪个类合适,前面做的操作您也看见呢,可是老是失败,安卓那边已经ok了。url就是前面那个url,想请教下用哪个方法带cookie回复服务器最直接简单。希望您给段代码例子就用我前面那些数据
登录后方可回复
You can try to use this two function to get back and then save the cookies.
After the cookies is saved. All the NSURL call should auto pass the cookies to the server.
-(void)saveCookies:(NSArray *)cookies
// We have cookies from the login. Save them for use.
double oneDay = 3600.0 * 24.0; // one day in seconds.
NSDate *expirationDate = [NSDate dateWithTimeIntervalSinceNow: 14.0 * oneDay]; // 2 week expiry.
// Go through the cookies and save them.
for (NSHTTPCookie *cookie in cookies)
NSMutableDictionary* cookieProps = [NSMutableDictionary dictionaryWithCapacity: 5];
[cookieProps setValue: cookie.name forKey:NSHTTPCookieName];
// Its name.
[cookieProps setValue: expirationDate forKey:NSHTTPCookieExpires];
// So its not discarded.
[cookieProps setValue: @"." forKey: NSHTTPCookieDomain];
// Domain required or URL.
[cookieProps setValue: cookie.value forKey:NSHTTPCookieValue];
// required value.
[cookieProps setValue: @"/" forKey: NSHTTPCookiePath]; // You really really need this or it won't create the cookie.
NSHTTPCookie* aCookie = [NSHTTPCookie cookieWithProperties: cookieProps];
if (aCookie)
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie: aCookie]; // Save it.
-(void)getCookies
NSHTTPURLResponse *
NSMutableURLRequest *
request = [[[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@""]
cachePolicy:NSURLRequestReloadIgnoringCacheData
timeoutInterval:60] autorelease];
NSData * data = [NSURLConnection sendSynchronousRequest:request returningResponse:& error:&];
NSLog(@"%@", [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease]);
NSArray * all = [NSHTTPCookie cookiesWithResponseHeaderFields:[response allHeaderFields] forURL:[NSURL URLWithString:@""]];
NSLog(@"%d", all.count);
for (NSHTTPCookie *cookie in all) {
NSLog(@"Name: %@ : Value: %@", cookie.name, cookie.value);
NSArray *anyCookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
for (NSHTTPCookie *cookie in anyCookies) {
NSLog(@"--Name: %@ : Value: %@", cookie.name, cookie.value);
[self saveCookies:all];
You should call:
[self getCookies];
And then check back the cookies saved:
NSDictionary *dict = [NSHTTPCookie requestHeaderFieldsWithCookies:[[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]];
NSLog(@"dict %@", dict);
登录后方可回复
您的意识,我在请求url的时候,cookie会自动发到服务器么?
登录后方可回复
Yes, this is just like the Safari help you to save the cookie after you have logged in.
登录后方可回复
-(void)saveCookies:(NSArray *)cookies
// We have cookies from the login. Save them for use.
double oneDay = 3600.0 * 24.0; // one day in seconds.
NSDate *expirationDate = [NSDate dateWithTimeIntervalSinceNow: 14.0 * oneDay]; // 2 week expiry.
// Go through the cookies and save them.
for (NSHTTPCookie *cookie in cookies)
NSMutableDictionary* cookieProps = [NSMutableDictionary dictionaryWithCapacity: 5];
[cookieProps setValue: cookie.name forKey:NSHTTPCookieName]; // Its name.
[cookieProps setValue: expirationDate forKey:NSHTTPCookieExpires]; // So its not discarded.
[cookieProps setValue: @"." forKey: NSHTTPCookieDomain]; // Domain required or URL.
[cookieProps setValue: cookie.value forKey:NSHTTPCookieValue]; // required value.
[cookieProps setValue: @"/" forKey: NSHTTPCookiePath]; // You really really need this or it won't create the cookie.
NSHTTPCookie* aCookie = [NSHTTPCookie cookieWithProperties: cookieProps];
if (aCookie)
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie: aCookie]; // Save it.
-(void)getCookies
NSString *postURL =[NSString stringWithFormat:@":8081/bbs/api/mobile/index.php?mobile=no&version=1&module=sendreply&replysubmit=yes&=%@&=%@&=&=%@&mobiletype=2",encodeURLString(postTidStr),encodeURLString(replaceTF.text),encodeURLString(ForHas)];
NSHTTPURLResponse *
NSMutableURLRequest *
request = [[[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:postURL]
cachePolicy:NSURLRequestReloadIgnoringCacheData
timeoutInterval:60] autorelease];
// [request setValue:cookieStr forHTTPHeaderField:@"cookie"];
// [request addValue:cookieStr forHTTPHeaderField:@"cookie"];
NSData * data = [NSURLConnection sendSynchronousRequest:request returningResponse:& error:&];
NSLog(@"%@", [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease]);
NSArray * all = [NSHTTPCookie cookiesWithResponseHeaderFields:[response allHeaderFields] forURL:[NSURL URLWithString:postURL]];
NSLog(@"%d", all.count);
for (NSHTTPCookie *cookie in all) {
NSLog(@"Name: %@ : Value: %@", cookie.name, cookie.value);
NSArray *anyCookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
for (NSHTTPCookie *cookie in anyCookies) {
NSLog(@"--Name: %@ : Value: %@", cookie.name, cookie.value);
[self saveCookies:all];
NSDictionary *dict = [NSHTTPCookie requestHeaderFieldsWithCookies:[[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]];
NSLog(@"dict %@", dict);
NSDictionary *postDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&];
NSLog(@"%@",[[postDic objectForKey:@"Message"] objectForKey:@"messagestr"]);
if ([[[postDic objectForKey:@"Message"] objectForKey:@"messageval"]isEqualToString:@"submit_invalid"]) {
ForHas = [[postDic objectForKey:@"Variables"] objectForKey:@"formhash"];
[self crely];
request = [[[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:postURL]
cachePolicy:NSURLRequestReloadIgnoringCacheData
timeoutInterval:60] autorelease];
NSData * data = [NSURLConnection sendSynchronousRequest:request returningResponse:& error:&];
NSLog(@"%@", [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease]);
NSDictionary *postDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&];
NSLog(@"%@",[[postDic objectForKey:@"Message"] objectForKey:@"messagestr"]);
//点击发表按钮调用
-(void)clickreply
getCookies];
结果依旧是
抱歉,您的请求来路不正确或表单验证串不符,无法提交
这个提示和formhas
有关,还和什么有关。实在搞不懂
登录后方可回复
I suggest you use the Safari to test your server API first. And the ASI class should have the API call to add cookies to the request.
登录后方可回复
登录后方可回复
??? 什么意识?
登录后方可回复
@▲  尐青春丶 : I am just testing the forum to see that it can post this kind of symbol normally or not
登录后方可回复
我吧 我的cookie值
和 url连接拿到安卓同事那边用post 工具测试 一下就成功了了。证明我保存的数据没有问题,就是发送给服务器这一步出了问题。真心不知道怎么解决了。
登录后方可回复
登录后方可回答
耗时 0.1343 秒

我要回帖

更多关于 lol英雄联盟单机版 的文章

 

随机推荐