Save this script to a file named visnum.php
// Configure the vars below
$width = "88";
$height = "31";
$visitor_number_filename = 'num.txt';
$visitor_number_x = "15";
$visitor_number_y = "15";
//Color for the visitor number
$visitor_number_color_r = "255";//Red
$visitor_number_color_g = "255";//Green
$visitor_number_color_b = "255";//Blue
$visitor_text = "Visitors:";
$visitor_text_x = "10";
$visitor_text_y = "2";
//Color for visitor text
$visitor_text_color_r = "255";//Red
$visitor_text_color_g = "255";//Green
$visitor_text_color_b = "255";//Blue
//Custom Font
$custom_font = "no";// yes or no :: if you set this to yes then you must set a ttf file below
$font_file = 'path/to/font.ttf';
$font_size = "5";
//Not a custom font user? there are 5 built in fonts to choose from 1, 2, 3, 4, 5
$font = "2";
//Custom Background
$custom_background = "no";// yes or no :: if you set this to yes then you must set a png file below
$background_image = 'path/to/image.png';
/******* Do not edit below this line *******/
/*******************************************/
header('Content-Type: image/png');
$w = $width;
$h = $height;
$s = $font_size;
$cf = $custom_font;
$ff = $font_file;
$f = $font;
$file = $visitor_number_filename;
$nx = $visitor_number_x;
$ny = $visitor_number_y;
$ncr = $visitor_number_color_r;
$ncg = $visitor_number_color_g;
$ncb = $visitor_number_color_b;
$vt = $visitor_text;
$vx = $visitor_text_x;
$vy = $visitor_text_y;
$vcr = $visitor_text_color_r;
$vcg = $visitor_text_color_g;
$vcb = $visitor_text_color_b;
$cb = $custom_background;
$bgi = $background_image;
$num = (is_file($file))? file_get_contents($file) : '0';
$num++;
file_put_contents($file, $num);
switch($cb) {
case "yes":
$im = imagecreatefrompng($bgi);
break;
case "no":
$im = imagecreatetruecolor($w, $h);
break;
}
$nc = imagecolorallocate($im, $ncr, $ncg, $ncb);
$vc = imagecolorallocate($im, $vcr, $vcg, $vcb);
switch($cf) {
case "yes":
imagettftext($im, $s, 0, $nx, $ny, $nc, $ff, $num);
imagettftext($im, $s, 0, $vx, $vy, $vc, $ff, $vt);
break;
case "no":
imagestring($im, $f, $nx, $ny, $num, $nc);
imagestring($im, $f, $vx, $vy, $vt, $vc);
break;
}
imagepng($im);
imagedestroy($im);
?>
"visnum.php" border="0" />
I think it is pretty self-explanatory but if you have any questions post them here.