everett 0 Report post Posted March 19, 2006 i have made a script to find your ip <?$ip = getenv('REMOTE_ADDR'); ?> i have been thinking of turning it in to a ip logger but i need help with writeing the ip's to a html file can anyone help me Share this post Link to post Share on other sites
jmb2006 0 Report post Posted March 19, 2006 <?php$ip = $REMOTE_ADDR;$host = gethostbyaddr($ip);$file = "file.html";if (is_writable($file)) {$outfile = fopen($file, "a+");$input = "<font face=\"arial\" size=\"3\"><b>IP:</b> $ip<br><b>Host:</b> $host";fputs($outfile, "\r\n$input");fclose($outfile);}else {print "File \"$file\" is not writable check permissions.";}?> there ya go Share this post Link to post Share on other sites
everett 0 Report post Posted March 19, 2006 (edited) thank you very much i changed the permissions to write all but it says it does not have write permissions Edited March 19, 2006 by everett (see edit history) Share this post Link to post Share on other sites
jmb2006 0 Report post Posted March 19, 2006 ok then try this: <?php$ip = $REMOTE_ADDR;$host = gethostbyaddr($ip);$file = "file.html";if (is_writable($file)) {$outfile = fopen($file, "a+");$input = "<font face=\"arial\" size=\"3\"><b>IP:</b> $ip<br><b>Host:</b> $host";fputs($outfile, "\r\n$input");fclose($outfile);}else {print "File \"$file\" is not writable check permissions.";chmod($file, 0777);}?> if you get the error again refresh the page. Share this post Link to post Share on other sites
everett 0 Report post Posted March 19, 2006 ok then try this: <?php$ip = $REMOTE_ADDR;$host = gethostbyaddr($ip);$file = "file.html";if (is_writable($file)) {$outfile = fopen($file, "a+");$input = "<font face=\"arial\" size=\"3\"><b>IP:</b> $ip<br><b>Host:</b> $host";fputs($outfile, "\r\n$input");fclose($outfile);}else {print "File \"$file\" is not writable check permissions.";chmod($file, 0777);}?> if you get the error again refresh the page.i get a error sayingthat there is no file called ip.html Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted March 19, 2006 Check to see if the file exists [file_exists()] before start this procedure. Share this post Link to post Share on other sites
jmb2006 0 Report post Posted March 19, 2006 (edited) :sigh: ok try this then: <?php$ip = $REMOTE_ADDR;$host = gethostbyaddr($ip);$file = "file.html";if (file_exists($file)) {if (is_writable($file)) {$outfile = fopen($file, "a+");$input = "<font face=\"arial\" size=\"3\"><b>IP:</b> $ip<br><b>Host:</b> $host</font><br><br>";fputs($outfile, "\r\n$input");fclose($outfile);}else {print "File \"$file\" is not writable check permissions.";chmod($file, 0777);}}else {print "The file doesn't exist, creating it now. Please Refresh the page.";touch($file);chmod($file, 0777);}?> Edited March 19, 2006 by james_666 (see edit history) Share this post Link to post Share on other sites
everett 0 Report post Posted March 19, 2006 (edited) :sigh: ok try this then: <?php$ip = $REMOTE_ADDR;$host = gethostbyaddr($ip);$file = "file.html";if (file_exists($file)) {if (is_writable($file)) {$outfile = fopen($file, "a+");$input = "<font face=\"arial\" size=\"3\"><b>IP:</b> $ip<br><b>Host:</b> $host</font><br><br>";fputs($outfile, "\r\n$input");fclose($outfile);}else {print "File \"$file\" is not writable check permissions.";chmod($file, 0777);}}else {print "The file doesn't exist, creating it now. Please Refresh the page.";touch($file);chmod($file, 0777);}?> i got a error againWarning: touch(): Unable to create file ip.html because Permission denied in /home/everett1/public_html/index.php on line 19Warning: chmod(): No such file or directory in /home/everett1/public_html/index.php on line 20would it help if you had the site address Edited March 19, 2006 by everett (see edit history) Share this post Link to post Share on other sites
jmb2006 0 Report post Posted March 19, 2006 (edited) go up to the directory /home/everett1 and chmod the folder public_html to 755 or 777, one of em has to work, but try 755 first. Edited March 19, 2006 by james_666 (see edit history) Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted March 19, 2006 create a file and test to see if it works then Share this post Link to post Share on other sites
everett 0 Report post Posted March 19, 2006 yes it worked it had to be set to 777thank you so much Share this post Link to post Share on other sites