Jump to content
xisto Community
everett

Help With Geting Your Ip With A Script And Loging It

Recommended Posts

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
<?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

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

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 saying
that there is no file called ip.html

Share this post


Link to post
Share on other sites

: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 by james_666 (see edit history)

Share this post


Link to post
Share on other sites

: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 again

Warning: touch(): Unable to create file ip.html because Permission denied in /home/everett1/public_html/index.php on line 19

Warning: chmod(): No such file or directory in /home/everett1/public_html/index.php on line 20
would it help if you had the site address
Edited by everett (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.