[Gelöst] IP und Uhrzeit des Webseitenzugriffs loggen
Moderator: Moderatoren für Deutsches X-Forum
-
- Posts: 2355
- Joined: Sun, 25. Apr 04, 19:09
[Gelöst] IP und Uhrzeit des Webseitenzugriffs loggen
Weis jmd wie man über ein Script auf einer Webseite die IP und die Uhrzeit in eine Logdatei schreiben kann? bzw.wie man diese in irgendeiner Art und Weise speichern kann?
Last edited by XGamer on Mon, 18. Jul 05, 23:19, edited 1 time in total.
X:BtF: 7/10 | X2: 8/10 | X3:R/TC/AP: 8/10 | X:R: 3/10 | X4: 0/10 (3 points for split ships and stations, 4.0 -> -50 points).
If you are raising pirate activity, give me meaningful ways to deal with them PERMANENTLY. Better things to do than replacing ships every 10 minutes, or babysitting ships getting harassed.
Stopped playing X4 with 4.0 due to outrageous, needless and pointless nerfs to everything. Don't change what wasn't broken in the first place.
If you are raising pirate activity, give me meaningful ways to deal with them PERMANENTLY. Better things to do than replacing ships every 10 minutes, or babysitting ships getting harassed.
Stopped playing X4 with 4.0 due to outrageous, needless and pointless nerfs to everything. Don't change what wasn't broken in the first place.
Welchen Script meinsten genau? Mit PHP wär dann zum Beispiel der Code:
Kennst dich mit PHP aus?
Code: Select all
$refer = $HTTP_REFERER ;
$browser = $_SERVER["HTTP_USER_AGENT"] ;
$ip = $_SERVER["REMOTE_ADDR"] ;
if (
stristr ($browser, "Windows")
)
$OS = Windows;
elseif (
stristr ($browser, "Linux")
)
$OS = Linux;
else $OS = "Unbekannt";
-
- Posts: 2355
- Joined: Sun, 25. Apr 04, 19:09
Nun die Sprache ist mir eigentlich egal. Hauptsache ich bekomme eine Logdatei mit den IP-Addressen und der jeweiligen Uhrzeit des Zugriffes auf die Webseite.
Und nein mit PHP kenne ich mich bislang nicht aus. Aber wenn ich das richtig verstanden habe dann überprüft der Code das Betriebssystem und speichert die IP in eine Variable. Richtig?
Falls ja dann müsste man die Variable jetzt nur noch irgendwie dauerhaft in eine Datei / MySQL Datenbank Tabelle abspeichern
Und nein mit PHP kenne ich mich bislang nicht aus. Aber wenn ich das richtig verstanden habe dann überprüft der Code das Betriebssystem und speichert die IP in eine Variable. Richtig?
Falls ja dann müsste man die Variable jetzt nur noch irgendwie dauerhaft in eine Datei / MySQL Datenbank Tabelle abspeichern
X:BtF: 7/10 | X2: 8/10 | X3:R/TC/AP: 8/10 | X:R: 3/10 | X4: 0/10 (3 points for split ships and stations, 4.0 -> -50 points).
If you are raising pirate activity, give me meaningful ways to deal with them PERMANENTLY. Better things to do than replacing ships every 10 minutes, or babysitting ships getting harassed.
Stopped playing X4 with 4.0 due to outrageous, needless and pointless nerfs to everything. Don't change what wasn't broken in the first place.
If you are raising pirate activity, give me meaningful ways to deal with them PERMANENTLY. Better things to do than replacing ships every 10 minutes, or babysitting ships getting harassed.
Stopped playing X4 with 4.0 due to outrageous, needless and pointless nerfs to everything. Don't change what wasn't broken in the first place.
-
- Posts: 1041
- Joined: Fri, 11. Jun 04, 14:06
Ok, dann mach ich mal den zweiten Teil von sandors Script in PHP:
Code: Select all
$fh = fopen('log.txt', 'a+');
fputs($fh, "$ip\t$browser\t$OS\t$refer\n");
fclose($fh);
Erst, wenn man dreimal auf Holz klopfen will, stellt man fest, dass die Welt nur noch aus Plastik und Aluminium besteht.
-
- Posts: 2355
- Joined: Sun, 25. Apr 04, 19:09
Code: Select all
$refer = $HTTP_REFERER ;
$browser = $_SERVER["HTTP_USER_AGENT"] ;
$ip = $_SERVER["REMOTE_ADDR"] ;
if (
stristr ($browser, "Windows")
)
$OS = Windows;
elseif (
stristr ($browser, "Linux")
)
$OS = Linux;
else $OS = "Unbekannt";
Code: Select all
$fh = fopen('log.txt', 'a+');
fputs($fh, "$ip\t$browser\t$OS\t$refer\n");
fclose($fh);
X:BtF: 7/10 | X2: 8/10 | X3:R/TC/AP: 8/10 | X:R: 3/10 | X4: 0/10 (3 points for split ships and stations, 4.0 -> -50 points).
If you are raising pirate activity, give me meaningful ways to deal with them PERMANENTLY. Better things to do than replacing ships every 10 minutes, or babysitting ships getting harassed.
Stopped playing X4 with 4.0 due to outrageous, needless and pointless nerfs to everything. Don't change what wasn't broken in the first place.
If you are raising pirate activity, give me meaningful ways to deal with them PERMANENTLY. Better things to do than replacing ships every 10 minutes, or babysitting ships getting harassed.
Stopped playing X4 with 4.0 due to outrageous, needless and pointless nerfs to everything. Don't change what wasn't broken in the first place.
Jup, und Datum/Uhrzeit bekommst du mit
Für andere Formatierung guckst du: http://www.php.net/date
Einfach $date noch mit bei fputs reinschreiben.
Code: Select all
$date = date("d.m.Y, H:i:s");
Einfach $date noch mit bei fputs reinschreiben.
-
- Posts: 2355
- Joined: Sun, 25. Apr 04, 19:09
OK wie kann ich in php auf eine andere Seite weiterleiten? Denn nach dem Log soll der User ja auf die eigentliche Seite kommen.
Ach und kann man aufm Server überhaupt Dateien erstellen?
Denn wenn nicht würde das fputs ja in die Leere laufen oder einen Fehler produzieren.
Ach und kann man aufm Server überhaupt Dateien erstellen?

Denn wenn nicht würde das fputs ja in die Leere laufen oder einen Fehler produzieren.
X:BtF: 7/10 | X2: 8/10 | X3:R/TC/AP: 8/10 | X:R: 3/10 | X4: 0/10 (3 points for split ships and stations, 4.0 -> -50 points).
If you are raising pirate activity, give me meaningful ways to deal with them PERMANENTLY. Better things to do than replacing ships every 10 minutes, or babysitting ships getting harassed.
Stopped playing X4 with 4.0 due to outrageous, needless and pointless nerfs to everything. Don't change what wasn't broken in the first place.
If you are raising pirate activity, give me meaningful ways to deal with them PERMANENTLY. Better things to do than replacing ships every 10 minutes, or babysitting ships getting harassed.
Stopped playing X4 with 4.0 due to outrageous, needless and pointless nerfs to everything. Don't change what wasn't broken in the first place.
Code: Select all
header("Location: <url der seite>");
Wenn der Befehl nicht deaktiviert wurde geht das. Ansonsten könnte man das auch in eine mySQL DB schreiben.
-
- Posts: 2355
- Joined: Sun, 25. Apr 04, 19:09
Also ich habe das jetzt alles so in eine .php Datei eingefügt und wenn ich das dann online ausprobieren will dann bekomme ich den Quellcode die php Datei zu sehen aber nichts weiter. Eigentlich müsste die Php Datei ja garnich auffallen.
EDIT: Das würde dann wie aussehen?
EDIT: Das würde dann wie aussehen?
X:BtF: 7/10 | X2: 8/10 | X3:R/TC/AP: 8/10 | X:R: 3/10 | X4: 0/10 (3 points for split ships and stations, 4.0 -> -50 points).
If you are raising pirate activity, give me meaningful ways to deal with them PERMANENTLY. Better things to do than replacing ships every 10 minutes, or babysitting ships getting harassed.
Stopped playing X4 with 4.0 due to outrageous, needless and pointless nerfs to everything. Don't change what wasn't broken in the first place.
If you are raising pirate activity, give me meaningful ways to deal with them PERMANENTLY. Better things to do than replacing ships every 10 minutes, or babysitting ships getting harassed.
Stopped playing X4 with 4.0 due to outrageous, needless and pointless nerfs to everything. Don't change what wasn't broken in the first place.
-
- Posts: 2128
- Joined: Thu, 2. Jan 03, 19:55
-
- Posts: 2355
- Joined: Sun, 25. Apr 04, 19:09
Alles klar es funktioniert nun! Vielen Dank an euch alle.
X:BtF: 7/10 | X2: 8/10 | X3:R/TC/AP: 8/10 | X:R: 3/10 | X4: 0/10 (3 points for split ships and stations, 4.0 -> -50 points).
If you are raising pirate activity, give me meaningful ways to deal with them PERMANENTLY. Better things to do than replacing ships every 10 minutes, or babysitting ships getting harassed.
Stopped playing X4 with 4.0 due to outrageous, needless and pointless nerfs to everything. Don't change what wasn't broken in the first place.
If you are raising pirate activity, give me meaningful ways to deal with them PERMANENTLY. Better things to do than replacing ships every 10 minutes, or babysitting ships getting harassed.
Stopped playing X4 with 4.0 due to outrageous, needless and pointless nerfs to everything. Don't change what wasn't broken in the first place.