1 ) die("Hard stop, recursive error detected"); // if we're already partway through the smarty template, don't show it (but // mention how much had been sent) $sent = strlen(ob_get_contents()); ob_clean(); if ($sent > 0) echo "
($sent bytes had been outputed from the template when this error was encountered)
"; //dump($public_msg,$internal_msg); echo error_detail($public_msg . $internal_msg); exit(); } function error_detail($msg) { ob_start(); echo "
"; echo $msg; echo "
"; if (count($_POST) > 0) { echo "
HTTP POST data:
"; echo "
";
		print_r($_POST);
		echo "
"; } $out = ob_get_contents(); ob_end_clean(); return $out; } #useful for a sql_insert or sql_update function get_params_from_req($fields, $bool_fields=null, $all=false) { global $_REQUEST; $request = $_REQUEST; if (is_array($bool_fields)) $fields = array_merge($fields, $bool_fields); else $bool_fields = array(); $params = array(); foreach ($fields as $f) { $val = $request[$f]; # Bools are always set, since browsers don't pass any value when unchecked if ($bool_fields && in_array($f, $bool_fields)) $val = (($val == "on" || $val == "t") ? "t" : "f"); # Other types of values are left null when unset. if (!isset($val) and !$all) continue; $params[$f] = $val; } return $params; } ########### HTTP and HTML ########### function redirect($url, $cgi=null) { session_write_close(); # make sure session info written before redirecting global $__SQLtransactions; if ($__SQLtransactions > 0) error("there are still open sql transactions when trying to redirect"); if ($cgi) { $cgivars = http_build_query($cgi); if ($cgivars) $url .= "?$cgivars"; } header("Location: $url\n\n"); exit(); } ?>