Jump to content

Need help with simple script


$Three3

Recommended Posts

Hi, I have a small problem with a site I am creating. I have made an online school site for a client that allows a student to take their test online and once they are done taking the "Math" test for example, it will show them the numbers they have missed and the numbers they have correctly answered. My concern is that if they click the back button, the test is still available and the radio buttons are still selected from the first time they took the test. Is there anyway for me to give them an error when they try to access the page again? Something like, "This page has expired". Thanks a lot in advance for the help.

Link to comment
Share on other sites

you could use a session to hold a test key then on completion increment the key so that when they go back to the test page the keys wont match up and you can respond accordingly

 

That sounds like something I can definitely try. I currently have it setup like this:

 

//Validate that the user is not accessing this page in error or coming back from completion page
$r = $_SERVER['HTTP_REFERER'] ;
if ($r != 'http://sitename.com/Tests/Tests.php') {
header('Location: http://sitename.com/Home/Home.html') ;
exit() ;
}

 

This code is at the beginning of my script and it validates that the user is coming from the correct page. But this code does not seem to run when the user clicks the back button. So would a session solve this or would it cause the same problem? Thanks a lot for the help.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.