Jump to content
php.lv forumi

Online


Chickenz

Recommended Posts

Scirpts izmanto mysql db, proba taada ka nesaprotu kaapeec nedzeesh aaraa vecos ierakstus... MOZGAS NESTRAADAA nevaru izdomaat...

plz paskatieties no malas un pasakiet kur ir kljuuda...

function online(){
$expire = time() - 60;
$rezultats=mysql_query("DELETE FROM online WHERE stamp < $expire");
$ip = getenv("REMOTE_ADDR");
$rezultats=mysql_query("SELECT * FROM online WHERE ip = '$ip'");
$tagadtime = time();

if(mysql_num_rows($rezultats)>0){$rezultats=mysql_query("UPDATE online SET stamp = 

$tagadtime WHERE ip = '$ip'");}
else{$rezultats=mysql_query("INSERT INTO online VALUES ('$ip', $tagadtime)");}

$online_sql=mysql_query("SELECT * FROM online");
$online = intval(mysql_num_rows($online_sql));
echo '.: Onlainā: <b>'.$online.'</b> :.';
}

 

Ps. db connecting ir atsevishkji - ar to probleemu nav! Ierakstiit vinjsh ieraxta db tachu nedzeesh aaraa vecos... :(

Link to comment
Share on other sites

$expire = time() - 60;

 

$rezultats=mysql_query("DELETE FROM online WHERE stamp < $expire");

 

vai tev stamp = unisksiskais vai sql timestamps

taas ir divas atskiriigas lietas ;)

liidz ar to nekad rezultaats neizpildiisies :)

vai nav taa

 

20041230180251<1104458698

 

tobish SQL timestamps nekad nebuus mazaaks pa Uniksisko timestampu ;)

 

P.S. es domaju tieshi vai baazee naff noraadiitc ka tas ir SQL timestamps :)

Edited by Grey_Wolf
Link to comment
Share on other sites

×
×
  • Create New...