Просмотр файла chat_servis/count.php

Размер файла: 948B
<?php
Error_Reporting(E_ALL & ~E_NOTICE);          /////////////// игнорируем ошибки

include 'conf.inc.php';
$link=mysql_connect ($DB_HOST, $DB_USER, $DB_PASS);
mysql_select_db($DB_NAME);

$qu = @mysql_query("SELECT * FROM `cusers` WHERE cid='".$cid."' limit 1;");


$sqlar  = @mysql_fetch_array($qu);
$count = $sqlar['today'];
$count_all = $sqlar['allday'];
$date=date('Y-m-d');

if($date!=$sqlar['date'])
{
	$query = @mysql_query("SELECT * FROM `cusers` WHERE `date`!='".$date."';");
	while($updata = @mysql_fetch_array($query)) {
	@mysql_query("update `cusers` set `date`='".$date."',`today`=0 where `cid`=".$updata['cid'].";");
}
$count=0;
}

@mysql_query("UPDATE `cusers` SET `today`=`today`+'1',`allday`=`allday`+'1' WHERE cid='".$cid."';");
++$count;
++$count_all;
print "&#x421;&#x435;&#x433;&#x43E;&#x434;&#x43D;&#x44F;:&nbsp;".$count; 
print "<br/>&#x412;&#x441;&#x435;&#x433;&#x43E;:&nbsp;".$count_all;
?>