$Three3 Posted February 20, 2010 Share Posted February 20, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/192764-need-help-with-simple-script/ Share on other sites More sharing options...
Mchl Posted February 20, 2010 Share Posted February 20, 2010 Just don't accept results more than once from each student. Quote Link to comment https://forums.phpfreaks.com/topic/192764-need-help-with-simple-script/#findComment-1015442 Share on other sites More sharing options...
$Three3 Posted February 21, 2010 Author Share Posted February 21, 2010 Just don't accept results more than once from each student. This would work, but the student is allowed 2 attempts on each test. Is there another way around this? Thanks for the reply Quote Link to comment https://forums.phpfreaks.com/topic/192764-need-help-with-simple-script/#findComment-1015531 Share on other sites More sharing options...
ldb358 Posted February 21, 2010 Share Posted February 21, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/192764-need-help-with-simple-script/#findComment-1015535 Share on other sites More sharing options...
$Three3 Posted February 21, 2010 Author Share Posted February 21, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/192764-need-help-with-simple-script/#findComment-1015537 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.