You can create a log file in your web server, with a plain text (in txt format)
Try this code (tested with PHP 4.3.0)
$fp = fopen("$DOCUMENT_ROOT/include/logfile.txt","a");
$address=getenv ("REMOTE_ADDR");
$referer=$HTTP_SERVER_VARS['HTTP_REFERER'];
$visit=$HTTP_SERVER_VARS['REQUEST_URI'];
$browser=$HTTP_SERVER_VARS['HTTP_USER_AGENT'];
$date=date("l dS of FY h:i:s A");
$string = "IP ADDRESS : $address\tREFERER : $referer\tPAGE VISITED : $visit\tDATE : $date\tBROWSER = $browser\n";
fwrite($fp, $string);
fclose($fp);
?>
$DOCUMENT_ROOT is your root (e.g var/www/html/-->depend on your hosting setting)
named it as log.php an place in your /include/ directory, then create a plain log file in .txt format called "logfile.txt".
Create HT access in "nclude" directory so not everybody come and see your log file.
upload your log.php and logfile.txt. don't forget to chmod 755 specially for your log.txt.
place this php code:
include ("$DOCUMENT_ROOT/include/log.php");
?>
Your log file is done...
You can download a free php ebooks or free mysql ebooks from free programming ebooks and free computer ebooks site : http://free-itebooks.com
.
Don't forget to check our french classic furniture site and our indoor furniture and outdoor furniture site, our garden patio, teak bench, teak armoire is made from high quality teak. Or you can see our other teak colonial furniture, colonial furniture, garden furniture at the best and negotiable price.
Tuesday, July 20, 2004
Create PHP log file in your site with plain text
Posted by rakalap at Tuesday, July 20, 2004
Subscribe to:
Post Comments (Atom)
1 comments:
hii..
you forgot to place <?php in the beginning of your file..
don't forget to check free programming ebooks or free programming ebook before you post another comment.
Post a Comment