View file go/site.php

File size: 1.98Kb
<?php
    /////////// Powered by Giga!!! /////////
	/////////// http://gwap.net.ru /////////
	/////////// [email protected] /////////


	echo '<?xml version="1.0" encoding="utf-8"?>
	      <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
	      <head>';
echo "<title>Статистика</title>";
echo '<link rel="stylesheet" href="./style.css" type="text/css" />';
    echo '</head>
          <body>';
echo "<div>";
echo "<div class=\"c\">статистика переходов</div>";
      
      $conf["items_per_page"] = 20;
if (!isset($page)) {$page = 0;}
$total = 0;
if(!($dp = opendir("site/"))) die ("Cannot open ./");
$file_array = array(); 
while ($file = readdir ($dp))
	{
	if(substr($file,0,1) != '.' and $file != "index.php")
		{
		$file_array[] =  $file;
		}
	}
$file_count = count ($file_array);
sort ($file_array);
	
			if ($file_count > 0)
			{
			$first_record = $page * $conf["items_per_page"];
			$last_record = $first_record + $conf["items_per_page"];
			
			while (list($fileIndexValue, $file_name) = each ($file_array))
				{
				
				if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record))
					{
									$countsite = @file_get_contents("site/$file_name");

			$file_name = explode('.txt',$file_name);

					echo "$file_name[0]: $countsite<br/>";
					}
				}
			
			if (($file_count > 0) AND ($page != 0))
				{
				$prev_page = $page -1;
				echo "<br/><a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\">назад</a><br/>";
				}
			
			
			if (($file_count > 0) AND ($last_record < $file_count))
				{
				$next_page = $page + 1;
				echo "<br/><a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page\">далее</a><br/>";
				}
			echo "<br/>всего: $file_count ";
			echo "<div class=\"c\"><a href=\"/\">домой</a></div>";
			}
		closedir($dp);
echo "</div>";
echo '</body></html>';
   ?>