Location: PHPKode > projects > Warp.cms - php/mysql content management > warp_121/mod_stats.php
<?php

// [statistics module v.1.2.1]
// xantis.warp.cms - version 1.2
// (c) 2002 xantis - all rights reserved
// this code is registered and protected by international copyrights laws


//##################################################


if ($warp_module_var_check_auth != 'x99warpv12.cms') {
	$y_hlocalmodz_xdate = date("Y-m-d");
	$y_hlocalmodz_xtime = date("H:i:s");
	$wpmod_xdyech =	"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n".
			"<!--:: xantis.warp.cms :: Xantis Warp - Content Management Server - v.1.2 :: $y_hlocalmodz_xdate :: $y_hlocalmodz_xtime :: -->\n".
			"<html>\n".
			"<head>\n".
			"<title>! ! !</title>\n".
			"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n".
			"</head>\n".
			"<body bgcolor=\"#FFFFFF\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\n".
			"<br>\n".
			"<div align=\"center\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://active.macromedia.com/flash6/cabs/swflash.cab#version=6,0,0,0\" width=\"30\" height=\"30\">\n".
			"<param name=\"movie\" value=\"flagger.swf\">\n".
			"<param name=\"flashvars\" value=\"&xaction=err&\">\n".
			"<param name=\"quality\" value=\"high\">\n".
			"<param name=\"bgcolor\" value=\"#FFFFFF\">\n".
			"<param name=\"menu\" value=\"false\">\n".
			"<embed src=\"flagger.swf\" flashvars=\"&xaction=err&\" quality=\"high\" bgcolor=\"#FFFFFF\" width=\"30\" height=\"30\" menu=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>\n".
			"</object>\n".
			"</div>\n".
			"</body>\n".
			"</html>\n" ;
	die("$wpmod_xdyech");
} //end if


function stats_module_extend ($yquerry, $ypict, $ytext) {

global $y_warp_picts_dir, $ywebsite_addr, $ybar_menu_color ;
global $var_result_size ;

//--------------------------------get total count
xmysql_count_data ($yquerry);
//$var_result_size

//--------------------------------display
	xtable_row_start ();
		xtable_column_start_vcenter ('1', '', "$ybar_menu_color");
			xpict("$ywebsite_addr"."$y_warp_picts_dir".'/'.$ypict, '30', '30');
		xtable_column_end ();

		xtable_column_start_vcenter ('1', '', "$ybar_menu_color");
			xspace();
			xspace();
			xspace();
		xtable_column_end ();

		xtable_column_start_vcenter ('1', '', "$ybar_menu_color");
			xtext_small ('<b>'."$ytext".' : '.'</b>'.'[ '."$var_result_size".' ]');
		xtable_column_end ();
	xtable_row_end ();

	xtable_row_start ();
		xtable_column_start_vcenter ('3', '', "$ybar_menu_color");
			xspace();
		xtable_column_end ();
	xtable_row_end ();

} //END FUNCTION


//######################################

function stats_module () {
//-------------------

//remote and lib vars
global 	$var_result_size, $arr_var_result, $ydisplay_width_corrected ;

//cfg vars
global 	$ybar_menu_color, $y_warp_xdate, $y_warp_xtime, $ywarp_graph_bar, $y_warp_picts_dir, $ywebsite_addr ;

//stats cfg vars
global 	$ystats_os, $ystats_total, $ystats_browser ;
global	$ystats_visitors, $ystats_start_date_txt, $ystats_start_date ;
global	$ystats_miscx, $ystats_prev_visitors, $ystats_prev_visitors_txt ;


//----------------------------------------------get data

xmysql_count_data ("SELECT COUNT(*) FROM counter");
if ($var_result_size == 0) {
	$y_total_visitors = 0;
} // end if

if ($var_result_size <> 0) {
	$y_total_visitors = $var_result_size;
} // end if

if ($y_total_visitors <> 0) {
//-------------------------------OS
	xmysql_count_data ("SELECT COUNT(*) FROM counter WHERE (w_os='windows') ");
	$y_total_visitors_windows = $var_result_size;
	$y_total_visitors_windows_p = round (100*$var_result_size/$y_total_visitors);

	xmysql_count_data ("SELECT COUNT(*) FROM counter WHERE (w_os='mac') ");
	$y_total_visitors_mac = $var_result_size;
	$y_total_visitors_mac_p = round (100*$var_result_size/$y_total_visitors);

	xmysql_count_data ("SELECT COUNT(*) FROM counter WHERE (w_os='linux') ");
	$y_total_visitors_linux = $var_result_size;
	$y_total_visitors_linux_p = round (100*$var_result_size/$y_total_visitors);

	xmysql_count_data ("SELECT COUNT(*) FROM counter WHERE (w_os='sun') ");
	$y_total_visitors_sun = $var_result_size;
	$y_total_visitors_sun_p = round (100*$var_result_size/$y_total_visitors);

	xmysql_count_data ("SELECT COUNT(*) FROM counter WHERE (w_os='irix') ");
	$y_total_visitors_irix = $var_result_size;
	$y_total_visitors_irix_p = round (100*$var_result_size/$y_total_visitors);

	xmysql_count_data ("SELECT COUNT(*) FROM counter WHERE (w_os='freebsd') ");
	$y_total_visitors_freebsd = $var_result_size;
	$y_total_visitors_freebsd_p = round (100*$var_result_size/$y_total_visitors);

	xmysql_count_data ("SELECT COUNT(*) FROM counter WHERE (w_os='other') ");
	$y_total_visitors_other_os = $var_result_size;
	$y_total_visitors_other_os_p = round (100*$var_result_size/$y_total_visitors);

//-------------------------------browser
	xmysql_count_data ("SELECT COUNT(*) FROM counter WHERE (w_browser='msie') ");
	$y_total_visitors_msie = $var_result_size;
	$y_total_visitors_msie_p = round (100*$var_result_size/$y_total_visitors);

	xmysql_count_data ("SELECT COUNT(*) FROM counter WHERE (w_browser='netscape') ");
	$y_total_visitors_netscape = $var_result_size;
	$y_total_visitors_netscape_p = round (100*$var_result_size/$y_total_visitors);

	xmysql_count_data ("SELECT COUNT(*) FROM counter WHERE (w_browser='opera') ");
	$y_total_visitors_opera = $var_result_size;
	$y_total_visitors_opera_p = round (100*$var_result_size/$y_total_visitors);

	xmysql_count_data ("SELECT COUNT(*) FROM counter WHERE (w_browser='other') ");
	$y_total_visitors_other_brow = $var_result_size;
	$y_total_visitors_other_brow_p = round (100*$var_result_size/$y_total_visitors);


} // end if



//################################################


//--------------------------------------total visitors

xshow_display_std_start ("$ystats_total", "$ydisplay_width_corrected") ;
xcenter_start ();
xtable_start ('450');

xtable_row_start ();
	xtable_column_start_vcenter ('1', '450', "$ybar_menu_color");
		xcenter_start ();
			xnewline ();
			xpict("$ywebsite_addr"."$y_warp_picts_dir".'/stats.jpg', '30', '30');
			xnewline ();
			xnewline ();
			xtext_small (' [ '.$y_warp_xdate.' | '.$y_warp_xtime.' ]');
			xnewline ();
			xnewline ();
			xtext_small ('<b>'.$ystats_total.'</b>'.' : '.$y_total_visitors);
			xnewline ();
			xnewline ();
			xtext_small ($ystats_start_date_txt.' : '.$ystats_start_date);
			xnewline ();
			xtext_small ($ystats_prev_visitors_txt.' : '.$ystats_prev_visitors);
			xnewline ();
			xnewline ();
		xcenter_end ();
	xtable_column_end ();
xtable_row_end ();

xtable_end ();
xcenter_end ();
xshow_display_std_end ();

xnewline ();


//--------------------------------------os visitors

xshow_display_std_start ("$ystats_os", "$ydisplay_width_corrected") ;

xcenter_start ();
xtable_start ('450');

xtable_row_start ();
	xtable_column_start_vcenter ('4', '450', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();
xtable_row_end ();


//------------windows
xtable_row_start ();
	xtable_column_start_vcenter ('1', '20', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '30', "$ybar_menu_color");
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/logo_win.jpg', '30', '30', 'Windows');
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '270', "$ybar_menu_color");
		xvpix ('10');
		xtext_small ('<b>Windows : </b>'.'['.$y_total_visitors_windows.' | '.$y_total_visitors_windows_p.'%]'.' '.$ystats_visitors);
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '130', "$ybar_menu_color");
		xvpix ('10');
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/'."$ywarp_graph_bar", $y_total_visitors_windows_p+5, '18', 'Windows : '.'['.$y_total_visitors_windows_p.'%]');
	xtable_column_end ();

xtable_row_end ();

xtable_row_start ();
	xtable_column_start_vcenter ('4', '450', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();
xtable_row_end ();

//------------


//------------mac
xtable_row_start ();
	xtable_column_start_vcenter ('1', '20', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '30', "$ybar_menu_color");
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/logo_mac.jpg', '30', '30', 'Mac / PPC');
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '270', "$ybar_menu_color");
		xvpix ('10');
		xtext_small ('<b>Mac / PPC : </b>'.'['.$y_total_visitors_mac.' | '.$y_total_visitors_mac_p.'%]'.' '.$ystats_visitors);
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '130', "$ybar_menu_color");
		xvpix ('10');
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/'."$ywarp_graph_bar", $y_total_visitors_mac_p+5, '18', 'Mac / PPC : '.'['.$y_total_visitors_mac_p.'%]');
	xtable_column_end ();

xtable_row_end ();

xtable_row_start ();
	xtable_column_start_vcenter ('4', '450', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();
xtable_row_end ();

//------------


//------------linux
xtable_row_start ();
	xtable_column_start_vcenter ('1', '20', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '30', "$ybar_menu_color");
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/logo_linux.jpg', '30', '30', 'Linux');
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '270', "$ybar_menu_color");
		xvpix ('10');
		xtext_small ('<b>Linux : </b>'.'['.$y_total_visitors_linux.' | '.$y_total_visitors_linux_p.'%]'.' '.$ystats_visitors);
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '130', "$ybar_menu_color");
		xvpix ('10');
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/'."$ywarp_graph_bar", $y_total_visitors_linux_p+5, '18', 'Linux : '.'['.$y_total_visitors_linux_p.'%]');
	xtable_column_end ();

xtable_row_end ();

xtable_row_start ();
	xtable_column_start_vcenter ('4', '450', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();
xtable_row_end ();

//------------


//------------sun
xtable_row_start ();
	xtable_column_start_vcenter ('1', '20', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '30', "$ybar_menu_color");
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/logo_sun.jpg', '30', '30', 'Sun Solaris');
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '270', "$ybar_menu_color");
		xvpix ('10');
		xtext_small ('<b>Sun Solaris : </b>'.'['.$y_total_visitors_sun.' | '.$y_total_visitors_sun_p.'%]'.' '.$ystats_visitors);
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '130', "$ybar_menu_color");
		xvpix ('10');
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/'."$ywarp_graph_bar", $y_total_visitors_sun_p+5, '18', 'Sun Solaris : '.'['.$y_total_visitors_sun_p.'%]');
	xtable_column_end ();

xtable_row_end ();

xtable_row_start ();
	xtable_column_start_vcenter ('4', '450', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();
xtable_row_end ();

//------------


//------------irix
xtable_row_start ();
	xtable_column_start_vcenter ('1', '20', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '30', "$ybar_menu_color");
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/logo_irix.jpg', '30', '30', 'SGI Irix');
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '270', "$ybar_menu_color");
		xvpix ('10');
		xtext_small ('<b>SGI Irix : </b>'.'['.$y_total_visitors_irix.' | '.$y_total_visitors_irix_p.'%]'.' '.$ystats_visitors);
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '130', "$ybar_menu_color");
		xvpix ('10');
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/'."$ywarp_graph_bar", $y_total_visitors_irix_p+5, '18', 'SGI Irix : '.'['.$y_total_visitors_irix_p.'%]');
	xtable_column_end ();

xtable_row_end ();

xtable_row_start ();
	xtable_column_start_vcenter ('4', '450', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();
xtable_row_end ();

//------------


//------------freebsd
xtable_row_start ();
	xtable_column_start_vcenter ('1', '20', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '30', "$ybar_menu_color");
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/logo_fbsd.jpg', '30', '30', 'FreeBSD');
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '270', "$ybar_menu_color");
		xvpix ('10');
		xtext_small ('<b>FreeBSD : </b>'.'['.$y_total_visitors_freebsd.' | '.$y_total_visitors_freebsd_p.'%]'.' '.$ystats_visitors);
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '130', "$ybar_menu_color");
		xvpix ('10');
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/'."$ywarp_graph_bar", $y_total_visitors_freebsd_p+5, '18', 'FreeBSD : '.'['.$y_total_visitors_freebsd_p.'%]');
	xtable_column_end ();

xtable_row_end ();

xtable_row_start ();
	xtable_column_start_vcenter ('4', '450', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();
xtable_row_end ();

//------------


//------------other OS
xtable_row_start ();
	xtable_column_start_vcenter ('1', '20', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '30', "$ybar_menu_color");
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/logo_xno.jpg', '30', '30', 'Other');
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '270', "$ybar_menu_color");
		xvpix ('10');
		xtext_small ('<b>Other : </b>'.'['.$y_total_visitors_other_os.' | '.$y_total_visitors_other_os_p.'%]'.' '.$ystats_visitors);
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '130', "$ybar_menu_color");
		xvpix ('10');
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/'."$ywarp_graph_bar", $y_total_visitors_other_os_p+5, '18', 'Other : '.'['.$y_total_visitors_other_os_p.'%]');
	xtable_column_end ();

xtable_row_end ();

xtable_row_start ();
	xtable_column_start_vcenter ('4', '450', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();
xtable_row_end ();

//------------

xtable_end ();
xcenter_end ();
xshow_display_std_end ();

xnewline ();


//--------------------------------------browser visitors

xshow_display_std_start ("$ystats_browser", "$ydisplay_width_corrected") ;

xcenter_start ();
xtable_start ('450');

xtable_row_start ();
	xtable_column_start_vcenter ('4', '450', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();
xtable_row_end ();

//------------msie
xtable_row_start ();
	xtable_column_start_vcenter ('1', '20', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '30', "$ybar_menu_color");
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/logo_msie.jpg', '30', '30', 'MSIE');
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '270', "$ybar_menu_color");
		xvpix ('10');
		xtext_small ('<b>MSIE : </b>'.'['.$y_total_visitors_msie.' | '.$y_total_visitors_msie_p.'%]'.' '.$ystats_visitors);
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '130', "$ybar_menu_color");
		xvpix ('10');
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/'."$ywarp_graph_bar", $y_total_visitors_msie_p+5, '18', 'MSIE : '.'['.$y_total_visitors_msie_p.'%]');
	xtable_column_end ();

xtable_row_end ();

xtable_row_start ();
	xtable_column_start_vcenter ('4', '450', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();
xtable_row_end ();

//------------


//------------netscape
xtable_row_start ();
	xtable_column_start_vcenter ('1', '20', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '30', "$ybar_menu_color");
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/logo_netscape.jpg', '30', '30', 'Netscape');
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '270', "$ybar_menu_color");
		xvpix ('10');
		xtext_small ('<b>Netscape : </b>'.'['.$y_total_visitors_netscape.' | '.$y_total_visitors_netscape_p.'%]'.' '.$ystats_visitors);
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '130', "$ybar_menu_color");
		xvpix ('10');
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/'."$ywarp_graph_bar", $y_total_visitors_netscape_p+5, '18', 'Netscape : '.'['.$y_total_visitors_netscape_p.'%]');
	xtable_column_end ();

xtable_row_end ();

xtable_row_start ();
	xtable_column_start_vcenter ('4', '450', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();
xtable_row_end ();

//------------


//------------opera
xtable_row_start ();
	xtable_column_start_vcenter ('1', '20', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '30', "$ybar_menu_color");
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/logo_opera.jpg', '30', '30', 'Opera');
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '270', "$ybar_menu_color");
		xvpix ('10');
		xtext_small ('<b>Opera : </b>'.'['.$y_total_visitors_opera.' | '.$y_total_visitors_opera_p.'%]'.' '.$ystats_visitors);
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '130', "$ybar_menu_color");
		xvpix ('10');
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/'."$ywarp_graph_bar", $y_total_visitors_opera_p+5, '18', 'Opera : '.'['.$y_total_visitors_opera_p.'%]');
	xtable_column_end ();

xtable_row_end ();

xtable_row_start ();
	xtable_column_start_vcenter ('4', '450', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();
xtable_row_end ();

//------------


//------------other browser
xtable_row_start ();
	xtable_column_start_vcenter ('1', '20', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '30', "$ybar_menu_color");
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/logo_xno.jpg', '30', '30', 'Other');
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '270', "$ybar_menu_color");
		xvpix ('10');
		xtext_small ('<b>Other : </b>'.'['.$y_total_visitors_other_brow.' | '.$y_total_visitors_other_brow_p.'%]'.' '.$ystats_visitors);
	xtable_column_end ();

	xtable_column_start_vcenter ('1', '130', "$ybar_menu_color");
		xvpix ('10');
		xpict_alt ("$ywebsite_addr"."$y_warp_picts_dir".'/'."$ywarp_graph_bar", $y_total_visitors_other_brow_p+5, '18', 'Other : '.'['.$y_total_visitors_other_brow_p.'%]');
	xtable_column_end ();

xtable_row_end ();

xtable_row_start ();
	xtable_column_start_vcenter ('4', '450', "$ybar_menu_color");
		xspace ();
	xtable_column_end ();
xtable_row_end ();

//------------


xtable_end ();
xcenter_end ();
xshow_display_std_end ();

xnewline ();



//--------------------------------------misc stats

xmysql_read_data ("SELECT s_title, s_pict, s_query FROM plugs_statistics WHERE (active='y') ORDER BY id ASC");
//$arr_var_result

if (count($arr_var_result) > 0) {

xshow_display_std_start ("$ystats_miscx", "$ydisplay_width_corrected") ;
xcenter_start ();
xtable_start ('450');

xtable_row_start ();
	xtable_column_start_vcenter ('1', '450', "$ybar_menu_color");

		xcenter_start ();
		xnewline ();
		xpict("$ywebsite_addr"."$y_warp_picts_dir".'/stats_misc.jpg', '30', '30');
		xnewline ();
		xnewline ();
		xtable_start ('');

		for ($i=0; $i<count($arr_var_result); $i++) {
			$i_title = $i;
			$i_pict = $i + 1;
			$i_query = $i + 2;
			$i = $i + 2;
			stats_module_extend ($arr_var_result[$i_query], $arr_var_result[$i_pict], $arr_var_result[$i_title]);
		} //end for

		xtable_end ();
		xcenter_end ();


	xtable_column_end ();
xtable_row_end ();

xtable_end ();
xcenter_end ();
xshow_display_std_end ();

xnewline ();

} //end if



}//END FUNCTION


//############################################################################



//------------------------------

//stats_module ();

//------------------------------

// end of php code
?>
Return current item: Warp.cms - php/mysql content management