Halihallo W3C
es soll dann am Schluss da stehen wie viele User oder Ips gestern auf der Seite waren... ohne MySQL...
User oder Ips? - Über eine einzige IP können 20000 User einloggen und "User" sind im
Internet weitestgehend unbekannt. Die naheliegenste Möglichkeit einen "User" zu
identifizieren ist über einen Cookie. Aber nicht jeder hat Cookies aktiviert und somit
ist auch hier keine 100% Identifikation möglich.
Der Sinn von Counter wurde bereits hinreichend im Archiv besprochen. Hier noch ein
kleiner Auszug aus perlfaq5 - I still don't get locking. I just want to increment the
number in the file. How can I do this?
<quote>
Didn't anyone ever tell you web-page hit counters were useless? They don't count number
of hits, they're a waste of time, and they serve only to stroke the writer's vanity.
It's better to pick a random number; they're more realistic.
Anyway, this is what you can do if you can't help yourself.
use Fcntl qw(:DEFAULT :flock);
sysopen(FH, "numfile", O_RDWR|O_CREAT) or die "can't open numfile: $!";
flock(FH, LOCK_EX) or die "can't flock numfile: $!";
$num = <FH> || 0;
seek(FH, 0, 0) or die "can't rewind numfile: $!";
truncate(FH, 0) or die "can't truncate numfile: $!";
(print FH $num+1, "\n") or die "can't write numfile: $!";
close FH or die "can't close numfile: $!";Here's
a much better web-page hit counter:
$hits = int( (time() - 850_000_000) / rand(1_000) );If the count doesn't impress
your friends, then the code might. :-)
</quote>
Nun ja, falls du immer noch interessiert bist:
Analysiere die access_log oder
schreibe ein Script, dass die Benutzer loggt. Dann ein anderes Script, welches diese
log ausliest, nur die von gestern zählt, gleiche user nur einmal und die Anzahl
unterschiedlicher User ausgibt.
Viele Grüsse
Philipp
RTFM! - Foren steigern das Aufkommen von Redundanz im Internet, danke für das lesen der Manuals.
Selbstbedienung! - Das SelfForum ist ein Gratis-Restaurant mit Selbstbedienung, Menüangebot steht in den </faq/> und dem </archiv/>.