View file o5on.ru/html/charts/day.php

File size: 3.79Kb
<?php
include '../../inc/config.inc.php';
include '../../inc/wap_tags.inc.php';
include '../../inc/functions.inc.php';

connect_to_db();
$today = date("Ymd");

print "<chart>\n";
//print " <chart_transition type='dissolve' delay='1' duration='3' order='series' />\n";
print "	<axis_category size=\"10\" color=\"000000\" alpha=\"50\" skip=\"0.1\" orientation=\"horizontal\" />\n";
print "	<axis_value size=\"10\" color=\"000000\" alpha=\"50\" steps=\"6\" prefix=\"\" suffix=\"\" decimals=\"0\" separator=\"\" show_min=\"\" />\n";
print "	<axis_ticks value_ticks=\"\" size=\"10\" category_ticks=\"1\" major_thickness=\"2\" minor_thickness=\"1\" minor_count=\"1\" major_color=\"999999\" minor_color=\"666666\" position=\"outside\" />\n";
print "	<chart_border color=\"999999\" top_thickness=\"0\" bottom_thickness=\"2\" left_thickness=\"2\" right_thickness=\"0\" />\n";
print "	<chart_grid_h alpha=\"10\" color=\"000000\" thickness=\"1\" type=\"solid\" />\n";
print "	<chart_grid_v alpha=\"10\" color=\"000000\" thickness=\"1\" type=\"solid\" />\n";
print "	<chart_type>Line</chart_type>\n";
print "	<chart_data>\n";
print "		<row>\n";
print "			<null/>\n";

$result = mysql_query("SELECT * FROM `weeks` WHERE `uid`='".$uid."' ORDER BY `id` DESC LIMIT 30;");
$stat1 = array();
$stat2 = array();
$stat3 = array();

		while(false!==$fetch=mysql_fetch_array($result)){
		$stat1[(int)$fetch['date']] = $fetch['host'];
		$stat2[(int)$fetch['date']] = $fetch['count'];
		$stat3[(int)$fetch['date']] = $fetch['date'];
		}

		for($i=0; $i < 30; $i++){
		if($i == 0)print "			<string>". date('j.m', time()-3600*24*0) ."</string>\n";
		if($i == 5)print "			<string>". date('j.m', time()-3600*24*5) ."</string>\n";
		if($i == 10)print "			<string>". date('j.m', time()-3600*24*10) ."</string>\n";
		if($i == 15)print "			<string>". date('j.m', time()-3600*24*15) ."</string>\n";
		if($i == 20)print "			<string>". date('j.m', time()-3600*24*20) ."</string>\n";
		if($i == 25)print "			<string>". date('j.m', time()-3600*24*25) ."</string>\n";
		if($i == 30)print "			<string>". date('j.m', time()-3600*24*30) ."</string>\n";
		if($i != 30 && $i != 25 && $i != 20 && $i != 15 && $i != 10 && $i != 5 && $i != 0 )print "			<string></string>\n";
        }


print "		</row>\n";
print "		<row>\n";
print "			<string>Hits</string>\n";

       for($i=0; $i < 30; $i++){
       $er = date("Ymd",mktime(date("H"),date("i"),date("s"),date("m"),date("d")-$i,date("Y")));
       echo "			<number>".(isset($stat2[$er])?$stat2[$er]:'0')."</number>\n";
       }

print "		</row>\n";
print "		<row>\n";
print "			<string>Hosts</string>\n";
       for($i=0; $i < 30; $i++){
       $er = date("Ymd",mktime(date("H"),date("i"),date("s"),date("m"),date("d")-$i,date("Y")));
       echo "			<number>".(isset($stat1[$er])?$stat1[$er]:'0')."</number>\n";
       }
print "		</row>\n";
print "	</chart_data>\n";
print "	<chart_pref line_thickness=\"3\" point_shape=\"none\" fill_shape=\"\" />\n";
print "	<chart_rect x=\"-120\" y=\"47\" width=\"650\" height=\"180\" line_thickness=\"5\" />\n";
print "	<chart_value prefix=\"\" suffix=\"\" decimals=\"0\" separator=\"\" position=\"cursor\" hide_zero=\"1\" as_percentage=\"\" font=\"arial\" bold=\"1\" size=\"12\" color=\"333333\" alpha=\"75\" />\n";
print "	<legend_rect x=\"55\" y=\"20\" width=\"0\" height=\"0\" margin=\"0\" />\n";
print "	<legend_label size=\"10\" layout=\"vertical\" />\n";
print "	<draw>\n";
print "		<text color=\"333333\" alpha=\"75\" font=\"arial\" rotation=\"0\" bold=\"1\" size=\"12\" x=\"50\" y=\"47\" width=\"480\" height=\"160\" h_align=\"right\" v_align=\"top\">". date('j.m.Y') ."</text>\n";
print "	</draw>	\n";
print "	<series_color>\n";
print "		<value>77bb11</value>\n";
print "		<value>cc5511</value>\n";
print "	</series_color>\n";
print "</chart>\n";

?>