The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
input.php in 4.1.5 allows arrays, needs extended
#1
Allowing arrays in Input.php was a nice addition - I had already done some stuff to work around that and can no go restructure my code to take advantage of US utilities...

However, I note that it only allows for the simplest <input type="x" name="myName[]" /> type of arrays. Going all recursive to handle multi-dimensional arrays is probably out of scope, but allowing indices that are either non-ordered numbers or even text (<input type="x" name="myName[first]" /> <input type="x" name="myName[last]" />) is trivial and is probably needed in a good 20-30{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d} of uses when people use arrays in input fields (according to my *very* rough guesstimate in my personal experience which may be wildly off-base).

I haven't run this code, but I think it will take care of it:

Code:
public static function get($item){
Code:
if (isset($_POST[$item])) {
Code:
/*
Code:
If the $_POST item is an array, process each item independently, and return array of sanitized items.
Code:
*/
Code:
if (is_array($_POST[$item])){
Code:
$postItems=array();
Code:
foreach ($_POST[$item] as $k => $postItem){
NOTE THE
Code:
$k =>
Code:
$postItems[$k]=self::sanitize($postItem);
NOTE THE
Code:
$k
Code:
}
Code:
return $postItems;
Code:
}else{
Code:
return self::sanitize($_POST[$item]);
Code:
}

} elseif(isset($_GET[$item])){
/*
If the $_GET item is an array, process each item independently, and return array of sanitized items.
*/
if (is_array($_GET[$item])){
$getItems=array();
foreach ($_GET[$item] as $getItem){
$getItems[]=self:Confusedanitize($getItem);
}
return $getItems;
}else{
return self:Confusedanitize($_GET[$item]);
}
}
return '';
}
  Reply


Messages In This Thread
input.php in 4.1.5 allows arrays, needs extended - by plb - 09-19-2016, 02:12 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)