On Fri, 10 May 2002, Josh Edwards wrote:
> I'm working on using php to analyse an access log on an apache server.
> If a user inputs a file path I want to be able to use PHP to determine if
> it's a log file. Is there a function that will reject if it's not a binary
> file. If it's a binary file how would I then
> compare it to whats expected in a log file.
1. Apache logs are text files.
2. The difference between a binary file and a text file is not something
that can be observed, only declared. Well, it can be observed by humans,
but not by machines. Who knows how picky a given application is going to
be about line endings? Who knows what text encodings are valid in the
3. The format for Apache log files depends on the configuration of the
server (directives like LogFormat).
4. If you know the configuration of the server, then it's trivial to
determine whether you have a valid log file. If the first column is
supposd to be an IP address, check for an IP address. If the fourth column
is supposed to be a date, check for a date.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php