bookmark - How To Create An Online Timed Test With PHP? Can we do a online test with a counter(from 20 second) php for a php-n

How To Create An Online Timed Test With PHP? - Can we do a online test with a counter(from 20 second) php for a php-n

 
 Discussion by thenumberone with 18 Replies.
 Last Update: September 8, 2008, 1:09 pm (View Latest)
Page 1 of 2 pages.
bookmark - How To Create An Online Timed Test With PHP? Can we do a online test with a counter(from 20 second) php for a php-n  
    
free web hosting
 
Is there anyone got a online timed test script?Or anyone knows how to create this script?
I wait your answers and all php programmers.

Wed May 10, 2006    Reply    New Discussion   


QUOTE (thenumberone)


Is there anyone got a online timed test script?Or anyone knows how to create this script?
I wait your answers and all php programmers.

Link: view Post: 77745

Hi, interesting script you propose, i saw sometime ago something like that, but i dont remember if it was in php, i think it not be difficult to develop, so i will do it in my spare time in a few hours.

Best regards,

Thu May 11, 2006    Reply    New Discussion   

You can do it with php and if you want you also could add an javascript real time, so you want to know how it works ? Well, one way is to make it with sessions, say you have 10 pages of questions.. so you start a sessions and set the start time when the user clicks start and always check the value and set the finish time and get the period of the time. Simple maths :D Also, you save the answers in the super global $_SERVER; and check them after the test is done or whatever. There might be different ways to do it, saving to a database or files as temporary data.. I would use sessions, but if the user does not have cookies enabled - he might have some problems.. :P

Thu May 11, 2006    Reply    New Discussion   

QUOTE (Quatrux)


You can do it with php and if you want you also could add an javascript real time, so you want to know how it works ? Well, one way is to make it with sessions, say you have 10 pages of questions.. so you start a sessions and set the start time when the user clicks start and always check the value and set the finish time and get the period of the time. Simple maths :D Also, you save the answers in the super global $_SERVER; and check them after the test is done or whatever. There might be different ways to do it, saving to a database or files as temporary data.. I would use sessions, but if the user does not have cookies enabled - he might have some problems.. :P

Link: view Post: 77869

As I mentioned in database part is there anyone got this script?Is there anyone possible to write this script?
I want to explain my problem again.I made a php-nuke website.I have so many users.My users wanted a online timed(counts from 20 seconds)test(multiple choices).(like who wants to be a millionaire).I made the login and register system.But I have problems in test page stage.Users will be send questions to our database.And admin will control these questions.He will save it to our database or delete it from our database.And users will be race in a day only five times.And also they must be answer the questions in 20 seconds.There will be shown a counter in the question page that counts from 20 second.Also unregistered users can not be reach the test page by anyway.Or if they try this the page must be redirect him to register page.Only registered users can answer these questions.I think it will be possible by Session_start() and session_register and session_destroy codes or by setcookie.I have little time to this because of my university education.But I think you will help me.I search all internet pages but I couldn't find any useful scripts about this online timed test.But I will have more time in the summer holiday.Is it impossible?I think impossible is nothing!Can we put time script by javascript?But how can we connect it with our database?I mean that out of time there will be a page shown that echo like this "Sorry you answered false.Please restart our test...." or answered in 20 seconds "Congratulations.Please click to next question".
Also istatistics of other users must be shown in the page.Also after all true answers the users score must be increase.And after all wrongs the score must be decrease.(I did all of this with Delphi but i can not put it on my website.)
So,I wait your ideas or helps or scripts.
Regards;

Thu May 11, 2006    Reply    New Discussion   


Hi, i just start this project in my spare time i have today, you can see it Here thanks to astahost.com.

It is not finished yet, but for a start is ok. First of all, you must register to access the trivia script, so, when you click in the above link you access the registration process, complete the form and if the data is ok the script will send you your access data to the email you give. This email includes an activation link that you must click to activate your account and after that you can login, if you dont do it you cannot access the trivia script.

The trivia script will present user-defined trivia questions along with choices and determine whether or not the visitor entered the correct answer. Features randomized question and choice order along with 100% templates. All the question, choices and answers are stored in a simple text file.

So, as you can see, this is not the best solution, in the next version i will use a database to store the questions, choices and answers as other information, and also implement the 20 seconds counter.

Best regards,

Fri May 19, 2006    Reply    New Discussion   

Well, my new version is partially finished, i just implement the database because i have a qUestion related with the time counter, tell me, the 20 seconds counter must be for all questions or for each question????

best regards,

Thu May 25, 2006    Reply    New Discussion   

QUOTE (thenumberone)


the 20 seconds counter must be for each questions!

Link: view Post: 79081

Ok, and a test how many question should include???? to be practical i will include only 5 questions for test, and because it will be a test, i will not do any type of validation.

best regards,

Fri May 26, 2006    Reply    New Discussion   

QUOTE (TavoxPeru)


Ok, and a test how many question should include???? to be practical i will include only 5 questions for test, and because it will be a test, i will not do any type of validation.

best regards,

Link: view Post: 79198

How can I get the script from you?
I did what you said but ı can't get.
Regards.

Fri May 26, 2006    Reply    New Discussion   

QUOTE (thenumberone)


How can I get the script from you?
I did what you said but ı can't get.
Regards.

Link: view Post: 79199

Yes, sorry for that, right now i'm very busy with a lot of work and in a few hours i will try to upload a new version with some changes. Well, i just upload the new version, it works but i have some trouble with date's checking, also im not finished yet the 20s time counter, i think im in the correct way.

When i finish i will post all the code.

best regards,

Sun May 28, 2006    Reply    New Discussion   

QUOTE (TavoxPeru)


Yes, sorry for that, right now i'm very busy with a lot of work and in a few hours i will try to upload a new version with some changes. Well, i just upload the new version, it works but i have some trouble with date's checking, also im not finished yet the 20s time counter, i think im in the correct way.

When i finish i will post all the code.

best regards,

Link: view Post: 79363

Thank u very much for your interestings about my question.

Mon May 29, 2006    Reply    New Discussion   

QUOTE (thenumberone)


Thank u very much for your interestings about my question.

Link: view Post: 79469

You're welcome, BTW after a few days without coding -too much work :-)- i just correct the trouble with the dates checking and will continue with the rest of the problem. So, i hope that i will finish it this weekend.

best regards,

Sat Jun 3, 2006    Reply    New Discussion   

Well, after some days i return to this script -i'm very busy with a lot of work- so, i just upload the new version, it works but i have some trouble with the 20s time counter, the problem is that the form.submit() function doesnt work when the time is over.

Here's the problematic code:

CODE

$formoutput = "<form name=\"form\" method=\"POST\" action=\"".$_SERVER["PHP_SELF"]."\"><input type=\"hidden\" name=\"question\" value=\"" . $TheQuestion . "\">";
$formoutput .=
"Time Left: <input type=\"text\" name=\"seconds\" size=\"3\"><br /><br />\n" .
"<script type=\"text/javascript\">\n" .
"var myTime = 20;\n" .
"function countDown() { \n" .
"\tdocument.form.seconds.value = myTime; \n" .
"\tif (myTime == 0) { \n" .
"\t\t// http://www.gigasoft.astahost.com/trivia/trivia.php;\n" .
"\t\t//clearTimeout(timer1);\n" .
"\t\t//document.form.submit()\n" .
"\t\tlocation.href ='" . $_SERVER["PHP_SELF"]. "';\n" .
"\t}\n" .
"\telse if (myTime > 0) { \n" .
"\t\tmyTime--; \n" .
"\t\tsetTimeout(\"countDown()\",1000); \n" .
"\t}\n" .
"}\n\n" .
"countDown();\n" .
"</script>";
$formoutput .= $choiceoutput;
$formoutput .= "<br><input type=\"submit\" value=\"Answer\" name=\"submit\"></form>";


Best regards,

Thu Jun 15, 2006    Reply    New Discussion   

I saw this question in the PHP section and though the first answer should be no you can not use PHP to create a timed event for such a script. PHP is server side and only reacts when the server is accessed. The browser (client side is always open) so the only way to write a time dependant script would be with JavaScript. So technically you can not create a PHP script for something like a clock or a counter that counts down. That would be best achieved by using JaavaScript or JScript.

Of course you can user PHP to manage the database or flat file to store questions and things like that but using PHP alone will not do the job.

Thu Jun 15, 2006    Reply    New Discussion   

So your trivia questionsmust be answered within 20 sec.

At page YY:
Ask question + register start time
-Make sure a JS refreshes after 20 sec to page XX.
-And make sure answers are posted to page XX.

Page XX checks for an correct answer AND checks if the registered start time in php is within the 20 sec (JS can be easily disabled and needs double checking)

Fri Jun 16, 2006    Reply    New Discussion   

QUOTE (MS2)


So your trivia questionsmust be answered within 20 sec.

At page YY:
Ask question + register start time
-Make sure a JS refreshes after 20 sec to page XX.
-And make sure answers are posted to page XX.

Page XX checks for an correct answer AND checks if the registered start time in php is within the 20 sec (JS can be easily disabled and needs double checking)

Link: view Post: 80854

Thanks, i do something like that with no goods results in the timer, so i follow your advice and redirect to XX page and THAT'S IT :( .

I will post all the code tomorrow.

CLICK HERE TO PLAY TRIVIA

Best regards,

Sun Jun 18, 2006    Reply    New Discussion   

Quickly Post to How To Create An Online Timed Test With PHP? Can we do a online test with a counter(from 20 second) php for a php-n w/o signup Share Info about How To Create An Online Timed Test With PHP? Can we do a online test with a counter(from 20 second) php for a php-n using Facebook, Twitter etc. email your friend about How To Create An Online Timed Test With PHP? Can we do a online test with a counter(from 20 second) php for a php-n Print
Reply / Comment Ask a Question? Share / Bookmark E-Mail a Friend Print


Need Help: PHP Security - Login Script For Site security  Need Help: PHP Security - Login Script For Site security (8) (4) Is EAccelerator A PHP Accelerator ?   Is EAccelerator A PHP Accelerator ?