views:

597

answers:

3

In the file http://example.com/path/foo.php, I have the form (formatting deleted):

<form action="/path/foo.php" method="post">
Email: <input type="text" name="email">
Password: <input type="password" name="password">
<input type="checkbox" name="remember" checked="checked"> Remember me
<input type="submit" value="Log In">
</form>

Sometimes users are not able to log in: the reported behavior was that they tried to log in and were presented with a fresh login screen.

When I've been able to duplicate the problem, it appears $_POST is empty: $_POST['email'] and $_POST['password'] lack the submitted values, and the following just logs "##":

error_log("#" . file_get_contents("php://input") . "#");

I can't see why this would be due to a redirect; it can't be a case of /directory -> /directory/ , and a look through Apache's relevant VirtualHost section turned up very little rewriting, and not any that should affect the file. (And the displayed URL is the same as the one referenced in the form.)

The system has been around for a few months and the problem was first reported to me today.

I'm planning on emerging updated Apache and PHP(5), in case there's a fluke that could be improved by a more recent version. But I'd be very interested in hearing other ways I might be getting an empty $_POST after filling out a form.

Thoughts?

A: 

Do you have 'register_globals' enabled? This a horrible security hole which would cause your POSTed data to be assigned to $email and $password instead of existing in the $_POST array.

If this optioned is enabled, disabling it will cause your script to run correctly and remove the potential security threat.

Colin O'Dell
Also, do you have any JavaScript running on that page? It could be interfering with the POST.
Colin O'Dell
$_POST, $_GET will be populated regardless of the register_globals setting. Turning register_globals on or off only effects the auto population of globals from the request, it does NOT effect the population of the aforementioned super global arrays/collections.
Alan Storm
@all - one down-vote is more than enough. The answer might not be useful, but he *is* trying to be helpful.
karim79
Thank you @AlanStorm for the correction and @karim79 for sticking up for a stackoverflow noob haha
Colin O'Dell
A: 

If, as you've said to Lucky, you can confirm this is a FF issue then have your users disable all their plugins/addons and try again. It could be they have some conflicts there.

Josh Lindsey
I'm checking whether the problem surfaces if I turn off my extensions, but based on the small number of total users and the largish number of people reportedly having this problem (and that I don't see why the site would particularly attract a Firefox user more), I'd expect the number of people reporting a problem to exceed the number of people running Firefox extensions. (On to checking if the problem surfaces on Firefox without extensions, though...)
JonathanHayward
A: 

Is the data available in the $_REQUEST variable? I know it's not POST-specific, but it should be populated with the posted data.

Colin O'Dell