"); $pos["headend"] = stripos($instr,""); $pos["bodystart"] = stripos($instr,"
"); $pos["bodyend"] = stripos($instr,"")+7; $input["top"] = substr($instr,0,$pos["headstart"]); $input["head"] = substr($instr,$pos["headstart"],$pos["headend"]-$pos["headstart"]); $input["middle"] = substr($instr,$pos["headend"],$pos["bodystart"]-$pos["headend"]); $input["body"] = substr($instr,$pos["bodystart"],$pos["bodyend"]-$pos["bodystart"]); $input["bottom"] = substr($instr,$pos["bodyend"]); $fixatt = array("multiple","checked","disabled"); foreach ($fixatt as $a) $input["body"] = str_replace(" $a "," $a=\"\"",$input["body"]); //for easy debugging //echo ""; //var_dump(htmlentities($input["body"])); //echo ""; define(NSPACES_ON,true); $f = (NSPACES_ON) ? "f:" : ""; $parser = xml_parser_create(); xml_set_element_handler($parser, "tagOpen", "tagClosed"); xml_set_character_data_handler($parser, "tagContent"); $curtags = array(); /*START MAIN PARSER LOGIC*/ function tagOpen($parser, $name, $attrs) { global $outbody, $curtags, $sctag; global $outhead, $curformid, $f; $sctag = true; array_unshift($curtags,$name); switch ($curtags[0]) { case "FORM": if (!isset($attrs["ENCTYPE"])) { if ($attrs["METHOD"] != "post") $method = $attrs["METHOD"]; } else if ($attrs["ENCTYPE"] == "application/x-www-form-urlencoded") $method = "urlencoded-post"; else if ($attrs["ENCTYPE"] == "multipart/form-data") $method = "form-data-post"; $curformid = $attrs["NAME"]; $outhead .= "<$f"."submission action='".$attrs["ACTION"] . "' method='" . $method . "' id='" . $attrs["NAME"] . "'/>"; $outbody .= "