RE: [PHP] Preventing data from being reposted?
| From: | pmpa | Date: | Fri, 04 Mar 2005 00:43:55 +0000 |
| Subject: | RE: [PHP] Preventing data from being reposted? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-209957@lists.php.net to get a copy of this message | ||
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@ear.ie]
Enviada: quinta-feira, 3 de Março de 2005 12:01
Para: php-general@lists.php.net
Assunto: [PHP] 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