+ 2
How to know the IP of a person who visited of our site?? Is it possible with js???
7 Respuestas
+ 5
This may be intresting to you.
https://ourcodeworld.com/articles/read/257/how-to-get-the-client-ip-address-with-javascript-only
+ 3
<?php
// Function to get the client ip address
function get_client_ip_env() {
$ipaddress = '';
if (getenv('HTTP_CLIENT_IP'))
$ipaddress = getenv('HTTP_CLIENT_IP');
else if(getenv('HTTP_X_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
else if(getenv('HTTP_X_FORWARDED'))
$ipaddress = getenv('HTTP_X_FORWARDED');
else if(getenv('HTTP_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_FORWARDED_FOR');
else if(getenv('HTTP_FORWARDED'))
$ipaddress = getenv('HTTP_FORWARDED');
else if(getenv('REMOTE_ADDR'))
$ipaddress = getenv('REMOTE_ADDR');
else
$ipaddress = 'UNKNOWN';
return $ipaddress;
?>
+ 1
oh thanks
+ 1
Use php if you want to see if the user is using a proxy. You can check for their forwarded IP address if they are using a crappy proxy to get their real IP address.
+ 1
How ?
can you write the php code?? plz
+ 1
You can use the WebRTC method to get the ip via JavaScript, or you can do as Xploit suggested. His method would honestly be the best; utilizing php
0
I'd also recommend storing the value either as a session variable or into a database and for each page of whatever site you have, cross referencing the IP against the stored value by setting a token of some kind to make sure the user is who they say they are. It shouldn't take too much effort to add that functionality if you're designing this for security purposes.