Reply to Re: avoid post resubmit on refresh

Your name:

Reply:


Posted by Bob Bedford on 06/20/05 10:32

"R. Rajesh Jeba Anbiah" <ng4rrjanbiah@rediffmail.com> a écrit dans le
message de news: 1119166143.754589.305780@g47g2000cwa.googlegroups.com...
Bob Bedford wrote:
> "Ewoud Dronkert" <firstname@lastname.net.invalid> a écrit dans le message
> de
> news: ao7ta19c5svknfb58a1cv2gu8v4oof1bm4@4ax.com...
> > On Tue, 14 Jun 2005 10:16:39 +0200, Bob Bedford wrote:
<snip>
> > Post the form to a php-only script with all the logic, from there use
> > header() to go back to the form.
> >
> I HATE this manner. That means that for every page where there is a form,
> I've to create an other with the logic. It's already quite difficult to
> get
> a low number of page, but adding every time a new one will kill me (I've
> about 80 php pages on my site).
>
> Any other way ?

if (the page is GETed)
{
if (!isset($_SESSION['submit_count'][$unique_page_id]))
$_SESSION['submit_count'][$unique_page_id] = 0;
//add hidden "submit_count" in form with a value
$_SESSION['submit_count'][$unique_page_id].
ini_set('url_rewriter.tags', 'form=fakeentry'); //rewrite only the
form
output_add_rewrite_var('submit_count',
$_SESSION['submit_count'][$unique_page_id]);
}
else if (page is POSTed)
{
if
($_SESSION['submit_count'][$unique_page_id]==$_POST['submit_count'])
{
//seems to be ok. Warning: we didn't take care of multiple
form scenario
//stuff to DB
$_SESSION['submit_count'][$unique_page_id] += 1;
}
else
{
//already processed.
}
}

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com


Thanks for the tip !

Cheers.

Bob

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация