You are here: How to prevent resending of $_POST data « All PHP « IT news, forums, messages
How to prevent resending of $_POST data

Posted by rcross on 09/28/40 11:42

Any thoughts on this?

Here's my situation. I've created a small, very light weight
call-tracking system for my company. I've been as good as I could be
regarding "good programming practices" (seperating content from
logic/structure). My index.php file contains a logic structure and
includes which lead to simple layouts which are controlled by a single
css file. The structure is as follows:

Does a valid session exist?
No: Has a login form been submitted?
No: Display login form
Yes: Process login form and if valid, associate the user_id to the
session_id
Yes: Has the submission form been submitted?
Yes: Submit data to database and display the form along with a
"submitted" message
No: Display the form

If anyone refreshes the page AFTER data has been submitted, a duplicate
entry is created in the database. I believe that the problem is in the
$_POST['submit'] object itself. I know I'm not doing anything
incorrect regarding normal field submission, so maybe it's just in the
way I'm asking PHP handle the POST data? Is there a trick to have the
script not re-submit the data if the data was already submitted once?

I have no idea how to get around this... I'd apprecaite any thoughts,
even thoughts regarding my current logic structure! I'm curious to see
if that is a normal logic structure to use for logging in.

Thanks!!

 

Navigation:

[Reply to this 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

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