Forum Moderators: rogerd
I have a login form that people fill out, the form is checked with javascript to make sure everything is filled out, then it sends an an ajax request to a php function that actually checks the login against the database. The php queries the mysql database to see if someone with that username has that password and if it returns a result then the login is a success. This goes back to the form and lets the user know wether they have logged in or not.
I realize that I haven't added the actual code here but it's very basic and there is too much code to add here. I'm just wondering if anyone has had a similar problem or any ideas on what would cause an issue like this.
It doesn't seem to be a browser specific issue because they can try on multiple browsers and it still won't work for them. Sometimes it will suddenly start working for the user as well which makes the issue even more confusing.
Any ideas on what this could be or at least a suggestion for debugging it? So far I can't find something that is in common for all the users having this issue but perhaps I'm asking the wrong questions.
Thanks.
It really seams like something is happening in between the form and the data that ends up in the php script because it is acting like the user is entering the incorrect information. Is there something with the XMLHttpRequest that would cause it to act differently for different users?
Otherwise, there is only **one** way I know of to get to the root of these kinds of problems.
Log all user input. You're doing that anyway to head off potential spammers and hackers, right? :-)
I mean in your recipient scripts, log raw user data, IP, time, Every input field, everything you can think of, one line or section per submit. Before read/parse, before anything, open a file, dump the input, close the file. Server logs don't tell the whole story and are often cryptic. But if your script opens a private file and writes user input, every time any form is submitted, you can view it to compare user's problems with your log.
Also it's a good idea to script in a "rollover" size - that is,
if (logfile > 200000) { overwrite; }
else { append; }
200K is a lot of text, but if the problem goes away and you don't do this, eventually you'll have a log file eating up your entire domain.
I've had people call clients to complain their order form is broken. When I look in the log, I often see "Declined" or "invalid credit card number" or a reply from my scripts, "email or password mismatch." (The CC messages are RESPONSES from the CC gateway.)