Access to results database via PHP

More
3 years 1 month ago #114048 by Mixer
Mixer created the topic: Access to results database via PHP
Hello limesurvey-team, hello everybody,

I am trying to create a survey in which different participants must log in with their accounts several times over the period of 1 month and answer the same questions.

My problem is, when I hand passwords out and the participants log in, all answers are overriden.

To solve this I need access to the response database/participants database, so I am able to make my own access control via Javascript while making the survey anonymous (thus no answers are overriden).

What are the php parameters for accessing the token and the already filled answers?
Right now I am trying to get the data via
$( "input[aria-describedby="displaytokens_token"][id="1"][.class="ui-widget-content jqgrow ui-row-ltr"]" ).val()

Best regards & thanks in advance,
Mixer

Please Log in to join the conversation.

More
3 years 1 month ago #114050 by Ben_V
Ben_V replied the topic: Access to results database via PHP
:unsure: Sounds like "Allow multiple responses or update responses with one token" ...
Please read carefully the token section in the doc.

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The following user(s) said Thank You: Mixer

Please Log in to join the conversation.

More
3 years 1 month ago #114052 by Mixer
Mixer replied the topic: Access to results database via PHP
Hello Ben,

thanks for the fast reply.
That is true, token is possible, but I still need to access the database because I need to count how often a participant already finished the survey and compare it to a [maximum times of participation value].

Please Log in to join the conversation.

More
3 years 1 month ago #114058 by DenisChenu
DenisChenu replied the topic: Access to results database via PHP
And why not use Use left attribute ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
The following user(s) said Thank You: Mixer

Please Log in to join the conversation.

More
3 years 1 month ago #114060 by Mixer
Mixer replied the topic: Access to results database via PHP
Because the "Uses left" attribute will diminish by 1, even if the survey was not completed (afaik) and the participants will only be able to finish the survey when both conditions are met:

1. Last time filled out >= 24 hours (first thing to pass through database).
2. "Uses left" >= 0

If first condition is checked "Uses left" will dimish even if it is less than 24 hours.

Please Log in to join the conversation.

More
3 years 1 month ago #114062 by DenisChenu
DenisChenu replied the topic: Access to results database via PHP
OK,

Uses left is decremented only when survey is submitted.

But here, i think you can use manual.limesurvey.org/BeforeSurveyPage and
- reload the good survey (reload the survey started this day but not completed)
- Throw an error is the last time is completed is less than one day.

To reload the survey (or test if token is completed for today), some example here: github.com/Shnoulle/LS-fixMaxStep/blob/master/fixMaxStep.php

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
The following user(s) said Thank You: Mixer

Please Log in to join the conversation.

More
3 years 1 month ago #114065 by Mixer
Mixer replied the topic: Access to results database via PHP
Thank you very much, DenisChenu.
I will give it a try and will report back if everything worked.

Please Log in to join the conversation.

More
3 years 3 weeks ago #114872 by Mixer
Mixer replied the topic: Access to results database via PHP
You were right, uses left is decremented only when survey is submitted.

With the combination of "Uses left"
"Allow multiple responses or update responses with one token?" = True
and "Enable token-based response persistence:" = False
I can allow them several times to answer the survey.

But I dont see in you PHP example the command for [last time filled out], he only fixes the maxstep/uses left (which is not a problem in my case) with on the BeforeSurveyPage.

I just need the name of the [last time filled out] parameter to work with via PHP.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!