예제 #1
0
 /**
  * Storing/Modifying Duplicate IP Filter of a survey
  * @param SurveyFilterController $surveyFilter
  * @return bool
  */
 public function storeDuplicateIPFilter(SurveyFilterController $surveyFilter)
 {
     $opResult = false;
     //Auto commit is off now
     $this->con->autocommit(false);
     $this->con->begin_transaction();
     //Check if Country IP Filter already exists or not
     $duplicateIPFilterExists = $this->con->query("select * from survey_filters where filter_type = '" . $surveyFilter::FILTER_DUPLICATE_IP . "' and survey_id=" . $surveyFilter->surveyId);
     //If Country Filter exists, then delete that filter.
     if ($duplicateIPFilterExists->num_rows > 0) {
         $opResult = $this->con->query("update survey_filters set duplicate_ip_limit=" . $surveyFilter->getDuplicateIPFilterLimit() . " where survey_id=" . $surveyFilter->surveyId . " and filter_type='" . $surveyFilter::FILTER_DUPLICATE_IP . "'");
     } else {
         //Saving Filter data in the table
         $opResult = $this->con->query("insert into survey_filters values ('',{$surveyFilter->surveyId},'" . $surveyFilter::FILTER_DUPLICATE_IP . "'," . $surveyFilter->getDuplicateIPFilterLimit() . ")");
     }
     if ($opResult) {
         //            $opResult=true;
         $this->con->commit();
     } else {
         //            $opResult = false;
         $this->con->rollback();
     }
     $this->con->autocommit(true);
     return $opResult;
 }
예제 #2
0
     $modify_survey->survey_allow_traffic = 1;
 } else {
     $modify_survey->survey_allow_traffic = 0;
 }
 if (isset($_POST["m_single_link"]) && $_POST["m_single_link"] != 'N/A') {
     $modify_survey->survey_single_link = $_POST["m_single_link"];
 } else {
     $modify_survey->survey_single_link = 'N/A';
 }
 $modify_survey->survey_manager_id = $survey_data["survey_manager"];
 $validated = $modify_survey->validate_Form_Data_Modify_Survey();
 if ($validated == "NO_ERROR") {
     $modify_result = $modify_survey->modify_Survey_Details($_POST["survey_id"]);
     if ($modify_result && substr($modify_result, 0, 3) != "ERR") {
         //Adding Survey Filters in the survey.
         $surveyFilters = new SurveyFilterController($modify_survey->survey_id, isset($_POST["country_filter"]), isset($_POST["duplicate_ip"]));
         $resultCountryFilter = $surveyFilters->storeCountryFilter($_POST);
         $resultDuplicateIP = $surveyFilters->storeDuplicateIPFilter($_POST);
         //If any error while saving country IP filter
         if ($resultCountryFilter["country_filter_applied"] && !$resultCountryFilter["result"]) {
             header("Location: " . VIEW_PATH . "modify_survey_details.php?survey_id=" . $_POST["survey_id"] . "&survey_modify_result=sucess&country_ip_filter_error=" . $resultCountryFilter["validation_error"]);
             exit;
         } else {
             if ($resultDuplicateIP["duplicate_ip_filter_applied"] && !$resultDuplicateIP["result"]) {
                 header("Location: " . VIEW_PATH . "modify_survey_details.php?survey_id=" . $_POST["survey_id"] . "&survey_modify_result=sucess&duplicate_ip_filter_error=" . $resultDuplicateIP["validation_error"]);
                 exit;
             }
         }
         //If country IP and Duplicate IP filters are saved successfully, or if no country IP and Duplicate IP filters are applied.
         header("Location: " . VIEW_PATH . "modify_survey_details.php?survey_id=" . $_POST["survey_id"] . "&survey_modify_result=sucess");
         exit;