In case you need to log something in a concrete PHP script you can do something as follows:
$queryString=$_SERVER['QUERY_STRING'];
$userIP = $_SERVER['REMOTE_ADDR'];
$myfile = fopen("my_log.txt", "a") or die("Unable to open file!");
$txt = $queryString;
fwrite($myfile, "\n".date("Y-m-d h:i:sa")." - ".$queryString." - ".$userIP);
fclose($myfile);
Like that we can log from what IP visits are coming and the query string coming in the request.
No comments:
Post a Comment