Dear all,
i did a logfile inside my login.php. i also created a logfile.txt. However, when i login and logout, there is nothing wrote inside the logfile.txt. Can anybody give me some comments?
This is the scripts:
$logfile = "http://192.168.0.220/cms/logfile.txt";
$timezone = "+0800";
$lookup_size = false;
$document_root = "http://192.168.0.220/cms/";
$default_document = "index.php";
$h = $REMOTE_ADDR;
$l = "-";
$u = "-";
$t = gmdate("d/M/Y:H:i:s");
$t = "[$t $timezone]";
$r = '"'. $REQUEST_METHOD . " " . $REQUEST_URI . " " . $SERVER_PROTOCOL . '"';
$r = "\"$REQUEST_METHOD $REQUEST_URI HTTP/1.0\"";
$s = "200";
$referrer = "\"$HTTP_REFERER\"";
$headers = getallheaders();
$agent = '"' . $headers['User-Agent'] . '"';
$fp = fopen($logfile, "a");
$log = "$h $l $u $t $r $s $b $referrer $agent\n";
fwrite($fp, $str);
fclose($fp);
*the desire output in the logfile are who use the system, when login, when logout. what action had done such as add, delete or modify.
thank you.