Answer the question
In order to leave comments, you need to log in
How to find out the IP of a person who entered your site using JS?
I want to find out the IP of the site visitor, and then use the IP to determine the city. Task for the online store. There are many solutions in PHP, but are there any in JavaScript ???
Answer the question
In order to leave comments, you need to log in
You can try that.
Here I took into account cases when the exit time is greater than the entry time.
SELECT userGUID, areaGUID, timeHappened AS times
FROM users in_u
LEFT JOIN users out_u
ON out_u.userGUID = in_u.userGUID
AND out_u.areaGUID = in_u.areaGUID
AND out_u.inOut = 2
AND out_u.timeHappened > in_u.timeHappened
WHERE in_u.inOut = 1
AND out_u.inOut IS NULL
ORDER BY userGUID, areaGUID
For each user, determine the maximum time record and filter out those who have inOut = 1
.
who are currently in the zones and have not left it yet?
No way on bare js.
But if there is such a task, you can use a similar crap https://javascript.ru/forum/misc/2272-opredelenie-...
Just make an API request to the server, which will return the required data.
For example, you can pull it from Yandex maps
https://api-maps.yandex.ru/2.0-stable/?load=package.standard&lang=ru-RU
Node.js can in the definition of IP, google it. Php doesn't do it on the client anyway)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question