Post: Client IP logged and saved to .txt Help
01-31-2016, 05:34 AM #1
Devious
Treasure hunter
(adsbygoogle = window.adsbygoogle || []).push({}); So im trying to make this code work and i watched several videos about this and i have no clue to what is the problem. heres the code.

    <?php

$IP = $_SERVER[“REMOTE_ADDR”];

$file = fopen “iplog.txt”;

$txtfile = fopen($file, “a”);

fwrite($txtfile, $IP);
fwrite($txtfile, “
“);
fclose($txtfile);
$message = “Your IP Has Been Logged It Is:”;
echo $message; echo $IP;
?>


I have the folder saved as ip.php and the iplog.txt next to the ip.php in the php folder
Help anyone?
(adsbygoogle = window.adsbygoogle || []).push({});
02-01-2016, 10:06 PM #11
Devious
Treasure hunter
Originally posted by MEGALELZ
Are you doing this locally or via a website?

My website
02-01-2016, 10:14 PM #12
Devious
Treasure hunter
Originally posted by MEGALELZ
I think its the way your PHP or something must be set up because the exact same code works for me : You must login or register to view this content. (IP LOGGER. IP LOGGER. IP LOGGER. )


Sal well my site has a template so I don't know if that destroys anything I wanna post my site but I don't wanna get a time out for advertising again..like its my personal site no forum
02-18-2016, 01:57 AM #13
CyberNomadic
Web Developer
Originally posted by Devious View Post
So im trying to make this code work and i watched several videos about this and i have no clue to what is the problem. heres the code.

    <?php

$IP = $_SERVER[“REMOTE_ADDR”];

$file = fopen “iplog.txt”;

$txtfile = fopen($file, “a”Winky Winky;

fwrite($txtfile, $IP);
fwrite($txtfile, “
Winky Winky;
fclose($txtfile);
$message = “Your IP Has Been Logged It Is:”;
echo $message; echo $IP;
?>


I have the folder saved as ip.php and the iplog.txt next to the ip.php in the php folder
Help anyone?


Make sure to CHMOD (Set the file permissions) for the PHP file and the text document.

The following user thanked CyberNomadic for this useful post:

0x01
02-18-2016, 02:16 AM #14
Devious
Treasure hunter
Originally posted by CyberNomadic View Post
Make sure to CHMOD (Set the file permissions) for the PHP file and the text document.


How will I do that? Gasp
I'll ger back to it once im done with this final year of highschool Smile
02-18-2016, 02:46 AM #15
CyberNomadic
Web Developer
Originally posted by Devious View Post
How will I do that? Gasp
I'll ger back to it once im done with this final year of highschool Smile


In FTP, there should be a column like this: You must login or register to view this content.
Just click on the number of the corresponding file(s). Try 755 on both files, and if that doesn't work then 777
02-20-2016, 05:37 AM #16
Specter
Pro Memer
Seems like everything has been answered, I'm going to close this, OP pm me if otherwise =D

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo