need help! user backing up over DB Update script.

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
ragnar
Forum Newbie
Posts: 2
Joined: Fri Nov 21, 2003 5:52 pm

need help! user backing up over DB Update script.

Post by ragnar »

Does anyone know of a good method of possibly using session vars to make sure a user only submits a DB update one time.

Currently my setup is this:

1. ACTION PAGE: User clicks button linked to dbUpdate.php with $move=1 in URL which gives them access to execute script.
2. UPDATE PAGE: dbUpdate.php runs, does it's thing, then redirects back to original page for more choices.
3. HOWEVER. If user is safely back on the ACTION PAGE after having updated the DB with their selection, they could possibly hit the Browser's BACK Button and that page would load again dumping the data everywhere.

?? Is there a slick way to register a session var on the ACTION PAGE and then use it to allow the UPDATE PAGE to load. Once inside the Check Point in the UPDATE PAGE, Kill the session var so user couldn't back up.

This isn't working but that is as far as i have gotten. Hoping someone has a good idea on this.

Thanks in Advance!

Ragnar.
Linkjames
Forum Commoner
Posts: 90
Joined: Tue Sep 16, 2003 8:39 am

Post by Linkjames »

Simply set a variable using sessions once they are finished on the update page. Have the action page check if they have this session variable set, and dissallow them to use the form if it is.
ragnar
Forum Newbie
Posts: 2
Joined: Fri Nov 21, 2003 5:52 pm

Post by ragnar »

I use the ACTION Page to fire the UPDATE Page over and over again. If I set the session and leave it open, I can then only use the ACTION > UPDATE sequence once unless I destroy the session var somewhere in the loop that simultaneously disallows backing up over the UPDATE page while still allowing for a valid firing of the UPDATE Page from the ACTION page.

Thanks for responding. It is much appreciated.
Post Reply