No such thing as a small change | |
PerlMonks |
Weird CGI behaviour on different Browsers - Apacheby Yaerox (Scribe) |
on Aug 04, 2015 at 11:25 UTC ( [id://1137349]=perlquestion: print w/replies, xml ) | Need Help?? |
Yaerox has asked for the wisdom of the Perl Monks concerning the following question:
Hey everyone. First of all I need to say sorry for non workable scripts. I'm facing a weird problem on a website I coded. I can't post a workable script because developing a test-script would take a lot of time beside the fact, that I'm working the same way on many many different websites and I'm only facing this problem at one point on one website. First of all I'll try to describe the way I work. I got a homepage where you can generate order notices. So I got a perl-cgi-script which is printing a webform. If you send this webform, a script - let's call it work.pl - is called. This script is doing stuff on a database. Coming closer to the problem now ... I connect to my database and do some SELECT to check, if a datarow with the etnered number does already exist like this pseudo-code: This is working fine on Chrome and Firefox. I never could force an mistake on both browsers here. If I now use the IE (latest version and updates - Version: 11.0.9600.17914, Updateversion: 11.0.21) it behaves different sometimes. Example: I enter Number 2 and send the form. Ask the database if a row with the value 2 in a specific column exist. If it does, my if-clause should redirect to error.pl and exit the script. If it does not, the script should follow more instructions on the #do more stuff aprt and later redirect to the success.pl page. Sometimes, it does work like it should, but even sometimes it tells me a row with the number X already exists but it definetaly does not at the point on the script! On the #do more stuff here part the row with the number entered would be inserted into database. Now I got the weird behaviour like already said, plus the exit is getting ignored. So even if the if-clause matches and I redirect the row is getting inserted into database later on #do more stuff ... another third weird way the script runs sometimes is, that the line is getting inserted 2 times ... all happens sporadic and I can't 100% reproduce it. No loops on this point! My first thoughts was: - redirection loop - wrong if-clause due to the datatype of the variables (the data type on the db is NUMBER - working with oracle) I'm clueless, what the hell is going on here ... I did some print debugging and this always behaves the same: if I entered a number, which isn't in my DB now, the print $iNumber should be empty, but in real it is the exact same number I entered. So in this case if clause always matches like it should. But why the script ignores the exit tho and still do the rest of the script? Imo browsers can't infect the way apache is working, or am I wrong? Anyway, even debugging with the developer tools in browsers won't help me right now to see if I got a redirection loop, or what is going on. Apache error-log is clean, I'm now take a look on access-log to check redirection-loop on aother way. Please let me know if something sounds wrong, or if you need some more explanaitions. I'll do my best to give you as many information you need... So far, thanks in advice. Update: I just looked into my apache-access.log and found out that it seems to seriously getting called 2 times. Then god knocked on my brain, remembering me I submit the form using javascript... I removed return true; and it seems to work. I'm not sure yet, and I really need to make 100% sure this is the mistake, so I'm on this. So far thank you. If you got any pros/cons if this could be what's wrong or not, feel free to let me know.
Back to
Seekers of Perl Wisdom
|
|