pustim skriptu, izvrsava se 5minuta i kaze cannot conect...
uderim refresh i izvrsi se...
lepo pamti sesije, ali samo sto ne stigne da loguje visitor-a...
Code:
<?php
session_start();
function getIP() {
if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");
else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
else $ip = "UNKNOWN";
return $ip;
};
include("db.php");
if(!session_is_registered('counted')){
$agent = $_SERVER['HTTP_USER_AGENT'];
$ip = getIP();
$host = @GetHostByAddr($ip);
$ref = $_SERVER['HTTP_REFERER'];
$dtime = time();
if($ref == ""){
$ref = "None";
}
session_register('counted');
$hd=mysql_connect($host, $user, $pass) or die("Cannot connect!");
mysql_select_db($db, $hd);
$res=mysql_query("insert into visitors (ip, time, referer, agent, host) values ('".$ip."', '".time()."','".$ref."','".$agent."','".$host."')", $hd);
};
$hd=mysql_connect($host, $user, $pass) or die("Cannot connect!");
mysql_select_db($db, $hd);
$res=mysql_query("select count(id) from visitors", $hd);
$no = mysql_result($res,0);
$res=mysql_query("select count(ip) from visitors where ((time)>(".time()."-86400))", $hd);
$sata24 = mysql_result($res,0);
$res=mysql_query("select count(ip) from visitors where ((time)>(".time()."-300))", $hd);
$trenutno = mysql_result($res,0);
?>
<?php
session_start();
function getIP() {
if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");
else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
else $ip = "UNKNOWN";
return $ip;
};
include("db.php");
if(!session_is_registered('counted')){
$agent = $_SERVER['HTTP_USER_AGENT'];
$ip = getIP();
$host = @GetHostByAddr($ip);
$ref = $_SERVER['HTTP_REFERER'];
$dtime = time();
if($ref == ""){
$ref = "None";
}
session_register('counted');
$hd=mysql_connect($host, $user, $pass) or die("Cannot connect!");
mysql_select_db($db, $hd);
$res=mysql_query("insert into visitors (ip, time, referer, agent, host) values ('".$ip."', '".time()."','".$ref."','".$agent."','".$host."')", $hd);
};
$hd=mysql_connect($host, $user, $pass) or die("Cannot connect!");
mysql_select_db($db, $hd);
$res=mysql_query("select count(id) from visitors", $hd);
$no = mysql_result($res,0);
$res=mysql_query("select count(ip) from visitors where ((time)>(".time()."-86400))", $hd);
$sata24 = mysql_result($res,0);
$res=mysql_query("select count(ip) from visitors where ((time)>(".time()."-300))", $hd);
$trenutno = mysql_result($res,0);
?>
--
"Once hadst thou passions and calledst them evil. But now hast thou only
thy virtues: they grew out of thy passions."
"Once hadst thou passions and calledst them evil. But now hast thou only
thy virtues: they grew out of thy passions."