RE: [PHP] Disable refresh?
| From: | Larry Brown | Date: | Mon, 02 Dec 2002 02:10:14 +0000 |
| Subject: | RE: [PHP] Disable refresh? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126663@lists.php.net to get a copy of this message | ||
Thanks guys this forum is going to get me in trouble. It is so convenient I
keep asking questions too soon. After submitting the amendment to the
original question I thought of the solution of setting a session variable
and then clearing it before and after the submittal page. I'll work the
gray matter a little harder next time before asking. Thanks again.
Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388
-----Original Message-----
From: cece@phphost.hu [mailto:cece@phphost.hu]
Sent: Sunday, December 01, 2002 8:58 PM
To: larry.brown@dimensionnetworks.com
Cc: php-general@lists.php.net
Subject: Re: [PHP] Disable refresh?
> Anyone know of a method of preventing a user from refreshing a page. I
> get multiple updates with the same information in my database...
Hello!
You can prevent it multiple ways. Two common solution:
- When creating form, add a unique id to it in a hidden field.
After succesful insert put that id into a container table,
what stores used ids. Before inserting, check the presence of
that id in that container. You can make unique ids with
php's uniquid() function, or if mod_unique_id compiled into
Apache, you can use $_SERVER['UNIQUE_ID'] too. Store expire
dates too with that ids to be able delete old ids with a
cronjob.
- Another way: this is easier, but not too elegant. After
inserting data, send a location header to browser to
redirect it from that form-processor page to an another.
After that, refreshing affects that page.
Heilig (Cece) Szabolcs
cece@phphost.hu - http://phphost.hu