Backend Development

Log IP:s with PHP

Submitted by YokoLit, , Thread ID: 44745

Thread Closed
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

#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

#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

OP
#4
I removed the hide, better now?

RE: Log IP:s with PHP

#5
where i can find the log file if it is creating it ?

RE: Log IP:s with PHP

#6
You could make this script even better by adding Browser and OS in your log aswell.

RE: Log IP:s with PHP

#7
Congratulations on your posts, great sharing bro, I wish these types of posts continue.

RE: Log IP:s with PHP

#8
What happen with client proxy? or when it inside load balancer?

Users browsing this thread: 1 Guest(s)