Connecting Tech Pros Worldwide Forums | Help | Site Map

Page Has Expired Message in between the php Page When I click Back in Explorer Menu

John
Guest
 
Posts: n/a
#1: Jul 17 '05
Could anyone please help me on this??

I have a php script page, which is basically quiz. Visitors (after login in
with their email address) are supposed to answer each question, and when
they click the button at the bottom, the next page will show which problems
they got right or wrong.

Now my visitors, after seeing some problems they got wrong, click Back
button at the Explorer menu, and if they do, they get the below message:
================================================== ==========================
========================
Warning: Page has Expired The page you requested was created using
information you submitted in a form. This page is no longer available. As a
security precaution, Internet Explorer does not automatically resubmit your
information for you.

To resubmit your information and view this Web page, click the Refresh
button.
================================================== ==========================
========================
Below are the script that I am using. This scripts are after initial login
page, which asks for visitor's email address. I have authorized visitors
already in my MySQL table, and only the visitors whose email address is in
my MySQL table are allowed to login.
================================================== =======================
<?php
session_start();

define('HOST', 'mysql');
define('USER', 'byung');
define('PASS', 'xiclcvjq');
define('DB', 'Learning');

if (empty($HTTP_SESSION_VARS['emailadd']))
{
mysql_connect(HOST, USER, PASS);
mysql_select_db(DB);
$result = mysql_query("SELECT COUNT(*) AS numfound FROM emailAddress WHERE
emailaddress='{$HTTP_POST_VARS['emailadd']}'") or die(mysql_error());

$result_ar=mysql_fetch_array($result);
if ($result_ar['numfound']<1)
{
header('Location: jinuform.php?error=1');
exit;
}

$emailadd=$HTTP_POST_VARS['emailadd'];
session_register('emailadd');
$insert = mysql_query("INSERT INTO StuAccess (emailaddress, IssueNo)
VALUES ('{$HTTP_POST_VARS['emailadd']}', 1)") or die(mysql_error());
}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>
<title>Jinu Math Study Guide</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<div align="center">
<table width="745" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width = "200">&nbsp;</td>
<td width = "545">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>

<td>>&nbsp;</td>

</tr>
<tr>
<td height="459">&nbsp;</td>
<td><form name="form1" method="post" action="grade.php">
<table width="545" border="1" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center">Today's Exercise</div></td>
</tr>
<tr>
<td bgcolor="#E0E0E0"><strong><font color="#0000A0">Q<font
size="1">UESTION
</font>1</font></strong></td>
</tr>
<tr>
<td><p>What is the length of l times w?</p>
<input type="radio" name="Q1" value="1">
<input type="radio" name="Q1" value="2">
<input type="radio" name="Q1" value="3">
<input type="radio" name="Q1" value="4"><br>
</td>
</tr>
<tr>
================================================== =======================
What above codes do is getting the email address from the login page (from
the previous page), and then allow login only if the visitors' email address
they typed in is in my MySQL database.

Below are the codes, which process the quiz form:

<?php

define('HOST', 'mysql');
define('USER', 'byung');
define('PASS', 'xiclcvjq');
define('DB', 'JinuAcademy');
mysql_connect(HOST, USER, PASS);
mysql_select_db(DB);

$q1 = $HTTP_POST_VARS['Q1'];
$q2 = $HTTP_POST_VARS['Q2'];
$q3 = $HTTP_POST_VARS['Q3'];
$q4 = $HTTP_POST_VARS['Q4'];
$q5 = $HTTP_POST_VARS['Q5'];
$q6 = $HTTP_POST_VARS['Q6'];
$q7 = $HTTP_POST_VARS['Q7'];

if ($q1 == '' || $q2 == '' || $q3 == '' || $q4 =='' || $q5 == '' || $q6 ==
'' || $q7 == '')
{
echo '<h1>Sorry!! You need to fill in your answer for all
questions</h1>';
}
else
{
$score = 0;
if ($q1 == 1)
{
$score++;
$q1Grade = "Correct";
echo '<B>1. Correct!!</B><p>';
}
else
{
$q1Grade = "Incorrect";
echo '<B>1. Incorrect..</B><p>';
}

if ($q2 == 1)
{
$score++;

.....

Now above codes present how the visitor did in the Quiz. But from this
page, if the visitor click the Back button, then they get the error message
above. How would I be able to make my visitor to go back to the previous
page with answers they have clicked in showing up again rather than getting
page expired message??

Any help or comment will be deeply appreciated.

Thanks.




Jochen Daum
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Page Has Expired Message in between the php Page When I click Back in Explorer Menu


Hi John,

On Thu, 22 Apr 2004 05:10:35 GMT, "John" <provicon@earthlink.net>
wrote:
[color=blue]
>Could anyone please help me on this??
>
>I have a php script page, which is basically quiz. Visitors (after login in
>with their email address) are supposed to answer each question, and when
>they click the button at the bottom, the next page will show which problems
>they got right or wrong.
>
>Now my visitors, after seeing some problems they got wrong, click Back
>button at the Explorer menu, and if they do, they get the below message:[/color]

(..)[color=blue]
>Warning: Page has Expired[/color]
(...)
[color=blue]
>Now above codes present how the visitor did in the Quiz. But from this
>page, if the visitor click the Back button, then they get the error message
>above. How would I be able to make my visitor to go back to the previous
>page with answers they have clicked in showing up again rather than getting
>page expired message??[/color]

Redirect all POST request to a GET request (use header() ) by saving
the POST variables to a SESSION file and then reading it from the
SESSION file when you're on the GET request.

This way there is no page shpwing in the browser which has a POST
request, ergo no message because of a POST request.

HTH, Jochen
--
Jochen Daum - Cabletalk Group Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
snoopy
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Page Has Expired Message in between the php Page When I click Back in Explorer Menu


Thank you so much for help, Jochen.

But would you explain in a bit more detailed way please??

Do you want me to use GET rather than POST??

I don't know what you mean by
[color=blue]
>(use header() ) by saving
> the POST variables to a SESSION file and then reading it from the
> SESSION file when you're on the GET request.[/color]

I am pretty new to php, and if you don't mind, would you write me a sample
codes please??

I am specially not understanding how I can use header() and use GET request
from SESSION file.

Thanks.

John

"Jochen Daum" <jochen.daum@cabletalk.co.nz> wrote in message
news:pqke801ao6sk19bev38mjg68af4n7t0adp@4ax.com...[color=blue]
> Hi John,
>
> On Thu, 22 Apr 2004 05:10:35 GMT, "John" <provicon@earthlink.net>
> wrote:
>[color=green]
> >Could anyone please help me on this??
> >
> >I have a php script page, which is basically quiz. Visitors (after login[/color][/color]
in[color=blue][color=green]
> >with their email address) are supposed to answer each question, and when
> >they click the button at the bottom, the next page will show which[/color][/color]
problems[color=blue][color=green]
> >they got right or wrong.
> >
> >Now my visitors, after seeing some problems they got wrong, click Back
> >button at the Explorer menu, and if they do, they get the below message:[/color]
>
> (..)[color=green]
> >Warning: Page has Expired[/color]
> (...)
>[color=green]
> >Now above codes present how the visitor did in the Quiz. But from this
> >page, if the visitor click the Back button, then they get the error[/color][/color]
message[color=blue][color=green]
> >above. How would I be able to make my visitor to go back to the previous
> >page with answers they have clicked in showing up again rather than[/color][/color]
getting[color=blue][color=green]
> >page expired message??[/color]
>
> Redirect all POST request to a GET request (use header() ) by saving
> the POST variables to a SESSION file and then reading it from the
> SESSION file when you're on the GET request.
>
> This way there is no page shpwing in the browser which has a POST
> request, ergo no message because of a POST request.
>
> HTH, Jochen
> --
> Jochen Daum - Cabletalk Group Ltd.
> PHP DB Edit Toolkit -- PHP scripts for building
> database editing interfaces.
> http://sourceforge.net/projects/phpdbedittk/[/color]


Žed Eye Media - Richard Grove
Guest
 
Posts: n/a
#4: Jul 17 '05

re: Page Has Expired Message in between the php Page When I click Back in Explorer Menu


Script or not, you cant change a users browser settings.
RG


Kevin Thorpe
Guest
 
Posts: n/a
#5: Jul 17 '05

re: Page Has Expired Message in between the php Page When I click Back in Explorer Menu


> I am pretty new to php, and if you don't mind, would you write me a sample[color=blue]
> codes please??
>
> I am specially not understanding how I can use header() and use GET request
> from SESSION file.[/color]

Have the following scripts:
page1.php
answer1.php
page2.php
answer2.php

page1.php has the first page of questions and POSTs the answers to
answer1.php.

answer1.php saves the answers from page 1 in a session variable and
issues header('Location: page2.php');

page2.php displays the second page of questions.... and so on.

The browser cache will only have page1.php and page2.php, not the
intermediate answer1.php with posted data and you'll not get the
'expired page' error.
Closed Thread