Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Access to results database via PHP

More
9 years 4 months ago #114048 by Mixer
Access to results database via PHP was created by Mixer
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
Code:
$( "input[aria-describedby="displaytokens_token"][id="1"][.class="ui-widget-content jqgrow ui-row-ltr"]" ).val()

Best regards & thanks in advance,
Mixer
The topic has been locked.
More
9 years 4 months ago #114050 by Ben_V
Replied by Ben_V on 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
The topic has been locked.
More
9 years 4 months ago #114052 by Mixer
Replied by Mixer on 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].
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 4 months ago #114058 by DenisChenu
Replied by DenisChenu on 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 , plugin development .
I don't answer to private message.
The following user(s) said Thank You: Mixer
The topic has been locked.
More
9 years 4 months ago #114060 by Mixer
Replied by Mixer on 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.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 4 months ago #114062 by DenisChenu
Replied by DenisChenu on 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 , plugin development .
I don't answer to private message.
The following user(s) said Thank You: Mixer
The topic has been locked.
More
9 years 4 months ago #114065 by Mixer
Replied by Mixer on 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.
The topic has been locked.
More
9 years 3 months ago #114872 by Mixer
Replied by Mixer on 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.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose