You are here: [newbie] How to avoid FFox's "The page you are trying to view..."? « PHP Programming Language « IT news, forums, messages
[newbie] How to avoid FFox's "The page you are trying to view..."?

Posted by Vincent Delporte on 12/10/06 02:23

.... contains POSTDATA. If you resend the data, any action the form
carried out will be repeated"?

I'm only getting started with learning how to use cookies and
sessions to secure a web application, but FireFox keeps showing that
familiar message whenever I hit the page, although I would expect the
form to be only handled by the web client the first time, when the
user logs on:

-----------------------------------
//index.php
<?php

//Already logged on?
if(!isset($HTTP_COOKIE_VARS["PHPSESSID"])){

//First time: Let's check login/passwd
$login = $HTTP_POST_VARS["login"];
$password = $HTTP_POST_VARS["password"];

if(!isset($login) and !isset($password)) {
?>
<form action="<?php echo $PHP_SELF; ?>" method=POST>
Login: <input type="text" name="login"
size="20" value=""><br>
Pass: <input type="password" name="password"
size="10" value=""><br>
<input type="submit" value="OK">
</form>
<?php
} else {
//connect to database, and check login/passwd
//if OK, save PHPSESSID into cookie
session_start();
setcookie("PHPSESSID",session_id());
print "Let's save PHPSESSID";
}
} else {
print "session = ". $PHPSESSID . "<p>";
//Let's read more data from the database
}
?>
-----------------------------------

Am I doing this wrong? I intend this code to be included in every page
of the application so that users can't access any of them without
having been authenticated.

Thank you.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация