Page 1 of 1

view source causing problems

Posted: Fri Nov 02, 2007 7:13 pm
by fredley
I have made a test program, with a check to ensure people can't get 90% of the way through, and then refresh knowing all the answers and start again.

At the start of my page is a check for a posted variable (from the previous page where options for the test are submitted). If this variable isn't posted, the page redirects. Once all the checks have been passed, the script inserts a row into my database with score=0 and a unique test id. A test is then taken in a flash file embedded on that page, to which the appropriate variables have been passed. At the end of the test the flash file updates the row in the database by calling on another php file (with more checks to ensure it is the flash file calling it). However, if I view the source of the page, all the checks are bypassed and a new row is inserted every time I do this. Is there any way for php to check if the source of a page is being viewed?

Posted: Fri Nov 02, 2007 7:41 pm
by Kieran Huggins
nope - the browser doesn't send that info to the server.

Posted: Fri Nov 02, 2007 7:42 pm
by fredley
Any other kind of work-around you can think of? This one's got me stumped.

Posted: Fri Nov 02, 2007 7:59 pm
by Kieran Huggins
You could track the questions in a session. That way you know which ones have been answered already.

Saving them to the database as they're answered (and tying them to the user) prevents them from taking the test again.