Thursday, June 3, 2021

Re: Retreive User IP Address and other details through HTML Form

Wow...thanks for the response. Yes we are all on same network in an organization. I will send view.py and index.html code later, it's 9:46pm here.
Regards

On Thu, Jun 3, 2021, 6:54 PM Kasper Laudrup <laudrup@stacktrace.dk> wrote:
On 03/06/2021 12.04, Stephen olumide wrote:
> Hello Everyone,
> I need help with my Django web app, see link below
> https://caryang.pythonanywhere.com

It would be much more useful if you could link to the source code, or
even better, the relevant snippets instead.

> I need the form to display/populate the following:
> - Username

No problem. That's available as the "user" attribute on the request object.

> - System Name

Not sure what you mean by "system name" but you might get what you want
from either "HTTP_USER_AGENT" or "REMOTE_HOST" in the META dictionary in
the request object. Be aware that these are easily spoofed by the
client, so you shouldn't rely on those being valid.

> - IP Address

Available in "REMOTE_ADDR" in the META dictionary in the request object.
Again, this is trivial to spoof so you cannot rely on this being correct.

> - MAC Address

That's not possible. You might be able to do an ARP lookup if your
client happens to be on the same network as your server and might be
lucky to get a valid reply, but I wouldn't count on it.


Again, that would require the IP address to be correct, which, as
already mentioned, you cannot rely on.

Since you want to host your code on some hosting provider somewhere
else, there's no way you can get that information.

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/j2FQ_AkdX5U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/92153d47-91ec-1946-1f6f-d5378c9b3704%40stacktrace.dk.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF0hcNrybgQdBAVVFS8jvuDfsRVHCRhFubwqX8ncJK2V3aYegA%40mail.gmail.com.

No comments:

Post a Comment