Gather Viewers IP
-
01-07-2021 - |
Вопрос
I want to know how to get the IP address of visitors to my site. I will then put this into an SQL table that will count how many times they visit. I know PHP, JavaScript, HTML, and MySQL so I just need to know what the code for getting a viewer's IP is, I can code the rest myself.
Thanks in advance for the help.
Решение
You can get the user's IP address by accessing the $_SERVER array:
echo $_SERVER['REMOTE_ADDR'];
Другие советы
$_SERVER['REMOTE_ADDR'];
Just look in the $_SERVER
variable.
That should have all the info you need.
Не связан с StackOverflow