View file index.php

File size: 11.25Kb
<?php 
/***********************************************************************
***************                 Статистика сайта         ***************
*********                           САРСУК                    **********
*******                       Сайт автора LoBoK.ORG              *******
******                Скрипт распространяется БЕСПЛАТНО           ******
*******                          ICQ 416644044                   *******
**********                Требования к скрипту: PHP5          **********
***************                      MySql               ***************
***********************************************************************/
Error_Reporting(0);
///-----------------------------------------Соединение с бд------------------------------------------------///
include 'connect.php';
///--------------------------------------------------------------------------------------------------------///
$path=$_SERVER['PHP_SELF'];
$folder=dirname($path);
/////include $_SERVER['DOCUMENT_ROOT'].$folder.'/log.php';

if (isset($_GET['d']) and isset($_GET['m']) and isset($_GET['y']))
	{
		$dd=valid_number($_GET['d']);
		$mm=valid_number($_GET['m']);
		$yy=valid_number($_GET['y']);
		$name_dir=$dd.'_'.$mm.'_'.$yy;
	}
		else
		{
			$dd=date("d");
			$mm=date("m");
			$yy=date("y");
			$name_dir=date("d_m_y");
		}














$store=unserialize(trim(file_get_contents('data/days/'.$name_dir.'/counter.dat')));
$hit=0;
$mobil_phone=0;
$om_hit=0;
$screen_size['240x320']=0;
$screen_size['176x220']=0;
$screen_size['128x160']=0;
$screen_size['176x208']=0;
$screen_size['128x128']=0;
$screen_size['208x208']=0;
$screen_size['132x176']=0;
$screen_size['640x360']=0;
$screen_size['240x432']=0;
$screen_size['352x416']=0;
$screen_size['220x220']=0;
$screen_size['130x130']=0;
$screen_size['320x240']=0;
$screen_size['240x432']=0;
$screen_size['101x80']=0;
$screen_size['120x160']=0;
$screen_size['128x96']=0;
$screen_size['208x320']=0;
	foreach ($store as $k=>$v)
		{
		$hit+=$store[$k]['hit'];
			if (!empty($store[$k]['xml_ScreenSize']))
				{
					$hits[$k]=$store[$k]['hit'];
					$mobil_phone+=$store[$k]['hit'];
					$screen_size[$store[$k]['xml_ScreenSize']]+=$store[$k]['hit'];
				}
					if (!empty($store[$k]['xml_Model']))
						{
							$model[$store[$k]['xml_Model'].'('.$store[$k]['xml_Maker'].')']+=$store[$k]['hit'];
						}
							if (!empty($store[$k]['om']))
								{
									$om_hit+=$store[$k]['hit'];
								}
		}
if (!is_file('data/days/'.$name_dir.'/counter.dat'))
{$host=0;
$hit=0;}
	else {$host=count($store);}
$cookie=trim(file_get_contents('data/days/'.$name_dir.'/cookie.dat'));
$gzip=trim(file_get_contents('data/days/'.$name_dir.'/gzip.dat'));
header("Content-type: text/html; charset=utf-8");
header("Cache-Control: no-cache");
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
<title>Статистика посещений сайта '.$_SERVER['HTTP_HOST'].'</title></head><body bgcolor="#999999"><form method="get" action="?">
		<table width="100%" border="0" cellspacing="2" cellpadding="0" align="center" bgcolor="#000000">
			<tr>
				<td valign="top" bgcolor="#dcdcdc">
					<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="black">
						<caption><font color="black">Сводная статистика для </font><font color="#ff0000"><b>'.$_SERVER['HTTP_HOST'].'</b></font> [<b>'.$dd.'.'.$mm.'.'.$yy.'</b>]<br>
							
	ДД<input name="d" type="text"  maxlength="2" size="5" style="-wap-input-format:\'5N\'" value="'.date('d').'">
ММ<input name="m" type="text"  maxlength="2" size="5" style="-wap-input-format:\'5N\'" value="'.date('m').'">
ГГ<input name="y" type="text"  maxlength="4" size="5" style="-wap-input-format:\'5N\'" value="'.date('y').'">
<input type="submit" value="Показать">
	
	
	
	
	
	</caption>
						<tr>
							<td bgcolor="#dcdcdc">Хосты</td>
							<td bgcolor="#dcdcdc">
								<div align="right">
									[<font color="#ff0000">'.$host.'</font>]
</div>
							</td>
						</tr>
						<tr>
							<td bgcolor="#dcdcdc">Хиты</td>
							<td bgcolor="#dcdcdc">
								<div align="right">
									 [<font color="#ff0000">'.$hit.'</font>]</div>
							</td>
						</tr>
						<tr>
							<td bgcolor="#dcdcdc">Мобильные телефоны</td>
							<td bgcolor="#dcdcdc">
								<div align="right">
							[<font color="red">'.$mobil_phone.'</font>][<font color="red">'.round((($mobil_phone/$hit)*100)).'%</font>]
							</div></td>
						</tr>
								<tr>
							<td bgcolor="#dcdcdc">Opera Mini</td>
							<td bgcolor="#dcdcdc">
								<div align="right">
							[<font color="red">'.$om_hit.'</font>][<font color="red">'.round((($om_hit/$hit)*100)).'%</font>]
							</div></td>
						</tr>
						<tr>
							<td bgcolor="#dcdcdc">Cookies</td>
							<td bgcolor="#dcdcdc">
								<div align="right">
							[<font color="red">'.$cookie.'</font>][<font color="red">'.round((($cookie/$hit)*100)).'%</font>]</div>
							</td>
						</tr>
						<tr>
							<td bgcolor="#dcdcdc">Компрессия</td>
							<td bgcolor="#dcdcdc">
								<div align="right">
									[<font color="red">'.$gzip.'</font>][<font color="red">'.round((($gzip/$hit)*100)).'%</font>]
							</div></td>
						</tr>
					</table>
					    <a href="log/?d='.$dd.'&amp;m='.$mm.'&amp;y='.$yy.'" style="color: #000000"><b>Логи</b></a><br>
						
</td>
<td valign="top" bgcolor="#dcdcdc">
<div align="center">
						<b>Разрешения экранов</b><br>
								<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="black">
								<tr>
									<td bgcolor="#dcdcdc">Разрешение экрана</td>
									<td bgcolor="#dcdcdc">Доля%</td>
									<td bgcolor="#dcdcdc">Хиты</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">240x320</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['240x320']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['240x320'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">176x220</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['176x220']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['176x220'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">128x160</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['128x160']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['128x160'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">176x208</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['176x208']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['176x208'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">128x128</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['128x128']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['128x128'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">208x208</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['208x208']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['208x208'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">132x176</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['132x176']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['132x176'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">640x360</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['640x360']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['640x360'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">240x432</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['240x432']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['240x432'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">352x416</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['352x416']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['352x416'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">220x220</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['220x220']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['220x220'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">130x130</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['130x130']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['130x130'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">320x240</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['320x240']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['320x240'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">240x432</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['240x432']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['240x432'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">101x80</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['101x80']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['101x80'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">120x160</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['120x160']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['120x160'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">128x96</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['128x96']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['128x96'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">208x320</td>
									<td bgcolor="#dcdcdc">'.round((($screen_size['208x320']/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.$screen_size['208x320'].'</td>
								</tr>
								<tr>
									<td bgcolor="#dcdcdc">Неопределенные</td>
									<td bgcolor="#dcdcdc">'.round(((($hit-array_sum($screen_size))/$hit)*100)).'%</td>
									<td bgcolor="#dcdcdc">'.($hit-array_sum($screen_size)).'</td>
								</tr>
							</table>
	</div>
				</td>
			<td valign="top" bgcolor="#dcdcdc">
<div align="center">
Модели телефонов
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="black">
<tr><td bgcolor="#dcdcdc">Модель</td><td bgcolor="#dcdcdc"><div align="right">Хиты/Доля%</div></td></tr>';

@natsort($model);
$model=@array_reverse($model);
$cancel=0;
foreach($model as $k=>$v)
{
$cancel+=1;
	if ($cancel>18){break;}
	echo '<tr><td bgcolor="#dcdcdc">'.$k.'</td>
	<td bgcolor="#dcdcdc"><div align="right">'.$v.'['.round((($v/$hit)*100)).'%]</div></td></tr>';
}
echo '<tr><td bgcolor="#dcdcdc">Неопределенные устройства</td>
	<td bgcolor="#dcdcdc"><div align="right">'.($hit-array_sum($model)).'['.round(((($hit-array_sum($model))/$hit)*100)).'%]</div></td></tr></table></div>
				</td>
			</tr>
		</table>';

if (isset($_GET['hits']))
{
natsort($hits);
$hits=array_reverse($hits);
foreach($hits as $k=>$v)
	{
		echo "$k=>$v<br>";
	}
}




echo '

		<img src="http://wapbn.com/26.gif" alt="©">'.$script_version.'
	</form></body></html>';




?>