

One website has .log system, one of them:
beside for know who is visitors, log file is very helpful to security analysis, I will giving some log file using script PHP system:
Script System LOG with FLAT FILE:
Quote:
/* this is for seeing browser type $agent = $_SERVER['HTTP_USER_AGENT']; /* this is for looking script at execution from where GET(URL) $uri = $_SERVER['REQUEST_URI']; /* this is for looking IP visitor $ip = $_SERVER['REMOTE_ADDR']; /* This is for looking script at refer from some place $ref = $_SERVER['HTTP_REFERER']; /* This is for looking Proxy from visitor $asli = $_SERVER['HTTP_X_FORWARDED_FOR']; /* This is for looking visitor connection $via = $_SERVER['HTTP_VIA']; /* This is for date variable $dtime = date('r'); /* ATTENTION: If visitor using Proxy transparent /* So $_SERVER['HTTP_X_FORWARDED_FOR'] will be showing real IP from visitors /* But $_SERVER['REMOTE_ADDR'] only showing Proxy and not real IP visitor /* This is for description variabel entry_line: $entry_line = "Time: $dtime | Real IP: $ip | Browser: $agent | URL: $uri | Referrer: $ref | Proxy: $asli | Connection: $via "; /* <-- ATTENTION!! It must be new line or enter once again to be new line /* "fopen()" This funcion to open file, "a" it is more important. /* This function will be active if file "jejak.txt" doesn't has in server so PHP will be creating $fp = fopen("jejak.txt", "a"); /* "fputs()" This function to writing log in file fputs($fp, $entry_line); /* "fclose()" This function to closing file fclose($fp); ?> |
The function from php System LOG with FLAT FILE , This is more useful for me more than using MySql.

No comments:
Post a Comment