Get User IP Address

I am building in a log file of dashboard logins by inserting a record into a table on login. I’d like to be able to record the user’s IP address. I have done this before using the DMX extensions but can’t tseem to find a way in Wappler?

1 Like

@brad, see if this might help you out. If it can be done in PHP, it can probably be done in Wappler

1 Like

Thanks @scott! I was able to figure it out based on info in that post.

@brad I tried doing what the post suggested and created a _SERVER variable called: REMOTE_ADDR

However, this seems to return the server IP address, not the end user. Just as your original post stated, I need to log user IPs.

Can you kindly explain how/if you were able to get user IPs?

Hmmm, I can’t recall. I will have to check back on that project and see how I made out. It’s been awhile.

Thank you! Any help would be greatly appreciated @brad.

Try this:

{{$_SERVER.REMOTE_ADDR}}

Yes, that is what I used …

2 Likes

If you’re on a load balancer - this php function won’t return client IP.
We use a js function to fetch IP on client side using free api service like: http://ip4only.me/api/ then set this value in session variable in server action login to be used in other server actions via session variable for that logged in session.

3 Likes