Jump to content

Recommended Posts

Ive written a basic IP logger for my site. But I want it to be able to also write in the text file what directories they accessed. Is this possible? Please, I need all the help I can get. Thanks in advance!

 

My IP logger script:

<?
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("l d F H:i:s");
$fp = fopen("ips.txt", "a");
fputs($fp, "IP: $ip - Date: $date\n");
fclose($fp);
?> 

Link to comment
https://forums.phpfreaks.com/topic/98448-php-ip-logger-help/
Share on other sites

I guess I am, but I want it all compiled within a text document. It might be stupid for me asking on how to do this, but I would like my PHP script to do what I want it to do. Using the server logs is something I'll probably never open up vs. a text document I would rather open up and use. Just my opinion....

Link to comment
https://forums.phpfreaks.com/topic/98448-php-ip-logger-help/#findComment-503829
Share on other sites

You're definitely open to do what you want, but here's a suggestion. Server logs are generally stored in a text file in real time. I've used this script here: http://www.hotscripts.com/Detailed/53017.html to parse through the logs and extract only the data I want. This can be done once a day or as often as you want. This is better than saving to a text file every time someone views a webpage. Also this is essentially what the web server is doing every request anyway.

Link to comment
https://forums.phpfreaks.com/topic/98448-php-ip-logger-help/#findComment-503830
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.