06-22-2011, 02:54 AM
Hey,
I've been searching for an hour and doing tests myself and found out the issue for my script being executed twice - queries are getting executed twice so I believe the script is also run twice.
Here's the problem:
(I've tried full path and URL, both give me the same weird results: queries are getting executed twice)
Okay, it seems the problem is this:
Alright some more information, it seems that only images are affected. I've found this related article: http://forums.mysql.com/read.php?52,1143...http://forums.mysql.com/read.php?52,114324,114324#
It's the same problem as I described but the solution is not good enough..
Okay after some deep testing the problems seems to affect images only and ONLY when the request is not sent via POST because if we send via POST it works fine (switching to POST only would fix this issue but fixing the actual problem would be better I guess...)
I've been searching for an hour and doing tests myself and found out the issue for my script being executed twice - queries are getting executed twice so I believe the script is also run twice.
Here's the problem:
PHP Code:
|
If I comment:
PHP Code:
|
And uncomment the first:
PHP Code:
|
The script is executed twice. I have no idea why and can't seem to find anything related to this on the internet. If the script forces download, this no longer happens.
Note that if I comment:
PHP Code:
|
Which is a bit below that, then the problem no longer happens either (but with it uncommented and with force-download, it doesn't happen either).
This is the only thing I could find related to this problem but doesn't help at all:
Quote:When using readfile() -or fopen() and fpassthru() - make sure that if you are dealing with large files that are located on your server, use absolute paths and not URL's! Otherwise, the file will essentially be downloaded twice - the script will access the file from your web server itself, and then output it to the client, doubling the bandwidth. I made this mistake in a download script I made that included files on other servers, when the file was on mine, I forgot to use absolute paths. So, even for good practice if your files you're accessing are small, use absolute paths whenever possible. Seems obvious, but don't forget about it.http://www.theserverpages.com/php/manual...http://www.theserverpages.com/php/manual/en/function.fpa
(I've tried full path and URL, both give me the same weird results: queries are getting executed twice)
Okay, it seems the problem is this:
PHP Code:
|
Gotta check what's wrong with inline disposition.
Alright some more information, it seems that only images are affected. I've found this related article: http://forums.mysql.com/read.php?52,1143...http://forums.mysql.com/read.php?52,114324,114324#
It's the same problem as I described but the solution is not good enough..
Okay after some deep testing the problems seems to affect images only and ONLY when the request is not sent via POST because if we send via POST it works fine (switching to POST only would fix this issue but fixing the actual problem would be better I guess...)