webtechatlantic Posted November 5, 2008 Share Posted November 5, 2008 Alright guys, so here is my problem. I have a very simple code i use to track the visitor's which access my website. It works perfectly fine on my own server. A client asked if it was possible for me to track the IP address's of visitors to her site, of course i said yes. Everything went fine for a month, then, all of a sudden the code just stopped working. I am at a complete blank. Here is the code i was using: <?php $ip=$_SERVER['REMOTE_ADDR']; $data = "$ip,\n"; $fh = fopen("pubs.txt", "a"); fwrite($fh, $data); fclose($fh); ?> Thet text file was named pubs.txt and i changed the persmissions to 666. Is there something I'm missing? The website in question is pyrrole.chemistry.dal.ca. I have a phpinfo at this link, so i know php still works. i can also still get and echo the remote address, i just can't open a file. This is phpinfo: http://pyrrole.chemistry.dal.ca/test/php.php I also made this test script: <?php $myFile = "test.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = "Bobby Bopper\n"; fwrite($fh, $stringData); $stringData = "Tracy Tanner\n"; fwrite($fh, $stringData); fclose($fh); ?> As you can see by going to http://pyrrole.chemistry.dal.ca/test/test.php, i recieve the can't open file error. Please someone help me, It would be very much appreciated. Thank you very much in advance. Link to comment https://forums.phpfreaks.com/topic/131433-fopen-fwrite-and-ip-address/ Share on other sites More sharing options...
trq Posted November 5, 2008 Share Posted November 5, 2008 A client asked if it was possible for me to track the IP address's of visitors to her site Why? Thats (part of) what Apache logs are for. Link to comment https://forums.phpfreaks.com/topic/131433-fopen-fwrite-and-ip-address/#findComment-682598 Share on other sites More sharing options...
l0ve2hat3 Posted November 5, 2008 Share Posted November 5, 2008 <?php $myFile = "test.txt"; if(file_exists($myFile))echo "you have a problem with permissions"; ?> if that code echos than you have a problem with permissions Link to comment https://forums.phpfreaks.com/topic/131433-fopen-fwrite-and-ip-address/#findComment-682604 Share on other sites More sharing options...
webtechatlantic Posted November 5, 2008 Author Share Posted November 5, 2008 I am only able to access the server via FTP. Is there a way to get Apache logs over ftp? And the code did echo. Where do i have to change permissions?? Link to comment https://forums.phpfreaks.com/topic/131433-fopen-fwrite-and-ip-address/#findComment-682613 Share on other sites More sharing options...
l0ve2hat3 Posted November 5, 2008 Share Posted November 5, 2008 your ftp program most likely has options to change file permissions.. if not try cuteftp Link to comment https://forums.phpfreaks.com/topic/131433-fopen-fwrite-and-ip-address/#findComment-682618 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.