BlackHalt writeln (by me or from manual) PHP source Codes ...

BlackHalt Countera PHP source:

<?php #error_reporting(0);
// COUNTERIS
// datumi:
$tagad=date('mdY');
$vakar=date('mdY',mktime(0,0,0,date('m'),date('d')-1,date('Y')));
// paarbauda vai ir fails:
if(!file_exists($tagad)){
touch($tagad);
chmod($tagad,0600);
}
// bez shitaa var iztikt:
if(file_exists($vakar)){
unlink($vakar);
}
// IP
function nosakaip(){
if(
getenv('HTTP_CLIENT_IP')&&strcasecmp(getenv('HTTP_CLIENT_IP'),'unknown'))
$ip=getenv('HTTP_CLIENT_IP');
else if(
getenv('HTTP_X_FORWARDED_FOR')&&strcasecmp(getenv('HTTP_X_FORWARDED_FOR'),'unknown'))
$ip=getenv('HTTP_X_FORWARDED_FOR');
else if(
getenv('REMOTE_ADDR')&&strcasecmp(getenv('REMOTE_ADDR'),'unknown'))
$ip=getenv('REMOTE_ADDR');
else if(isset(
$_SERVER['REMOTE_ADDR'])&&$_SERVER['REMOTE_ADDR']&&strcasecmp($_SERVER['REMOTE_ADDR'],'unknown'))
$ip=$_SERVER['REMOTE_ADDR'];
else
$ip='unknown';
return(
$ip);
}
$adrese=nosakaip($ip);
// raksta failaa:
$fp=fopen($tagad,'a');
fwrite($fp,"$adrese\n");
fclose($fp);
// saskaitaamie:
$fails=file($tagad);
$izvilkt=array_unique($fails);
$hosti=count($izvilkt);
$hiti=count($fails);
// rada bildi:
header('Content-type: image/png');
$platums=80;
$augstums=15;
$bilde=imagecreate($platums,$augstums);
// hostu ciparu kraasa RGB:
$hostkrasa=imagecolorallocate($bilde,255,255,255);
// labaas puses laukuma kraasa:
$labais=imagecolorallocate($bilde,255,251,240);
// kreisaas puses laukuma kraasa:
$kreisais=imagecolorallocate($bilde,67,110,155);
// raamja kraasa:
$ramis=imagecolorallocate($bilde,150,150,150);
// iepilda labo kraasu
imagefilledrectangle($bilde,0,0,$platums,$augstums,$labais);
// iepilda kreiso kraasu liidz 29px atziimei :
imagefilledrectangle($bilde,0,0,29,$augstums,$kreisais);
// ciparu lielums vieta
imagestring($bilde,2,4,1,$hosti,$hostkrasa);
imagestring($bilde,2,33,1,$hiti,$kreisais);
// iepilda raami :
imagerectangle($bilde,0,0,$platums-1,$augstums-1,$ramis);
imagepng($bilde);
imagedestroy($bilde);
?>