rendered paste body<?php
include("geoip.inc");
$gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);
$maxLen = 37;
$file = fopen("current_song.txt", "r");
$curSong = fread($file, 128);
if ( strlen($curSong) < 2 )
{
$curSong = " Nothing";
}
else if ( strlen($curSong) > $maxLen-1 )
{
$curSong = substr($curSong, 0, $maxLen-1);
$curSong = $curSong . "...";
}
fclose($file);
$file = fopen("latest_download.txt", "r");
$latestDL = fread($file, 128);
list($latestDL, $sizeDL) = split('[|]', $latestDL);
fclose($file);
$file = fopen("latest_url.txt", "r");
$latestURL = fread($file, 128);
if ( strlen($latestURL) > $maxLen )
{
$latestURL = substr($latestURL, 0, $maxLen-1);
$latestURL = $latestURL . "...";
}
fclose($file);
/*$file = fopen("current_bandwidth.txt", "r");
$currentBandwidth = fread($file, 128);
fclose($file);*/
$file = fopen("sig_hits.txt", "r");
$hits = fread($file, 9);
fclose($file);
$file = fopen("sig_hits.txt", "w");
$hits++;
fwrite($file, $hits);
fclose($file);
$ref = $_SERVER['HTTP_REFERER'];
$country = geoip_country_name_by_addr($gi, $_SERVER['REMOTE_ADDR']);
$latest_hit = "$ref|$country";
$file = fopen("latest_hit.txt", "w");
fwrite($file, $latest_hit);
fclose($file);
$img = imagecreate(350, 100);
$bg = imagecolorallocate($img, 1, 1, 1);
$fg = imagecolorallocate($img, 0, 0, 166);
imagecolortransparent($img, $bg);
imagestring($img, 2, 5, 5, "Listening to :", $fg);
imagestring($img, 2, 110, 5, $curSong, $fg);
imagestring($img, 2, 5, 25, "Latest download : ", $fg);
imagestring($img, 2, 110, 25, " " . $latestDL . " " . $sizeDL, $fg);
imagestring($img, 2, 5, 45, "Latest page : ", $fg);
imagestring($img, 2, 110, 45, " " . $latestURL, $fg);
/*imagestring($img, 2, 5, 65, "Down kBps : ", $fg);
imagestring($img, 2, 110, 65, " " . $currentBandwidth . "kBps", $fg);*/
imagestring($img, 2, 5, 65, "Sig Hits : ", $fg);
imagestring($img, 2, 110, 65, " " . $hits, $fg);
imagestring($img, 3, 230, 80, "Coded by Fatalis", $fg);
header("Expires: Mon, 5 Jun 1999 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header('Content-type: image/gif');
imagegif($img);
imagedestroy($img);
?>