Backend Development

Log IP:s with PHP

Submitted by YokoLit, , Thread ID: 44745

Thread Closed
YokoLit
Novice
Level:
0
Reputation:
0
Posts:
22
Likes:
0
Credits:
1
20-08-2017, 05:01 PM
This post was last modified: 23-08-2017, 04:57 PM by YokoLit
#1
Code:
[code]$line = date('Y-m-d H:i:s') . " - $_SERVER[REMOTE_ADDR]";
file_put_contents('visitors.log', $line . PHP_EOL, FILE_APPEND);



Requirements

Webhost with php support.


How to add?
Add this between php codes, and it will log ips of people who visit your website.[/code]

RE: Log IP:s with PHP

Sozin
Nan Ihier Gelair Mordor
Divine
Level:
0
Reputation:
91
Posts:
2.33K
Likes:
375
Credits:
11K
21-08-2017, 10:07 AM
#2
I don;t think you should hide such posts.
Do not let your difficulties fill you with anxiety, after all it is only in the darkest nights that stars shine more brightly. - Ali(a.s)

Developer( PHP, Python, C++, HTML+CSS, JS I am available for Hire. Message Me for details.

RE: Log IP:s with PHP

PhucedMODZ
Banned without appealing rights
Level:
0
Reputation:
9
Posts:
64
Likes:
48
Credits:
863
23-08-2017, 04:46 AM
#3
20-08-2017, 05:01 PM
YokoLit Wrote:
Content has been stripped. Go to the quoted post to view the content.


Requirements

Webhost with php support.


How to add?
Add this between php codes, and it will log ips of people who visit your website.

may i ask the need to hide a post that is a tutorial?

RE: Log IP:s with PHP

YokoLit
Novice
Level:
0
Reputation:
0
Posts:
22
Likes:
0
Credits:
1
OP
30-08-2017, 04:10 PM
#4
I removed the hide, better now?

RE: Log IP:s with PHP

Drem4y
Closed Account
Level:
0
Reputation:
0
Posts:
3
Likes:
0
Credits:
3
27-02-2018, 06:59 AM
#5
where i can find the log file if it is creating it ?

RE: Log IP:s with PHP

m4ko
Novice
Prime
Level:
0
Reputation:
0
Posts:
30
Likes:
2
Credits:
4
08-03-2018, 08:59 PM
#6
You could make this script even better by adding Browser and OS in your log aswell.

RE: Log IP:s with PHP

LETHALMAN
Newbie
Level:
0
Reputation:
0
Posts:
18
Likes:
0
Credits:
18
07-02-2020, 05:29 PM
#7
Congratulations on your posts, great sharing bro, I wish these types of posts continue.

RE: Log IP:s with PHP

emhusnan
Newbie
Level:
0
Reputation:
0
Posts:
15
Likes:
0
Credits:
14
10-02-2020, 04:33 PM
#8
What happen with client proxy? or when it inside load balancer?

Users browsing this thread: 1 Guest(s)