Shaned145 Posted March 29, 2008 Share Posted March 29, 2008 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 More sharing options...
mkoga Posted March 29, 2008 Share Posted March 29, 2008 It seems like you're trying to re-create the server logs. You should check those out to see if it has everything you need. Link to comment https://forums.phpfreaks.com/topic/98448-php-ip-logger-help/#findComment-503827 Share on other sites More sharing options...
Shaned145 Posted March 29, 2008 Author Share Posted March 29, 2008 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 More sharing options...
mkoga Posted March 29, 2008 Share Posted March 29, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.