|
Prev: Problem with Oracle and some other extensions on IIS Server
Next: php-config script is missing from the installer
From: "Sukhwinder Singh" on 25 Jun 2008 16:29 I just verified that the form is infact posted twice (by IE) by using session variable. When form is posted I set a session variable after doing the import and at start of the same import script I check if the form has been already posted from session variable and if the form has already been posted just return to some other page which unsets that session variable. But still I want to find the cause of the problem. ----- Original Message ----- From: Dan Shirah To: Sukhwinder Singh Cc: php-windows(a)lists.php.net Sent: Thursday, June 26, 2008 1:31 AM Subject: Re: [PHP-WIN] IE/ IIS / PHP - Form posted twice in case of redirection Are you sure it's not something in your code? I am also using IE/IIS/PHP and I have a form that on submission closes the page and opens up a new window displaying "Your data has been saved" and it does not create 2 rows in my MSSQL database. Dan
From: "Sukhwinder Singh" on 25 Jun 2008 17:07 I think this must be some kind of PHP ISAPI or IE bug. If I replace this: header('Location:'. $url); exit; WIth echo "<script language='javascript'>\n"; echo "location.replace('$url');\n"; echo "</script>"; Then the double post does NOT HAPPEN. ----- Original Message ----- From: Dan Shirah To: Sukhwinder Singh Cc: php-windows(a)lists.php.net Sent: Thursday, June 26, 2008 1:31 AM Subject: Re: [PHP-WIN] IE/ IIS / PHP - Form posted twice in case of redirection Are you sure it's not something in your code? I am also using IE/IIS/PHP and I have a form that on submission closes the page and opens up a new window displaying "Your data has been saved" and it does not create 2 rows in my MSSQL database. Dan
From: "Sukhwinder Singh" on 25 Jun 2008 18:00
My application is using all sorts of libraries, from pear db, quickform to smarty. So it was difficult for me to provide the sample code. Now I have just created a simple upload file (please copy and paste from below). Which does nothing but logs the access to find out about double post. I had tried many different php versions and all produced same problem. Let me know what you find out. If you'll upload a small text file you'll see that there are two entries in log file for one access. The platform to test is IIS (ISAPI) php 5 and Internet explorer 6. (IE 7 may not post values twice but it will display some page not found error.) <?php set_time_limit ( 300); if (@$_POST['submitted'] == 'yes') { $csv_file = $_FILES['csv_file']; if ($csv_file['size'] > 0) { $fp = fopen('access.txt', 'a'); fwrite($fp, 'Accessed at '. date('d-m-y H:i:s u'). "\r\n"); fclose($fp); header('Location:http://www.google.com'); exit; } else if ($csv_file['error'] == UPLOAD_ERR_FORM_SIZE || $csv_file['error'] == UPLOAD_ERR_INI_SIZE) { $error = "File size exceeds max allowed size of whatever"; } else { $error = "There was error in uploading your file."; } } ?> <html> <head> <title> test </title> </head> <body> <?php if (isset($error)) { echo "<B>$error</B>"; } ?> <form method="post" enctype="multipart/form-data"> <input type="file" name="csv_file" /> <input type="hidden" name="submitted" value="yes" /> <input type="submit" value="Submit" /> </form> </body> </html> ----- Original Message ----- From: Dan Shirah To: Sukhwinder Singh Cc: php-windows(a)lists.php.net Sent: Thursday, June 26, 2008 1:31 AM Subject: Re: [PHP-WIN] IE/ IIS / PHP - Form posted twice in case of redirection Are you sure it's not something in your code? I am also using IE/IIS/PHP and I have a form that on submission closes the page and opens up a new window displaying "Your data has been saved" and it does not create 2 rows in my MSSQL database. Dan |