LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-17-2004, 10:15 AM   #1
devansh
LQ Newbie
 
Registered: Sep 2004
Posts: 11

Rep: Reputation: 0
PHP : ONline quiz problem


Hi,
I got a doubt in PHP.
I am preparing an online quiz . In this quiz questions will be served to user one by one . Questions are stored in database, and each time when PHP script runs a random number is generated and question corresponding to that index is served to user.
Suppose user is to be served with 10 questions. He attempted first question, and now he is attempting second one, now when user is attempting second question i don't want the user to get back on previous page by pressing back button, means i don't want the user to see that question which he has already attempted again, by pressing BACK button. Suppose if user presses BACK button, then the previous page which may be stored in cache should not be displayed , instead of that if user presses BACK button then some error message should be displayed , like "THIS PAGE HAS BEEN EXPIRED , PLEASE PRESS FORWARD BUTTON TO CONTINUE THE QUIZ".
Could anyone tell me how can i implement this thing ?
I will prefer the the solution with some code segment.
I think i am able to explain my question clearly , in case i am not, then plz ask........


My EmailID = devanshmittal163@yahoo.co.in
 
Old 09-17-2004, 10:57 AM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
read setion 14.21 of this it tells you all about the expires header if you set it to zero then hopefully the page shouldnt be cached and each access including back should cause a reload. you can do this with the header() command, if your unfamiliar look it up on php.net its quite simple

ok, now what you need is to use session variables to store the question the player is supposed to be answering then whenever the page is reloaded display the current question.

just incase the the player is tricky, eg downloading the question page before answering/etc... dont let him submit answers you already have in your session variables.

i think ive explined it well enough but if you like code then here it is again in psuedo-code

Code:
send_header(expires immediatly)

if(current_question_submitted) {
    current_question=next_question
}

display_current_question()
 
Old 09-20-2004, 03:27 AM   #3
devansh
LQ Newbie
 
Registered: Sep 2004
Posts: 11

Original Poster
Rep: Reputation: 0
I did'nt get your reply
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
php books online free emailssent Programming 1 10-16-2005 02:03 PM
Best online PHP resource....for little/no cost... bd1308 Programming 1 09-01-2005 01:41 AM
PHP : Online quiz cache control and page expiration devansh LQ Suggestions & Feedback 1 09-17-2004 01:37 PM
New Quiz? neilcpp LQ Suggestions & Feedback 9 03-08-2004 09:51 PM
Problem with C intro quiz WindowsBurner Linux - General 1 11-29-2003 08:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration