作者:染黑就是黑米粥_343 | 来源:互联网 | 2014-07-17 11:58
?if(!empty($type)){if($typepath){if(!empty($path)){if(file_exists($path)is_file($path)){$filefile($path);if(substr($file[0],0,9)!!DOCTYPE)$doctype0;$filejoin(,$
if (!empty($type)) {
if ($type == "path") {
if (!empty($path)) {
if (file_exists($path) && is_file($path)) {
$file = file($path);
if (substr($file[0],0,9) != "
$file = join(', $file);
} else {
die ("No such file.");
}
} else {
die ("No file specified.");
}
} elseif ($type == "file") {
if (!empty($file)) {
} else {
die ("No file specified.");
}
} else {
die ("No file specified.");
}
# specify html file, check for doctype
//$file = file("file.html");
//if (substr($file[0],0,9) != "
//$file = join(', $file);
# make tags and properties lower case, close empty elements, quote all properties
$search = array ("'(<\/?)(\w+)([^>]*>)'e",
"'(<\/?)(br|input|meta|link|img)([^>]*)( />)'ie",
"'(<\/?)(br|input|meta|link|img)([^>]*)(/>)'ie",
"'(<\/?)(br|input|meta|link|img)([^>]*)(>)'ie",
"'(\w+=)(\w+)'ie",
"'(\w+=)(.+?)'ie");
$replace = array ("'\\1'.strtolower('\\2').'\\3'",
"'\\1\\2\\3>'",
"'\\1\\2\\3>'",
"'\\1\\2\\3 /\\4'",
"strtolower('\\1').'\"\\2\"'",
"strtolower('\\1').'\\2'");
$file = preg_replace($search, $replace, $file);
# return xhtml-compliant document
echo "
";
} else {
?>
" method="get">
File path:
OR
" method="get">
File contents:
}
?>
原文自
www.evilwalrus.com