Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-17-2005, 12:29 AM   #1
LQ Newbie
Registered: Aug 2004
Posts: 15

Rep: Reputation: 0
to all php programmers

how do i prevent resending of information when hitting the reload/refresh button?
i have a php script with apache server and runs in a linux box, fedora core 2 in particular.
the problem is that, i have a login form which uses session and post method and searches the mysql database to match the username/password, when i click on the logout button, logout.php is called which destroys the session. but when i hit the back button and reload it. there is a message that a POST DATA that expires from the cache is to be resend, and if i click okay, the page will reload and as if the user is logged in again... how do i correct this? please help...
Old 01-17-2005, 08:28 AM   #2
Registered: Mar 2004
Location: Austria
Distribution: Ubuntu 6.0.6, CentOS, Fedora, Debian
Posts: 47

Rep: Reputation: 15

you're probably in the wrong forum for that. You might wan't to check out for PHP coding problems.
But from what I think, you might want to check the referer variable (check the $_SERVER array) to see where the user comes from. This is quite unreliable and could be spoofed quite easily so this might not be the best way to change that.
I've had good experiences when putting the login/logout code into a seperate file. This way POST variables get deleted when returning to the normal website.

use code like

/*check for proper user here and set the session variable

header("Location: somewhere.php"); 

to redirect the user to the website again.

Really preventing the browser from resending the data is not really possible, as far as I know.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programmers Block- HELP! TGWDNGHN Programming 9 11-09-2005 07:02 PM
For all Programmers jazee Programming 13 10-15-2004 12:01 AM
PHP Programmers and HTML wanted Goblin Programming 0 08-31-2003 11:45 AM
For the QT Programmers kusio Programming 3 04-16-2003 04:00 PM
Any avd programmers here? MitchM99 General 1 03-25-2003 07:01 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:54 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration