Welcome to the CHICKEN Scheme pasting service

How NOT to "validate" SQL code against injection added by sjamaan on Thu Oct 6 13:57:11 2011

      // Remove all valid values from calc, if anything is left over, it is invalid.

      // First, remove all field names.
      $repl = array();
      $patterns = array();
      foreach (_views_calc_substitutions() as $key => $value) {
        $key = trim($value);
        $count = strlen($value);
        $replace = preg_quote($value);
        $patterns[] = "`(^|[^\\\\\\\\])". $replace ."`";
        $repl[] = '${1}';
      }
      $remaining = trim(preg_replace($patterns, $repl, $item['calc']));
      // Next, remove functions and numbers.
      $repl = array();
      $patterns = array();
      foreach (_views_calc_replacements() as $value) {
        $patterns[] = "`(^|[^\\\\\\\\])". preg_quote(trim($value)) ."`";
        $repl[] = '${1}';
      }
      $remaining = trim(preg_replace($patterns, $repl, $remaining));
      if (!empty($remaining)) {
        form_set_error($form_values[$delta]['calc'], t('The values %remaining in %field are not allowed.', array('%remaining' => $remaining, '%field' => $item['label'])));
      }

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
`call/cc' is a short name for which procedure?
Visually impaired? Let me spell it for you (wav file) download WAV