<?php
function counter()
{
$query = mysql_query("SELECT visitors FROM stats") or die(mysql_error());
$sql = mysql_fetch_array($query);
if(!isset($_COOKIE['visit']))
{
$usertime = localtime();
$sec = 60-$usertime[0];
$min = 60-$usertime[1];
$hour = 24-$usertime[2];
$min = $min*60;
$hour = $hour*60*60;
$ttl = $hour+$min+$sec;
setcookie("visit", "true", time()+$ttl);
// voeg toe aan teller
$visitors = $sql['visitors']+1;
mysql_query("UPDATE stats SET visitors=".$visitors." WHERE visitors=".$sql['visitors']) or die(mysql_error());
}
else
{
$visitors = $sql['visitors'];
}
return $visitors;
}
?>
<?php
function counter()
{
if(!isset($_COOKIE['visit'])) {
$sec = 60-$usertime[0];
$min = 60-$usertime[1];
$hour = 24-$usertime[2];
$min = $min*60;
$hour = $hour*60*60;
$ttl = $hour+$min+$sec;
// voeg toe aan teller
$visitors = $sql['visitors']+1;
}
else
{
$visitors = $sql['visitors'];
}
return $visitors;
}
?>