RE: Preventing data from being reposted?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry, Wrong Reply!!
My mistake :(

---------------------------------------------

Hi!
If I understand you correctly, I hope this helps:

<?
// file.php

ob_start();
session_start();

If (!isset($_SESSION['login'])){
	If ( !( isset($_POST['name']) && isset($_POST['password']) &&
trim($_POST['name'])!="" && trim($_POST['password'])!="" ) ){
?>
<form method="post" action="file.php">
	<input type="text" name="name">
	<input type="password" name="password">
</form>
<?
	}
	else {
		if (trim($_POST['name'])=="yourname" &&
trim($_POST['password'])=="yourpassword"){
			$_SESSION['login']=$_POST['name'];
			Header("Location file.php");
		}
		else {
			// wrong data.
			Header("Location file.php");
		}
	}
}
else {
	$name=$_SESSION['login'];
	echo "You are logged as ".$name;
}
?>

There are probably some errors I haven't run the code.
Pedro.

-----Mensagem original-----
De: rory walsh [mailto:rorywalsh@xxxxxx] 
Enviada: quinta-feira, 3 de Março de 2005 12:01
Para: php-general@xxxxxxxxxxxxx
Assunto:  Preventing data from being reposted?

Is there anyway I can prevent data from being reposted when I hit the 
back button on my browser? When I hit back I get a message from my 
browser asking do I want to repost the data, can I prevent this window 
from appearing?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux