另一个未定义的索引(虽然定义了这个) [英] Another Undefined Index (this one's defined though)
问题描述
好吧,PHP正在抛出此错误(在日志中)并且它对应用程序非常不利。
Alright, PHP is throwing this error (in the log) and it's quite detrimental to the application.
PHP Notice: Undefined index: sessid in methods.php on line 7
是的,我知道这个错误是什么意思是,我无法弄清楚的是为什么它明显被定义并说它未定义。以下是methods.php中的相关代码
Yes, I'm aware of what this error means, what I cannot figure out is why it's obviously defined and saying it's undefined. Here is the relevant code in methods.php
$sessid = mysql_real_escape_string($_REQUEST['sessid']);
现在,在你说没有它不明确!!!之前,这里是POST请求methods.php(是的,我也知道$ _REQUEST不可信任)。
Now before you go off and say that "NO IT'S UNDEFINED!!!", here is the POST request to the methods.php (and yes, I'm also aware that $_REQUEST "can't be trusted").
method=r&room=general&sessid=d0sma94yw4r4cdckv2ufhb&qid=1276957562382
如您所见, sessid显然是定义的,并被发送到methods.php。我以为我也会在这里抛出相关的查询。
As you can see, the sessid is obviously defined and is being sent off to the methods.php. I just thought I'd throw in the relevant query here too.
mysql_query('UPDATE active SET time=\''.$timestamp.'\' WHERE sessid=\''.$sessid.'\'');
是的,时间也定义为:
$time = time();
那么,这里有什么问题?
So, what is the issue here?
推荐答案
禁止使用拼写错误等,如果您的版本> = 5.3.0,您可能需要查看 request_order
(或 variables_order
如果 request_order
为空,则ini-setting设置为。如果在这两个中没有设置'P',则$ _POST数组将不在$ _REQUEST中(甚至不设置'P'不在 variables_order
据我所知)。请参阅: http://www.php.net/ manual / en / ini.core.php#ini.request-order
Barring typos etc, if you have a version >= 5.3.0, you might want to check what request_order
(or variables_order
if request_order
is empty) ini-setting is set to. If in none of those two the 'P' is set, the $_POST array will not be in $_REQUEST (and not even set it the 'P' is not in variables_order
afaik). See: http://www.php.net/manual/en/ini.core.php#ini.request-order
如果那些2都没问题,我会说你在某处有逻辑错误否则,var_dump() $ _ POST
和 $ _ REQUEST
要检查的超级全局。
If those 2 are allright, I'd say you have a logical error somewhere else, var_dump() the $_POST
and $_REQUEST
superglobals to check.
这篇关于另一个未定义的索引(虽然定义了这个)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!