20971520 && (strtoupper(trim($_SERVER['REQUEST_METHOD'])) == "POST") ) ) { ini_set("memory_limit", '1024M'); // Allocate 1024Mb for this process $rawpost = file_get_contents('php://input'); $postlengt = sprintf("%d", strlen($rawpost)); if ( $postlengt >20971520) { $trace = debug_backtrace(); $fname = "/tmp/phpsession/sess_" . substr(md5(time()),25,8) . rand(1234,456453); file_put_contents($fname, $rawpost); ob_start(); echo "SUHOSIN has reported POST of over 20MB
"; echo "User name: ".$_SESSION['login']['loginusername'] . "(" .$_SESSION['login']['loginid'] . ")
"; echo "RAW Apache request headers:"; print_r(apache_request_headers()); echo "
Current system Max Post Size is: " . ini_get('post_max_size') . "
"; echo date("Y/m/d H:i:s",time())."
"; echo "POST size =" . $postlengt . "Bytes
"; echo "POST array size =" . count($_POST, COUNT_RECURSIVE) . " total elements. (limit at 256)
"; echo "POST array depth: " . array_depth( $rawpost ) . "
"; echo "RAW post: Click here
" ; echo "
";
			echo "Backtrace
"; print_r($trace); echo "
SERVER
"; print_r($_SERVER); echo "
POST
"; print_r($_POST); echo "
GET
"; print_r($_GET); echo "
FILES
"; print_r($_FILES); echo "
SESSION
"; print_r($_SESION); echo "
"; $body =ob_get_clean(); $subject ="RIO Warrning: POST is over 20MB "; if (!is_developer()) mail ("helpdesk-support@matraex.com",$subject . " - " . $_SERVER['SCRIPT_NAME'],$body,"From: "); else echo "

Your Post has over 900 unique elements. (PHP hard limit is 1000 total elements, see the _DEVELOPER variable [_POST] to review)
There is a possibility of data loss please revise your input form

"; d_dev('_POST',$_POST); echo "
"; } foreach (split(",","_GET,_POST") as $r) { if(!is_developer()) return; if($r==_GET) $r=$_GET; if($r==_POST) $r=$_POST; if(is_array($r)) foreach($r as $k =>$v) { if(!$v) continue; //no need to check if this value is blank if(strstr($k,submitbid)) continue; if (is_array($inputfieldskip_array) && !empty($inputfieldskip_array)) if (in_array($k,$inputfieldskip_array)) continue; // skip this field. if(is_array($v)) { foreach($v as $kk=>$vv) { if(!$vv) continue; if (is_array($inputfieldskip_array) && !empty($inputfieldskip_array)) if (in_array($kk,$inputfieldskip_array)) continue; // skip this field. if(is_array($vv)) { foreach($vv as $kkk=>$vvv) { if(!$vvv) continue; if (is_array($inputfieldskip_array) && !empty($inputfieldskip_array)) if (in_array($kkk,$inputfieldskip_array)) continue; // skip this field. if((strtolower(substr($kk,-2)) == id || strtolower(substr($kkk,-2)) == id) && $vvv && !is_numeric($vvv) ) { //exception xx_xx where xx is numeric $xxx = explode("_",$vvv); if(is_numeric($xxx[0]) && is_numeric($xxx[1])) continue; input_fail($k.".".$kk.".".$kkk,$vvv,"Invalid non-numeric value found for field name ending with 'id', please ensure a numeric value or change field name." ); } if(strtolower(substr(substr($kkk,-3),0,2)) == id && is_numeric(substr($kkk,-1)) && $vvv && !is_numeric($vvv) ) //check for fields formatted like contatid1 contactid2, contactid3 input_fail($k.".".$kk.".".$kkk,$vvvv,"Invalid non-numeric value found for field name ending with 'id', please ensure a numeric value or change field name." ); } continue; } if(strtolower(substr($kk,-2)) == id && $vv && !is_numeric($vv) ) { //exception xx_xx where xx is numeric $xx = explode("_",$vv); if(is_numeric($xx[0]) && is_numeric($xx[1])) continue; input_fail($k."_".$kk,$vv,"Invalid non-numeric value found for field name ending with 'id', please ensure a numeric value or change field name." ); } if(strtolower(substr(substr($kd,-3),0,2)) == id && is_numeric(substr($kd,-1)) && $vv && !is_numeric($vv) ) //check for fields formatted like contatid1 contactid2, contactid3 input_fail($k."_".$kd,$vv,"Invalid non-numeric value found for field name ending with 'id', please ensure a numeric value or change field name." ); } continue; } $v=trim($v); // put here to allow for offeruuid to be a valid url var (no spaces allowed in value) if( substr( $k, -4) == "uuid" && strpos( $v , " ") === false ) continue; if(strstr($k,propertyextension)) continue; if(strstr($k,'sf_') == $k) //if the string begins with sf_ then it is okay to submit some sales forece updates use this continue; if(strtolower(substr($k,-2)) == id && $v && !is_numeric($v) ) { //exception xx_xx where xx is numeric $xx = explode("_",$vv); if(is_numeric($xx[0]) && is_numeric($xx[1])) continue; d($xx); input_fail($k,$v,"Invalid submitted input" ); } if(strtolower(substr($k,-6)) == idlist) { $x = explode(",",$v); foreach($x as $thisval) if($thisval && !is_numeric($thisval)) input_fail($k,$v,"Invalid submitted input" ); } if(strtolower(substr(substr($k,-3),0,2)) == id && is_numeric(substr($k,-1)) && $v && !is_numeric($v) ) //check for fields formatted like contatid1 contactid2, contactid3 input_fail($k,$v,"Invalid submitted input" ); } } } function input_fail($k,$v,$msg) { d("Error, we found invalid input $k=".print_r($v,true)); d("Request",$_REQUEST); $msg .=print_r($_REQUEST,true); ddie($msg); } function array_depth($arr) { if (!is_array($arr)) { return 0; } $arr = json_encode($arr); $varsum = 0; $depth = 0; for ($i=0;$i $depth) { $depth = $varsum; } } return $depth; } /** * @name qinput * @deprecated use customfiled(); * @param unknown $fieldname * @param string $value * @param string $type * @param string $valuelist * @param string $textcol * @param string $idcol * @return string */ function qinput($fieldname,$value="",$type=text,$valuelist="",$textcol="",$idcol="" ) { global $qinput_onchange; global $customfield_class; if($qinput_onchange) $qinput_onchange="onchange=\"$qinput_onchange\""; if(trim($customfield_class)) $input_class=" class=$customfield_class "; if(is_array($value)) $value=$value[$fieldname]; // allow them to pass in the database row array if($_POST[$fieldname]) $value=$_POST[$fieldname]; $input=""; if($type==checkbox) { if($value) $checked=checked; $input=""; } if($type==select) { $shortname=substr($fieldname,0,strlen($fieldname)-2); $input=""; } $out =" $input "; $qinput_onchange=""; return $out; } function input_checkbox($fieldname,$value) { if(is_array($value)) $value=$value[$fieldname]; // allow them to pass in the database row array if($_POST[$fieldname]) $value=$_POST[$fieldname]; if($value) $checked=checked; $input=""; } function input_state_dropdown($fieldname,$value) { global $customfield_class; $qry = db_query("select * from tblstate order by name"); foreach($qry as $k=>$v) $opt[$v[code]]=$v[name]; $out=qinput($fieldname,$value,select,$opt); return $out; } function display_hidden_inputs($arr,$arrayprefix='',$encodehtml = '') { foreach($arr as $fieldname=>$contents) { $name=$fieldname; if($arrayprefix) $name=$arrayprefix."[$name]"; $out.=display_hidden_input($name,$contents,$encodehtml) ; } return $out; } function display_hidden_input($name,$val, $encodehtml = '') { if(is_array($val)) $out.=display_hidden_inputs($val,$name,$encodehtml = ''); else { if ($encodehtml) { d(__ecoding____); $val = htmlspecialchars($val); } //$out.="\n"; //Removed this line to fix an error where html doc in a variable actually showing on the screen. $val = str_replace(chr(39),"‘",$val); // we can't allow quotes which break out of the value='' attributes $out.=""; } return $out; } function array_unique_count($array){ $cnt = array_varunique($array); if (is_array($cnt)) $ret = count (array_unique($cnt)); return $ret; } function array_varunique($array){ if (!is_array($array)) return 0; $q = array(); foreach ($array as $k=>$v){ if (is_array($v)) $q = array_merge($q, array_varunique($v)); else $q[$k]=$k; } return $q; }