show public statics register users limesurvey

More
4 weeks 1 day ago - 4 weeks 1 day ago #175432 by Vanhels
Vanhels created the topic: show public statics register users limesurvey
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.');
}
Last Edit: 4 weeks 1 day ago by Vanhels.

Please Log in or Create an account to join the conversation.

More
4 weeks 6 hours ago - 4 weeks 6 hours ago #175444 by Vanhels
Vanhels replied the topic: show public statics register users limesurvey
I got a solution I share with you.

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: 4 weeks 6 hours ago by Vanhels.

Please Log in or Create an account to join the conversation.

More
4 weeks 3 hours ago #175451 by DenisChenu
DenisChenu replied the topic: show public statics register users limesurvey
And without hacking limesurvey core :

manual.limesurvey.org/BeforeControllerAction

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: Vanhels

Please Log in or Create an account to join the conversation.

More
4 weeks 2 hours ago #175456 by Vanhels
Vanhels replied the 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,

Please Log in or Create an account to join the conversation.

More
4 weeks 1 hour ago #175457 by DenisChenu
DenisChenu replied the 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

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 .

Please Log in or Create an account to join the conversation.

More
4 weeks 18 minutes ago #175459 by tpartner
tpartner replied the topic: show public statics register users limesurvey

All (or near all) my code are public

You da man! :)

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!