WillyJimmyDev / simple-quiz

A simple quiz administration written in PHP with a MySQL backend. Uses Bootstrap 3 and Slim PHP micro framework
http://elanman.com/simple-quiz/
Apache License 2.0
165 stars 73 forks source link

More correct answers than questions in total #4

Closed filipblaauw closed 10 years ago

filipblaauw commented 10 years ago

I have tested the quiz for some time, and have spotted a bug. It's possible to get more correct answers than number of questions. Take a look here:

http://mm1.aftenbladet.no/tools/quiz/public/quiz/5

Some have over 20 correct answers, even if the quiz only have 20 questions. How can this be?

WillyJimmyDev commented 10 years ago

Hi Filip, can you confirm the version of simple-quiz that you're using please?

filipblaauw commented 10 years ago

I see that the readme-file is created december 11th, 2013. I'll try with the latest version.

filipblaauw commented 10 years ago

Found the bug: if you hit "back" while answering questions, and answer same question twice, the score is getting higher.

Example of quiz with 2 questions: you can hit back after answering question 1. Answer correct on both questions again, will result in a score of 3 of 2.

WillyJimmyDev commented 10 years ago

Thanks for finding the bug Filip. I'll take a look at fixing it this evening.

WillyJimmyDev commented 10 years ago

Hi FIlip, I'm having trouble recreating the bug. Are you sure that you are using the latest code and have ran 'composer install'? Also try 'composer install --no-dev'. This sounds like a really old bug that was fixed a while ago...

filipblaauw commented 10 years ago

Hi Ben, I'll try the latest version once more. But I'm trying to understand what to do when you say run composer update. Which command executes this?

2014-09-22 21:53 GMT+02:00 Ben Hall notifications@github.com:

Hi FIlip, I'm having trouble recreating the bug. Are you sure that you are using the latest code and have ran 'composer install'? Also try 'composer install --no-dev'. This sounds like a really old bug that was fixed a while ago...

— Reply to this email directly or view it on GitHub https://github.com/ElanMan/simple-quiz/issues/4#issuecomment-56430585.

filipblaauw commented 10 years ago

This is from the latest version from Sourceforge, and as you can see, I click back on question 1 and keep answering again and again. The score is 200%

2014-09-23 9:39 GMT+02:00 Filip Blaauw filipbl@gmail.com:

Hi Ben, I'll try the latest version once more. But I'm trying to understand what to do when you say run composer update. Which command executes this?

2014-09-22 21:53 GMT+02:00 Ben Hall notifications@github.com:

Hi FIlip, I'm having trouble recreating the bug. Are you sure that you are using the latest code and have ran 'composer install'? Also try 'composer install --no-dev'. This sounds like a really old bug that was fixed a while ago...

— Reply to this email directly or view it on GitHub https://github.com/ElanMan/simple-quiz/issues/4#issuecomment-56430585.

filipblaauw commented 10 years ago

Hi again, sorry for the repeated replies, but I figured out that the bug does not appear in Google Chrome or Firefox, but in Safari. In Chrome, it works fine as it won't let you answer the same question twice.

I haven't been able to test this in IE or any Windows browsers. So the bug are found in Safari both on desktop and mobile (iOS).

Hope that clarify the issue. Would love if you could be able to fix this, as the app is superb and easy to use!

Filip

2014-09-23 9:49 GMT+02:00 Filip Blaauw filipbl@gmail.com:

This is from the latest version from Sourceforge, and as you can see, I click back on question 1 and keep answering again and again. The score is 200%

2014-09-23 9:39 GMT+02:00 Filip Blaauw filipbl@gmail.com:

Hi Ben, I'll try the latest version once more. But I'm trying to understand what to do when you say run composer update. Which command executes this?

2014-09-22 21:53 GMT+02:00 Ben Hall notifications@github.com:

Hi FIlip, I'm having trouble recreating the bug. Are you sure that you are using the latest code and have ran 'composer install'? Also try 'composer install --no-dev'. This sounds like a really old bug that was fixed a while ago...

— Reply to this email directly or view it on GitHub https://github.com/ElanMan/simple-quiz/issues/4#issuecomment-56430585.

WillyJimmyDev commented 10 years ago

Hi Filip, I've tried IE 11 in a virtual machine. It seems to have the same problems as Safari. The bug clearly needs fixing asap. I'll keep you updated.

Thanks again.

WillyJimmyDev commented 10 years ago

Hi Filip,

The problem was that Safari and IE reloaded a cached version of the previous page when the back button was used. I've implemented a simple nonce that is generated and stored in the form and in the session. Cached page submissions will fail comparison against the session nonce. The user can go back to the previous question and resubmit but their score will never increase. You can check out the latest commit a0cc243 or download the latest release (1.8.2) from github or Sourceforge.

Thanks for spotting the bug :)

filipblaauw commented 10 years ago

That was a quick fix, I'll check out the latest release

Den 24. sep. 2014 kl. 00.02 skrev Ben Hall notifications@github.com:

Hi Filip,

The problem was that Safari and IE reloaded a cached version of the previous page when the back button was used. I've implemented a simple nonce that is generated and stored in the form and in the session. Cached page submissions will fail comparison against the session nonce. The user can go back to the previous question and resubmit but their score will never increase. You can check out the latest commit a0cc243 or download the latest release (1.8.2) from github or Sourceforge.

Thanks for spotting the bug :)

— Reply to this email directly or view it on GitHub.

filipblaauw commented 10 years ago

This resulted in that I'm stuck at question 1. After hitting Submit answer, it reloads the first question. Tested in Safari and Chrome after version 1.8.2 and deleting buffer/cache.

WillyJimmyDev commented 10 years ago

Filip, can you go to quiz.elanman.com and see if you have the same problem? It's using older code but has the nonce implemented. Thanks. On 24 Sep 2014 10:02, "Filip Blaauw" notifications@github.com wrote:

This resulted in that I'm stuck at question 1. After hitting Submit answer, it reloads the first question. Tested in Safari and Chrome after version 1.8.2 and deleting buffer/cache.

— Reply to this email directly or view it on GitHub https://github.com/ElanMan/simple-quiz/issues/4#issuecomment-56643135.

filipblaauw commented 10 years ago

It works fine at your demo site.

WillyJimmyDev commented 10 years ago

I've missed adding the hidden input 'nonce' into the form at templates/quiz/test.php. I'll push the change tonight. On 24 Sep 2014 13:23, "Filip Blaauw" notifications@github.com wrote:

It works fine at your demo site.

— Reply to this email directly or view it on GitHub https://github.com/ElanMan/simple-quiz/issues/4#issuecomment-56661572.

WillyJimmyDev commented 10 years ago

Hi Filip,

I've fixed the issue and edited the latest release both on Github and SourceForge. Let me know if you still have problems.

Thanks,

Ben