• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[PHP] Getting IP Addresse.

Jesper_Kladden

Donator
Joined
May 16, 2008
Messages
458
Reaction score
1
Location
Sweden
Could someone mind posting me a fully working PHP script that could just be entered inside the index.html and it would place the IP Of the visitors inside a text document?
 
Try this:

PHP:
$ip = $_SERVER['REMOTE_ADDR'];
$string = "$ip ::";
$a = fopen("online.txt", "a");
fputs($a, $string);
fclose($a);
 
Notice: You need to edit this .html file to a .php file for this script above to work.
 
if linux
/var/log/apache2 (if you are using apache2)
there you can find the access/error logs idk if theres a dir for that on winblo
 
Notice: You need to edit this .html file to a .php file for this script above to work.

That's true, I am not familiar with this.

Do I have to change it to .php ?

B'cuz the whole code is already written in HTML <.<

Thanks pitufo, it works.

But now I've got a problem.

I must set the permission so everyone can edit it, otherwise it wont work :(


@Empty, Thanks for merging, didn't think of double posting. Sorry!

@Snel Puppie, I dunno. But as I understood it I had to change the file name from *.html to *.php. I just added this code over and under it :

<?php
-Code-
?>
 
Last edited:
Could you explain a bit further? You want people to be able to edit the ip logs? Like remove them from the .txt file etc?
 
Back
Top