<?php
/*
+--------------------------------------------------------------------------
| D4WStats v3.0.7 - Developers4Web Web Stats Software
| ==========================================================
| by Developers4Web.com
| D4WStats is a Trade Mark of Developers4Web
| Copyright Developers4Web 2005 - 2006. All rights reserved.
| English:
| http://stats-service.developers4web.com
| Español:
| http://www.developers4web.com
| ========================================
| optimized by Trio Solutions
| Dreamweaver Extensions and Web Development Components
| English:
| http://components.developers4web.com
| Español:
| http://componentes.developers4web.com
| ========================================
| Web: http://stats-service.developers4web.com
| Date: Monday, 11 September 2006
| Email: info (at) developers4web (dot) com
| License Type: D4WSTATS is NOT Open Source Software and Limitations Apply
| Licence Info: /d4wstats/license.txt
+--------------------------------------------------------------------------
*/
?>
<?PHP
header ("Content-type: image/png");
require "./colors.inc.php";
function frdate($x1 = "", $x2="")
{
/** if ($x1 == "Y-m")
return "2006-03";
else
return "2006-03-11";
**/
if ($x2 != "")
return date($x1, $x2);
else
return date($x1);
// NOTA TAMBIEN ESTA DECLARADA EN ../reporte.inc.php
}
////checkLogin();
$width = $_GET["w"];
$height = $_GET["h"];
$count = $_GET["c"];
$max = $_GET["max"];
if ($max==0) $max=1;
$max = ceil(($max+$max/10)/4)*4;
$content = explode(",", $_GET["x"]);
$text = 8;
$im = @imagecreate ($width+$text+20, $height+$text+2)
or die ("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 255, 255, 0);
$line = 4;
$subline = 2;
$black = imagecolorallocate ($im, 0, 0, 0);
for ($i=0;$i<4;$i++)
{
imageline($im,0+$text,($height/4*$i)+$text,$width+$text,($height/4*$i)+$text,imagecolorallocate ($im, 200, 200, 200));
imageline($im,0+$text,($height/4*$i)+$text,$line+$text,($height/4*$i)+$text,$black);
imagestringup($im,1,0,($height/4*$i)+$text+strlen($max/4*(4-$i))*2,($max/4*(4-$i)),imagecolorallocate ($im, 0, 0, 0)) ;
}
for ($i=0;$i<20;$i++)
imageline($im,0+$text,($height/20*$i)+$text,$subline+$text,($height/20*$i)+$text,$black);
//imageline($im,0+$text,$height/2,$width+$text,$height/2,imagecolorallocate ($im, 200, 200, 200));
imageline($im,0+$text,0,0+$text,$height,imagecolorallocate ($im, 0, 0, 0));
imageline($im,0+$text,$height,$width+$text,$height,imagecolorallocate ($im, 0, 0, 0));
//for ($i = $count; $i > 0; $i--)
$text = $text+10;
if ($count == 30)
{
$i = 0;
for ($k=$count-1; $k>= 0; $k--)
{
imagefilledrectangle($im,$i*($width/$count)+$text,$height-$content[$k*3+3]/$max*$height,($i+1)*($width/$count)+$text-10,$height,imagecolorallocate ($im, 0, 0, 0));
imagefilledrectangle($im,$i*($width/$count)+$text+1,$height-$content[$k*3+3]/$max*$height+1,($i+1)*($width/$count)+$text-10-1,$height-1,imagecolorallocate ($im, $color[0][1], $color[0][2], $color[0][3]));
imagefilledrectangle($im,$i*($width/$count)+$text+3,$height-$content[$k*3+2]/$max*$height,($i+1)*($width/$count)+$text-10+3,$height,imagecolorallocate ($im, 0, 0, 0));
imagefilledrectangle($im,$i*($width/$count)+$text+1+3,$height-$content[$k*3+2]/$max*$height+1,($i+1)*($width/$count)+$text-10-1+3,$height-1,imagecolorallocate ($im, $color[1][1], $color[1][2], $color[1][3]));
imagefilledrectangle($im,$i*($width/$count)+$text+6,$height-$content[$k*3+1]/$max*$height,($i+1)*($width/$count)+$text-10+6,$height,imagecolorallocate ($im, 0, 0, 0));
imagefilledrectangle($im,$i*($width/$count)+$text+1+6,$height-$content[$k*3+1]/$max*$height+1,($i+1)*($width/$count)+$text-10-1+6,$height-1,imagecolorallocate ($im, $color[2][1], $color[2][2], $color[2][3]));
imagestringup($im,0,$i*($width/$count)+$text-8+(($width/$count))/2,$height-($content[$k*3+3]/$max*$height)-2,$content[$k*3+3],imagecolorallocate ($im, 0, 0, 0));
$i++;
}
$time = time();
for ($i=0; $i< $count; $i++)
{
$time2 = strtotime(date("Y-m-d",$time)." ".($i - $count + 1)." day");
$day = date("j",$time2);
if ($day<10)
imagestring($im,1,$i*($width/$count)+$text+5,$height+3,$day,imagecolorallocate ($im, 0, 0, 0));
else
imagestring($im,1,$i*($width/$count)+$text+3,$height+3,$day,imagecolorallocate ($im, 0, 0, 0));
}
}
else
{
$i = 0;
for ($k=0; $k<$count; $k++)
{
imagefilledrectangle($im,$i*($width/$count)+$text,$height-$content[$k*3+3]/$max*$height,($i+1)*($width/$count)+$text-10,$height,imagecolorallocate ($im, 0, 0, 0));
imagefilledrectangle($im,$i*($width/$count)+$text+1,$height-$content[$k*3+3]/$max*$height+1,($i+1)*($width/$count)+$text-10-1,$height-1,imagecolorallocate ($im, $color[0][1], $color[0][2], $color[0][3]));
imagefilledrectangle($im,$i*($width/$count)+$text+3,$height-$content[$k*3+2]/$max*$height,($i+1)*($width/$count)+$text-10+3,$height,imagecolorallocate ($im, 0, 0, 0));
imagefilledrectangle($im,$i*($width/$count)+$text+1+3,$height-$content[$k*3+2]/$max*$height+1,($i+1)*($width/$count)+$text-10-1+3,$height-1,imagecolorallocate ($im, $color[1][1], $color[1][2], $color[1][3]));
imagefilledrectangle($im,$i*($width/$count)+$text+6,$height-$content[$k*3+1]/$max*$height,($i+1)*($width/$count)+$text-10+6,$height,imagecolorallocate ($im, 0, 0, 0));
imagefilledrectangle($im,$i*($width/$count)+$text+1+6,$height-$content[$k*3+1]/$max*$height+1,($i+1)*($width/$count)+$text-10-1+6,$height-1,imagecolorallocate ($im, $color[2][1], $color[2][2], $color[2][3]));
imagestringup($im,0,$i*($width/$count)+$text-8+(($width/$count))/2,$height-($content[$k*3+3]/$max*$height)-2,$content[$k*3+3],imagecolorallocate ($im, 0, 0, 0));
$i++;
}
for ($i=0; $i< $count; $i++)
{
$dt = $i;
if ($dt < 10) $dt = "0".$dt;
imagestring($im,1,$i*($width/$count)+$text+5,$height+3,$dt,imagecolorallocate ($im, 0, 0, 0));
}
}
//imagestringup($im,1,0,strlen($max)*5,$max,imagecolorallocate ($im, 0, 0, 0)) ;
imagepng ($im);
?>