?
Solved

session problem....

Posted on 2003-03-19
5
Medium Priority
?
237 Views
Last Modified: 2008-02-20
Hi i am back with a new problem...

first.php
displays some question from question table in database....

second....
calculates result and send it to next page where to show result......

third....
before displaying result some updation in database like test passed

fourth....
result display.......

i am using session on my whole site.....
and instead of getting values from database, to make site faster i am updating sesson values and put them in databse also....

problem is...on fourth page after displaying result....
when customer clicks back button third page runs and create problem in database.....

ay solution...
0
Comment
Question by:carchitect
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 15

Expert Comment

by:VGR
ID: 8165387
either do like some sites I've seen : write in big red "do not press "back" ! " ;-)

or arrange your queries to prevent the problem from occuring, with a REPLACE for instance - I don't know, your message lacks some details about "the problem [created]" ;-)
0
 
LVL 2

Accepted Solution

by:
foreverfresh earned 150 total points
ID: 8165463
check session varable in 3. page if found and same in database you can redirect to 4. page
like

<?

if(strlen($sid))
{
  // check database if found
 header( "Location: page4.php" );
}
else
{
// 3.Page content
}
0
 

Expert Comment

by:wickedbob
ID: 8165474
Try using javascript to eliminate back button reloading:

<SCRIPT LANGUAGE="JavaScript"><!--
if (document.images)
    location.replace("http://www.somewhere.com/new_page.html");
else
    location.href = "new_page.html";
//--></SCRIPT>

If you need to pass variables to your results page, echo the javascript in PHP and insert them in the url.
NB: In Opera location.replace() will work but only with absolute urls.
0
 
LVL 6

Author Comment

by:carchitect
ID: 8165767
solved by self
what i did is created a new variable on page 1 with value 0 , on reaching page made it 1,and when on page checked if it is 0 then execute other wise not....
regards
0
 

Expert Comment

by:smerz
ID: 8167806
the at least say its solved so its not listed anymore in the list of unanswered questions

by the way foreverfresh's suggestion would have done it too :)

regards smerz
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question