daviskrex Posted April 9, 2009 Report Share Posted April 9, 2009 Sveiki, ilgi domāju kā uztaisīt skriptu, kas nolasa nevis no mysql online jūzerus, bet tos, kas sēž anonīmi mājas lapā(tā sauktie viesi). es būtu nežēlīgi pateicīgs, ja kāds zinātu un nebūtu slinkums iemest man ar skriptu. Link to comment Share on other sites More sharing options...
ANALGINS Posted April 9, 2009 Report Share Posted April 9, 2009 mekle ka to dara ipb Link to comment Share on other sites More sharing options...
kent_ Posted April 9, 2009 Report Share Posted April 9, 2009 Varbut teu palidzes šitais Šeit Link to comment Share on other sites More sharing options...
GOMA smile Posted April 9, 2009 Report Share Posted April 9, 2009 Es domāju kent ir pelnijis atvaļinājumu, jo es domāju ka tur nav nekā kas palīdzētu. google ir pilns ar tādiem pats savu laiku meklēju Link to comment Share on other sites More sharing options...
daviskrex Posted April 9, 2009 Author Report Share Posted April 9, 2009 (edited) GOMA smile said: Tur nu es tev pietkrītu. Piedod, bet googlē neko nevarēju atrast. Paprasīju draugam ideju un uzcepu pats. Ja kādam vajag [ŠITAIS INDEX.PHP SĀKUMĀ] $ip = $_SERVER['REMOTE_ADDR']; $mekle = mysql_query("SELECT * FROM online WHERE ip='$ip'"); $skaita = mysql_num_rows($mekle); $time = time(); $timelast = time()-60; if ($skaita > 0) { $q = mysql_query("UPDATE online SET time='$time' WHERE ip='$ip'"); } else { $q = mysql_query("INSERT INTO online VALUES ('', '$ip', '".time()."')"); if(!$q) { print mysql_error(); } } $qf = mysql_query("DELETE FROM online WHERE time<$timelast"); [ONLINE.PHP] $mekle2 = mysql_query("SELECT * FROM online"); $skaita2 = mysql_num_rows($mekle2); print "Viesi online: "; print $skaita2; Edited April 9, 2009 by daviskrex Link to comment Share on other sites More sharing options...
X ID Posted April 10, 2009 Report Share Posted April 10, 2009 2 piebildes: 1) IP glabāt kā integer, nevis varchar 2) Laikus apstrādāt datubāzes pusē, nevis php Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now