LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-16-2005, 11:29 PM   #1
hokagi_ninja
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, 07:28 AM   #2
noeffred
Member
 
Registered: Mar 2004
Location: Austria
Distribution: Ubuntu 6.0.6, CentOS, Fedora, Debian
Posts: 47

Rep: Reputation: 15
Hi

you're probably in the wrong forum for that. You might wan't to check out http://www.phpbuilder.com/ 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
Code:
<?php 

/*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.
 
  


Reply



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 06:02 PM
For all Programmers jazee Programming 13 10-14-2004 11:01 PM
PHP Programmers and HTML wanted Goblin Programming 0 08-31-2003 10:45 AM
For the QT Programmers kusio Programming 3 04-16-2003 03:00 PM
Any avd programmers here? MitchM99 General 1 03-25-2003 06:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:18 PM.

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