public static function Extract_Filtered_Request_Get_Post_Vars($filter_____arr, $filter_____info) { // FILTER INPUT VARIABLES v.160122 (with collision fix and private space check) // This no more limits the input variables as it is handled via prior checks to PHP.INI: max_input_vars and max_input_nesting_level // If any of: GET / POST / COOKIE overflow the max_input_vars and max_input_nesting_level a PHP warning is issued !! // The max_input_vars applies separately to each of the input variables, includding array(s) keys // The max_input_nesting_level also must be at least 5 //-- check if can run if (self::$RequestProcessed !== false) { return; // avoid run after it was already processed } //end if //-- //-- if ((string) SMART_FRAMEWORK_DEBUG_MODE == 'yes') { self::DebugRequestLog('######################### FILTER NEW REQUEST:' . "\n" . date('Y-m-d H:i:s O') . "\n" . $_SERVER['REQUEST_URI'] . "\n\n" . '##### RAW REQUEST VARS:' . "\n" . '[' . $filter_____info . ']' . "\n" . print_r($filter_____arr, 1) . "\n"); } //end if //-- //-- process if (is_array($filter_____arr)) { //-- foreach ($filter_____arr as $filter_____key => $filter_____val) { //-- $filter_____key = (string) $filter_____key; // force string //-- if (substr($filter_____key, 0, 11) != 'filter_____') { // avoid collisions with the variables in this function //-- if (SmartFrameworkSecurity::ValidateVariableName($filter_____key)) { //-- if (is_array($filter_____val)) { // array //-- if ((string) SMART_FRAMEWORK_DEBUG_MODE == 'yes') { self::DebugRequestLog('#EXTRACT-FILTER-VAR-ARRAY:' . "\n" . $filter_____key . '=' . print_r($filter_____val, 1) . "\n"); } //end if SmartFrameworkRegistry::setRequestVar((string) $filter_____key, (array) SmartFrameworkSecurity::FilterGetPostCookieVars($filter_____val)) or @trigger_error(__CLASS__ . '::' . __FUNCTION__ . '() :: ' . 'Failed to register an array request variable: ' . $filter_____key . ' @ ' . $filter_____info, E_USER_WARNING); //-- } else { // string //-- if ((string) SMART_FRAMEWORK_DEBUG_MODE == 'yes') { self::DebugRequestLog('#EXTRACT-FILTER-VAR-STRING:' . "\n" . $filter_____key . '=' . $filter_____val . "\n"); } //end if SmartFrameworkRegistry::setRequestVar((string) $filter_____key, (string) SmartFrameworkSecurity::FilterGetPostCookieVars($filter_____val)) or @trigger_error(__CLASS__ . '::' . __FUNCTION__ . '() :: ' . 'Failed to register a string request variable: ' . $filter_____key . ' @ ' . $filter_____info, E_USER_WARNING); //-- } //end if else //-- } //end if //-- } //end if //-- } //end foreach //-- } //end if //-- //-- if ((string) SMART_FRAMEWORK_DEBUG_MODE == 'yes') { self::DebugRequestLog('########## END REQUEST FILTER ##########' . "\n\n"); } //end if //-- }
public static function post__answer__by__ajax($tab, $frm) { //-- global $configs; //-- //-- $tmp_data = '<br><br><hr><pre>' . 'GET:' . '<br>' . Smart::escape_html(print_r(SmartFrameworkSecurity::FilterGetPostCookieVars($_GET), 1)) . '<hr>' . 'POST:' . '<br>' . Smart::escape_html(print_r(SmartFrameworkSecurity::FilterGetPostCookieVars($_POST), 1)) . '</pre>'; //-- //-- if (SmartCaptchaFormCheck::verify(self::captcha_form_name(), self::captcha_mode(), false) == 1) { // verify but do not clear yet $captcha_ok = true; } else { $captcha_ok = false; } //end if else //-- //-- if (strlen($frm['date']) > 0) { //-- if ($captcha_ok !== true) { //-- $code = 'ERROR'; $title = 'CAPTCHA verification FAILED ...'; $desc = 'Please enter a valid captcha value:' . $tmp_data; $redir = ''; $div_id = ''; $div_htm = ''; //-- } else { //-- $code = 'OK'; $title = 'Captcha validation OK ... The page or just the Captcha will be refreshed depending if TextArea is filled or not ...'; $desc = 'Form sent successful:' . $tmp_data; //-- if (strlen($frm['text_area_1']) <= 0) { $redir = SMART_FRAMEWORK_TESTUNIT_BASE_URL . 'testunit.main&time=' . time() . '&tab=' . rawurlencode($tab); $div_id = ''; $div_htm = ''; } else { $redir = ''; $div_id = 'answer_ajax'; $div_htm = '<script>$("#smart__CaptchaFrm__img").attr("src", "' . Smart::escape_js(SMART_FRAMEWORK_TESTUNIT_BASE_URL . 'testunit.captcha&time=' . time()) . '");</script><table border="0" bgcolor="#DDEEFF" width="100%"><tr><td><h1>OK, form sent on: ' . date('Y-m-d H:i:s') . '</h1></td></tr><tr><td><div align="center"><img src="lib/core/img/q_completed.png"></div></td></tr><tr><td><hr><b>Here is the content of the text area:</b><br><pre>' . Smart::escape_html($frm['text_area_1']) . '</pre></td></tr></table>'; } //end if else //-- SmartCaptchaFormCheck::clear(self::captcha_form_name(), self::captcha_mode()); // everything OK, so clear captcha //-- } //end if else //-- } else { //-- $code = 'ERROR'; $title = 'CAPTCHA NOT Checked yet ...'; $desc = 'Please fill the Date field ...' . $tmp_data; //-- if (strlen($frm['text_area_1']) > 0) { $redir = SMART_FRAMEWORK_TESTUNIT_BASE_URL . 'testunit.main&time=' . time() . '&tab=' . rawurlencode($tab); } else { $redir = ''; } //end if else //-- $div_id = ''; $div_htm = ''; //-- } //end if else //-- //-- $out = SmartComponents::post_answer_by_ajax($code, $title, $desc, $redir, $div_id, $div_htm); //-- //-- return $out; //-- }