<?
/*
Автор: SaDiEv
Сайт: comwap.ru
Пример работы: comwap.ru/top
Страница: sites.php
Назначение: список сайтов
*/
Error_Reporting(E_ALL & ~E_NOTICE); Error_Reporting (ERROR | WARNING);
extract($HTTP_GET_VARS); extract($HTTP_POST_VARS); extract($HTTP_COOKIE_VARS); extract($HTTP_SERVER_VARS); extract($HTTP_SESSION_VARS);
//сессии
session_name("SESID"); session_start();
// подключаем настройки
include "config/sis.php";
$connect=mysql_connect ($DB_HOST, $DB_USER, $DB_PASS);
mysql_select_db($DB_NAME);
$qu = @mysql_query("SELECT * FROM `users` WHERE id='".$id."' limit 1;");
if(mysql_affected_rows()==0)
{
$imer = ImageCreateFromGIF('img/error.gif');
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
Header("Content-type: image/gif");
ImageGIF($imer);
} else {
$sqlar = @mysql_fetch_array($qu);
$count = $sqlar['today'];
$count_all = $sqlar['allday'];
$counthost = $sqlar['counthost'];
$date=date('Y-m-d');
if($date!=$sqlar['date'])
{
$query = @mysql_query("SELECT `id`,`images`,`yesterday`,`bef1yes`,`bef2yes`,`today`,`counthost`,`1host`,`2host`,`3host`,`ip1`,`ip2`,`ip3`,`ip4` FROM `users` WHERE 1;");
while($updata = @mysql_fetch_array($query)) {
@mysql_query("update `users` set `date`='".$date."',`ip1`='',`ip2`='',`ip3`='',`ip4`='',`today`=0,`cin`=0,`out`=0,`counthost`=0,`yesterday`=".$updata['today'].",`bef1yes`=".$updata['yesterday'].",`bef2yes`=".$updata['bef1yes'].",`1host`=".$updata['counthost'].",`2host`=".$updata['1host'].",`3host`=".$updata['2host']." where `id`=".$updata['id'].";");
}
$count=0;
$counthost=0;
}
global $REMOTE_ADDR;
global $HTTP_USER_AGENT;
$cip = $_SERVER['REMOTE_ADDR'];
if(($sqlar['ip1'] != $cip)&&($sqlar['ip2'] != $cip)&&($sqlar['ip3'] != $cip)&&($sqlar['ip4'] != $cip)) {
++$counthost;
@mysql_query("update `users` set `counthost`=`counthost`+'1',`ip4`=`ip3`,`ip3`=`ip2`,`ip2`=`ip1`,`ip1`='".$cip."' where `id`='".$id."';");
}
$counthost = $sqlar['counthost'];
@mysql_query("UPDATE `users` SET `today`=`today`+'1',`allday`=`allday`+'1' WHERE id='".$id."';");
++$count;
++$count_all;
if ($count >= 0 && $count < 10)$levo1 = 35;
if ($count >= 10 && $count < 100)$levo1 = 30;
if ($count >= 100 && $count < 1000)$levo1 = 25;
if ($count >= 1000 && $count < 10000)$levo1 = 20;
if ($count >= 10000 && $count < 100000)$levo1 = 15;
if ($count >= 100000 && $count < 1000000)$levo1 = 10;
if ($counthost >= 0 && $counthost < 10)$levo2 = 63;
if ($counthost >= 10 && $counthost < 100)$levo2 = 58;
if ($counthost >= 100 && $counthost < 1000)$levo2 = 53;
if ($counthost >= 1000 && $counthost < 10000)$levo2 = 48;
if ($counthost >= 10000 && $counthost < 100000)$levo2 = 43;
if ($counthost >= 100000 && $counthost < 1000000)$levo2 = 30;
if ($counthost >= 1000000 && $counthost < 10000000)$levo2 = 25;
$arr=mysql_query("select * from users where id='".$id."'");
$data=mysql_fetch_array($arr);
$images = $data['images'];
if ($images == "1"){$im = ImageCreateFromGIF('img/1.gif');}
if ($images == "2"){$im = ImageCreateFromGIF('img/2.gif');}
if ($images == "3"){$im = ImageCreateFromGIF('img/3.gif');}
if ($images == "4"){$im = ImageCreateFromGIF('img/4.gif');}
$color1 = ImagecolorAllocate($im,250,250,250);
$color2 = ImagecolorAllocate($im,0,0,0);
Imagestring($im,1,$levo2,14,$counthost,$color1);
Imagestring($im,1,$levo1,14,$count,$color2);
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
Header("Content-type: image/gif");
ImageGIF($im);
}
mysql_close($connect);
?>