marsdenc Posted September 13, 2007 Share Posted September 13, 2007 i have the below code but i cant figure out how it works to track an ip when there are many ip's on the same network using it as it only gives the main ip and does not relate to individual users. can any one help? <?php extract($_POST, EXTR_PREFIX_SAME, "post_"); putenv("TZ=london"); $filename = 'statistics.txt'; $somecontent = date('[d/m/Y:H:i:s T O]')." ".$_SERVER['REMOTE_ADDR'].": ".$title.": ".$state."\n"; if (is_writable($filename)) { if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success, wrote ($somecontent) to IP log ($filename)"; fclose($handle); } else { echo "The file $filename is not writable"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/69166-please-help-im-a-little-stuck-and-new-to-php/ Share on other sites More sharing options...
phat_hip_prog Posted September 13, 2007 Share Posted September 13, 2007 A page is requested by a single user (from a single ip) and therefore each call is just a single instance. Hope this make things a little clearer? Unless their logged in or you can correlate from a lookup ip table then no you don't know who the user is, other than being identified by an ip (or other $_SERVER info), all of which can be falsified! Fun isn't it! Quote Link to comment https://forums.phpfreaks.com/topic/69166-please-help-im-a-little-stuck-and-new-to-php/#findComment-347633 Share on other sites More sharing options...
marsdenc Posted September 13, 2007 Author Share Posted September 13, 2007 so there is no way to track an individual ip on a network??? e.g the main ip is 11.111.111.11 but my individual i.p could be 11.111.111.12 Quote Link to comment https://forums.phpfreaks.com/topic/69166-please-help-im-a-little-stuck-and-new-to-php/#findComment-347635 Share on other sites More sharing options...
phat_hip_prog Posted September 13, 2007 Share Posted September 13, 2007 How do you mean track? Have a look at sessions, e.g. set a session cookie... This will be done a a per browser basis, for instance at times i'll use different browsers from same pc to test multi users from same ip. If you log the ip, browser details and session id then you'll start to have a bigger picture of what's going on! Quote Link to comment https://forums.phpfreaks.com/topic/69166-please-help-im-a-little-stuck-and-new-to-php/#findComment-347641 Share on other sites More sharing options...
marsdenc Posted September 13, 2007 Author Share Posted September 13, 2007 how do you write that code then??? as i said im new to php... Quote Link to comment https://forums.phpfreaks.com/topic/69166-please-help-im-a-little-stuck-and-new-to-php/#findComment-347646 Share on other sites More sharing options...
phat_hip_prog Posted September 13, 2007 Share Posted September 13, 2007 If your new, then you know you have a lot of reading to do then! First off you should always google for some tutorials, for instance you might find one here: http://www.tizag.com/phpT/phpsessions.php Another good thing to do is refer to the manual and search that e.g. http://uk.php.net/session Quote Link to comment https://forums.phpfreaks.com/topic/69166-please-help-im-a-little-stuck-and-new-to-php/#findComment-347650 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.