LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   to all php programmers (https://www.linuxquestions.org/questions/linux-newbie-8/to-all-php-programmers-278703/)

hokagi_ninja 01-16-2005 11:29 PM

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

noeffred 01-17-2005 07:28 AM

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.


All times are GMT -5. The time now is 07:06 AM.