Просмотр файла public_html/ftp/show.php

Размер файла: 2.22Kb
<?php
error_reporting(0);
$k=trim($_GET['k']); include("key.php"); $t=trim($_GET['t']);

if ((($t=="wml")||($t=="htm")||($t=="html")||($t=="txt")||($t=="pr")||($t=="pr2"))&&(file_exists("data/$k.ed"))) {
 if (($t=="pr")||($t=="pr2")) {
  $fl=@file_get_contents("data/$k.ed");
  function chrpl($str) {
   for ($j=0;$j<32;$j++) {
    if ($j<>13) {$str=str_replace(chr($j),'',$str);}
   }
   return $str;
  }
  $fl=chrpl($fl);
  $fl=htmlspecialchars($fl,ENT_QUOTES);
  if ($t=="pr2") {
   $fl=preg_replace("~&lt;[^<>]*&gt;~iU",
   "<font color=\"#0000ff\">\\0</font>",$fl);
   $fl=preg_replace("~(&lt;[^\s!]*\s)([^<>]*)([/?]?&gt;)~iU",
   "\\1<font color=\"#007f7f\">\\2</font>\\3",$fl);
   $fl=preg_replace("~&lt;!--.*--&gt;~iU",
   "<font color=\"#909090\">\\0</font>",$fl);
   $fl=preg_replace("~(&quot;|&#039;)[^<>]*(&quot;|&#039;)~iU",
   "<font color=\"#900000\">\\0</font>",$fl);
   $fl=str_replace("\r","<br>\r\n",$fl);
  } else {$fl=str_replace('$','$$',$fl); $fl=str_replace("\r","<br/>\r\n",$fl);}
if ($t=="pr") {
header("Cache-Control: no-cache, must-revalidate");
header("Content-Type: text/vnd.wap.wml; charset=Utf-8");
echo ("<?xml version=\"1.0\" encoding=\"Utf-8\"?><!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml_1.2.xml\"><wml>
<head><meta forua=\"true\" http-equiv=\"Cache-Control\" content=\"no-cache,no-store,must-revalidate\"/></head><card title=\"Просмотр кода\">
<p align=\"left\"><small>
$fl</small></p>
</card></wml>");
} else {
header("Cache-Control: no-cache, must-revalidate");
header("Content-Type: text/html; charset=Utf-8");
echo ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html>
<head><title>Просмотр кода</title>
<meta forua=\"true\" http-equiv=\"Cache-Control\" content=\"no-cache\"></head>
<body bgcolor=\"#e6f5ff\" link=\"#0000aa\" vlink=\"#800000\"><small>
$fl</small></body></html>");
}
 } else {
  $fl=@file_get_contents("data/$k.ed");
  if ($t=="wml") {header("Content-Type: text/vnd.wap.wml; charset=utf-8");}
  elseif (($t=="htm")||($t=="html")) {header("Content-Type: text/html; charset=utf-8");}
  elseif ($t=="txt") {header("Content-Type: text/plain; charset=utf-8");}
  echo $fl; exit;
 }
}
?>