php-n00b Posted September 24, 2009 Share Posted September 24, 2009 What's Up? OK, So i currently use this script off the internet. <?php $logfile= 'logged.html'; $IP = $_SERVER['REMOTE_ADDR']; $logdetails= date("F j, Y, g:i a") . ': ' . '<a href=http://dnsstuff.com/tools/city.ch?ip='.$_SERVER['REMOTE_ADDR'].'>'.$_SERVER['REMOTE_ADDR'].'</a>'; $fp = fopen($logfile, "a"); fwrite($fp, $logdetails); fwrite($fp, "<br>"); fclose($fp); ?> But i'll be getting loats of visits from the same IP, So instead of trolling thorough some sort of text dungeon i wondered if there was a way to update the prevoius entry of that iP, So if a new IP visited then it would be logged to a new line but if the same one visited it would just update the time and date. Quote Link to comment https://forums.phpfreaks.com/topic/175416-ip-logging/ Share on other sites More sharing options...
mikesta707 Posted September 24, 2009 Share Posted September 24, 2009 it would be much easier if you used a mysql table rather than a text file Quote Link to comment https://forums.phpfreaks.com/topic/175416-ip-logging/#findComment-924411 Share on other sites More sharing options...
php-n00b Posted September 24, 2009 Author Share Posted September 24, 2009 it would be much easier if you used a mysql table rather than a text file Is it still possible in PHP? Quote Link to comment https://forums.phpfreaks.com/topic/175416-ip-logging/#findComment-924414 Share on other sites More sharing options...
mikesta707 Posted September 24, 2009 Share Posted September 24, 2009 yes, have you used PHP's mysql functions at all? Quote Link to comment https://forums.phpfreaks.com/topic/175416-ip-logging/#findComment-924415 Share on other sites More sharing options...
php-n00b Posted September 24, 2009 Author Share Posted September 24, 2009 yes, have you used PHP's mysql functions at all? Ouch! Nah, How hard is it to do in mysql? Quote Link to comment https://forums.phpfreaks.com/topic/175416-ip-logging/#findComment-924417 Share on other sites More sharing options...
mikesta707 Posted September 24, 2009 Share Posted September 24, 2009 ahh ok. It is quite easy, not any harder than writing to files, you will just have to get used to queries and such. Here is a tutorial on it. Quote Link to comment https://forums.phpfreaks.com/topic/175416-ip-logging/#findComment-924419 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.