- Posts: 5
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
show public statics register users limesurvey
- Vanhels
- Topic Author
- Offline
- New Member
Less
More
5 years 6 months ago - 5 years 6 months ago #175432
by Vanhels
show public statics register users limesurvey was created by Vanhels
How can I obtain the registration of the participant's ip, to validate that only those who responded to the survey can view the public statistics, since anyone with the url can view them, I know yii, php, but I do not see how to return the model in the driver the value of ipaddr.
I got a half solution since I have to manually add in a txt file the ip addresses, some comments my code:
My code:
$whitelist = explode("\n", file_get_contents('/home/domain/subdomain/whitelist.txt'));
if ($surveyinfo != 'Y' || (!in_array($_SERVER, $whitelist))) {
throw new CHttpException(404, 'Las estadisticas para esta Encuesta no son públicas.');
}
I got a half solution since I have to manually add in a txt file the ip addresses, some comments my code:
My code:
$whitelist = explode("\n", file_get_contents('/home/domain/subdomain/whitelist.txt'));
if ($surveyinfo != 'Y' || (!in_array($_SERVER, $whitelist))) {
throw new CHttpException(404, 'Las estadisticas para esta Encuesta no son públicas.');
}
Last edit: 5 years 6 months ago by Vanhels.
The topic has been locked.
- Vanhels
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
5 years 6 months ago - 5 years 6 months ago #175444
by Vanhels
Replied by Vanhels on topic show public statics register users limesurvey
I got a solution I share with you.
In this way, the results of the survey can only be viewed by the participants.
Code:
My Code: /application/controllers/Statistics_userController.php: $whitelist = SurveyDynamic::model($iSurveyID)->findByAttributes(array("ipaddr"=>$_SERVER['REMOTE_ADDR'])); if ($surveyinfo['publicstatistics'] != 'Y' || (!$whitelist)) { throw new CHttpException(404, 'Las estadisticas para esta Encuesta no son públicas.'); }
In this way, the results of the survey can only be viewed by the participants.
Last edit: 5 years 6 months ago by Vanhels.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13637
- Thank you received: 2491
5 years 6 months ago #175451
by DenisChenu
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.
Replied by DenisChenu on topic show public statics register users limesurvey
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: Vanhels
The topic has been locked.
- Vanhels
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
5 years 6 months ago #175456
by Vanhels
Replied by Vanhels on topic show public statics register users limesurvey
I know that there is that function so I asked the question which would be the best way, as an improvement could be offered that the public statistics will be shown by ip or token would be great.
You could show us how to use the BeforeControllerAction in LimeSurvey.
Thank you,
You could show us how to use the BeforeControllerAction in LimeSurvey.
Thank you,
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13637
- Thank you received: 2491
5 years 6 months ago #175457
by DenisChenu
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.
Replied by DenisChenu on topic show public statics register users limesurvey
Example here :
gitlab.com/SondagesPro/ExportAndStats/pd...r/pdfReport.php#L291
All (or near all) my code are public
All (or near all) my code are public
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 topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
5 years 6 months ago #175459
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic show public statics register users limesurvey
You da man!All (or near all) my code are public
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.