Hata Ayıklama ve Hata Kayıtlarını Tarihleri ile Saklama

PHP
53 lines
<?php
header('Content-Type: text/html; charset=utf-8');
class HataAyiklama {
function hata2($V,$isim="") {
$tiprengi="RED";
$isimrengi="BLUE";
$degerrengi="BLACK";
$D="";
if (is_int($V)) {
$D="<FONT COLOR=$tiprengi><B>Sayı: </B></FONT>";
if ($isim!="") $D .= "( <FONT COLOR=$isimrengi>$isim</FONT> ) ";
$D.=" [ <FONT COLOR=$degerrengi>$V</FONT> ]";
}
if (is_string($V)) {
$D="<FONT COLOR=$tiprengi><B>Metin: </B></FONT>";
if ($isim!="") $D .= "( <FONT COLOR=$isimrengi>$isim</FONT> ) ";
$D.=" [ <FONT COLOR=$degerrengi>"$V"</FONT> ]";
}
if (is_array($V)) {
$D = "<FONT COLOR=$tiprengi><B>Dizi: </B></FONT>";
if ($isim!="") $D .= "( <FONT COLOR=$isimrengi>$isim</FONT> ) ";
$D .= "<FONT COLOR=$degerrengi><UL>";
while(list($key, $val) = each($V)) {
$D.= hata2($val,$key);
}
$D.="</UL></FONT>";
}
$D.="<BR>";
return($D);
}
function hata($V,$isim="") {
$D = $this->hata2($V,$isim);
$D .= "<META CHARSET=UTF-8><TABLE SIZE=100% CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD><HR SIZE=1></TD>
<TD WIDTH=1%><FONT FACE='Verdana,arial' SIZE=1>".date("d.m.Y")."·".date("H:i:s")."</FONT></TD></TR></TABLE>";
$alt = @file("./hata.html");
$alt[] = "";
$alt = implode($alt,"");
$fp = @fopen("./hata.html","w");
if($fp==""){
echo '<SCRIPT>alert("hata.html dosyası gerekli");</SCRIPT>';
exit;
}else{
fwrite($fp,$D."\n");
fwrite($fp,$alt);
fclose($fp);
}
echo '<SCRIPT>w=window.open("hata.html","HataAyiklamaVAR","WIDTH=450,HEIGHT=500,scrollbars=yes,resizable=yes");w.focus();</SCRIPT>';
}
}
$degisken1="Bu bir hatadır";
$D = new HataAyiklama();
$D->hata($degisken1,"degisken1");
?>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Çıktısı

HTML
4 lines
Metin: ( degisken1 ) [ "Bu bir hatadır" ]
07.06.2018 01:12:44
Metin: ( degisken1 ) [ "Bu bir hatadır" ]
07.06.2018 01:12:20
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 

Sizin Değerli Görüşlerinize İhtiyacımız Var.