开发者

Another Undefined Index (this one's defined though)

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

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']);

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&ses开发者_运维知识库sid=d0sma94yw4r4cdckv2ufhb&qid=1276957562382

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.'\'');

Yes, time is also defined as:

$time = time();

So, what is the issue here?


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

If those 2 are allright, I'd say you have a logical error somewhere else, var_dump() the $_POST and $_REQUEST superglobals to check.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜