<?php
include('lite_teller.php');
include('lite_stats.php');
//imagestats.php

$gethim=array();

//1
if(isset($_GET['showd1']))
{
$gethim[0]=$_GET['showd1'];
}else{
$gethim[0]="Bezoekers:";
}
//2
if(isset($_GET['showd2']))
{
$gethim[1]=$_GET['showd2'];
}else{
$gethim[1]="Aantal dagen gemeten:";
}
//3
if(isset($_GET['showd3']))
{
$gethim[2]=$_GET['showd3'];
}else{
$gethim[2]="Totaal aantaal bezoekers in ".(count($result)-1)." dagen:";
}
//4
if(isset($_GET['showd4']))
{
$gethim[3]=$_GET['showd4'];
}else{
$gethim[3]="Gemiddeld p.dag:";
}
//5
if(isset($_GET['showd5']))
{
$gethim[4]=$_GET['showd5'];
}else{
$gethim[4]="Hoogst aantal bezoekers op 1 dag:";
}



$showtrack=explode("-", $_GET['show']);
if($showtrack['0']=="1"){$ja[0]=1;$regels0=$regels0+1;}
if($showtrack['1']=="1"){$ja[1]=1;$regels0=$regels0+1;}
if($showtrack['2']=="1"){$ja[2]=1;$regels0=$regels0+1;}
if($showtrack['3']=="1"){$ja[3]=1;$regels0=$regels0+1;}
if($showtrack['4']=="1"){$ja[4]=1;$regels0=$regels0+1;}

////////////
$filename = 'teller.GIF';
header('Content-type: image/gif');

// Get new sizes

$newwidth = $_GET['width'];
$newheight = $_GET['height'];
$thumb = imagecreate($newwidth, $newheight);

$bgcolor=explode("-",$_GET['bgcolor']);
$col1=$bgcolor[0];
$col2=$bgcolor[1];
$col3=$bgcolor[2];

$background=imagecolorallocate($thumb,$col1,$col2,$col3);
$source = imagecreatefromgif($filename);

imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

//////////


$hoog=-15;
for($i=0;$i<5;$i++)
{

if($i==0){$show=str_replace("@dagen%",(count($result)-1),$gethim[$i])." ".file_get_contents("entrys_".date("d-m-y").".txt");}
if($i==1){$show=str_replace("@dagen%",(count($result)-1),$gethim[$i])." ".(count($result)-1);}
if($i==2){$show=str_replace("@dagen%",(count($result)-1),$gethim[$i])." ".$som;}
if($i==3){$show=str_replace("@dagen%",(count($result)-1),$gethim[$i])." ".round($som/(count($result)-1),1);}
if($i==4){$show=str_replace("@dagen%",(count($result)-1),$gethim[$i])." ".$high." op ".$daghigh;}

$fontcolor=explode("-",$_GET['fontcolor']);
$col1=$fontcolor[0];
$col2=$fontcolor[1];
$col3=$fontcolor[2];

$orange = imagecolorallocate($thumb,$col1,$col2,$col3);

if($ja[$i]==1){$hoog=$hoog+17;imagestring($thumb, 5,5, $hoog, $show, $orange);}
}
$hoog=$hoog+17;imagestring($thumb, 5,5, $hoog, $langste, $orange);



imagegif($thumb);
?>