| Server IP : 103.161.17.216 / Your IP : 216.73.216.1 Web Server : nginx/1.18.0 System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/app.houseland.info/modules/surveys/controllers/ |
Upload File : |
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Participate extends ClientsController
{
public function index($id, $hash)
{
$this->load->model('surveys_model');
$survey = $this->surveys_model->get($id);
// Last statement is for
if (!$survey
|| ($survey->hash != $hash)
|| (!$hash || !$id)
// Users with permission manage surveys to preview the survey even if is not active
|| ($survey->active == 0 && staff_cant('view', 'surveys'))
) {
show_404();
}
// Ip Restrict Check
if ($survey->iprestrict == 1) {
$this->db->where('surveyid', $id);
$this->db->where('ip', $this->input->ip_address());
$total = $this->db->count_all_results(db_prefix() . 'surveyresultsets');
if ($total > 0) {
show_404();
}
}
// Check if survey is only for logged in participants / staff / clients
if ($survey->onlyforloggedin == 1 && !is_logged_in()) {
redirect_after_login_to_current_url();
redirect(site_url('login'));
}
if ($this->input->post()) {
$success = $this->surveys_model->add_survey_result($id, $this->input->post());
if ($success) {
$survey = $this->surveys_model->get($id);
if ($survey->redirect_url !== '') {
redirect($survey->redirect_url);
}
// Message is by default in English because there is no easy way to know the customer language
set_alert('success', hooks()->apply_filters('survey_success_message', 'Thank you for participating in this survey. Your answers are very important to us.'));
redirect(hooks()->apply_filters('survey_default_redirect', site_url('surveys/survey/' . $id . '/' . $hash . '?participated=yes')));
}
}
$this->app_css->theme('surveys-css', module_dir_url('surveys', 'assets/css/surveys.css'));
$this->disableNavigation()
->disableSubMenu();
$this->data(['survey' => $survey]);
$this->title($survey->subject);
no_index_customers_area();
$this->view('participate');
$this->layout();
}
}