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

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

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>");

if (file_exists("data/$k.ed")) {
 @exec($php.' -c -f -l "data/'.$k.'.ed"',$rt,$v); $erl=0;
 if (($v==255)||(count($rt)==3)) {
  echo("Ошибка: "); $st=trim(strip_tags($rt[1])); $error=1;
  if ($st<>NULL) {
   $srp=trim(preg_replace("~[^:]*:(.*)(in [^\s]*data/".$k.".ed).*~","\\1",$st,1));
   echo str_replace("$k.ed","",$srp);
   $st=str_replace("$k.ed","",$st);
   $erl=preg_replace("~.*\s(\d*)$~","\\1",$st,1);
   if ($erl<>NULL) {
    $pg=ceil($erl/15);
    echo("<br>\r\nСтрока: $erl; Страница: $pg");
   }
  } else {echo("неизвестная");}
  echo("<br>- - -<br>\r\n");
 } elseif ($v===0) {
  $error=2;
  echo("Синтаксических ошибок в файле не найдено<br>- - -<br>\r\n");
 }
 if (($error==1)||($mr==1)) {
  $fl=str_replace("\n","",trim(file_get_contents("data/$k.ed")));
  $fl=highlight_string($fl,true);
  $fl=str_replace(array('<code>','</code>','</span>'),array('','','</font>'),$fl);
  $fl=str_replace('span style="color: ','font color="',$fl);
  $arr=split("\r",$fl); $cnt=count($arr);
  if ($mr==1) {$begin=0; $end=$cnt;}
  else {$begin=$erl-2; $end=$erl+1; if ($begin<0) {$begin=0;} if ($end>$cnt) {$end=$cnt;}}
  for ($i=$begin;$i<$end;$i++) {
   if ($i==$erl-1) {$fcl="ff0000"; $bcl="000000";} else {$fcl="ffffff"; $bcl="000000";}
   echo("<span style=\"color:#$fcl; background-color:#$bcl\">".($i+1)." </span>".$arr[$i]."<br>\r\n");
  }
 } elseif ($error<>2) {echo("Файл не проверен.<br/>\r\n");}
} else {echo("Файл не найден.<br/>\r\n");}

if (($mr<>1)&&($error<>0)) {
if ($error==1) {echo("- - -<br/><a href=\"chck.php?k=$k&amp;mr=1\">Полный синтаксис</a>");}
else {echo("<a href=\"chck.php?k=$k&amp;mr=1\">Показать синтаксис</a>");}
}

echo("</small></body></html>");
?>