public static function savedata($id, $form) { $mainframe = JFactory::getApplication(); $input_get = JFactory::getApplication()->input; $all_files = array(); $correct = false; $db = JFactory::getDBO(); @session_start(); $captcha_input = $input_get->getString("captcha_input"); $recaptcha_response_field = $input_get->getString("recaptcha_response_field"); $counter = $input_get->getString("counter" . $id); if (isset($counter)) { if (isset($captcha_input)) { $session_wd_captcha_code = isset($_SESSION[$id . '_wd_captcha_code']) ? $_SESSION[$id . '_wd_captcha_code'] : '-'; if ($captcha_input == $session_wd_captcha_code) { $correct = true; } else { echo "<script> alert('" . JText::_('WDF_INCORRECT_SEC_CODE') . "');\n\t\t\t\t\t\t</script>"; } } else { if (isset($recaptcha_response_field)) { $privatekey = $form->private_key; $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $recaptcha_response_field); if ($resp->is_valid) { $correct = true; } else { echo "<script> alert('" . JText::_('WDF_INCORRECT_SEC_CODE') . "');\n\t\t\t\t\t\t\t</script>"; } } else { $correct = true; } } if ($correct) { $ip = $_SERVER['REMOTE_ADDR']; $db->setQuery("SELECT ip FROM #__formmaker_blocked WHERE ip LIKE '%" . $ip . "%'"); $db->query(); $blocked_ip = $db->loadResult(); if ($blocked_ip) { $mainframe->redirect($_SERVER["REQUEST_URI"], addslashes(JText::_('WDF_BLOCKED_IP'))); } $result_temp = modFormmaker::save_db($counter, $id); $all_files = $result_temp[0]; if (is_numeric($all_files)) { modFormmaker::remove($all_files); } else { if (isset($counter)) { modFormmaker::gen_mail($counter, $all_files, $result_temp[1], $id); } } } return $all_files; } return $all_files; }