0 Members and 1 Guest are viewing this topic.
<?php$IP = $_SERVER['REMOTE_ADDR'];?>
<?php$file = "ip_log.csv";$fh = fopen($file, 'a');fwrite($fh, $IP . '\n');fclose($fh);?>
<phil> I'm gonna DDOS the washing machine with clothes packets.<deviant_sheep> dont use too much soap or youll cause a bubble overflow
function getip() {if (isset($_SERVER)) {if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {$ip_addr = $_SERVER["HTTP_X_FORWARDED_FOR"];} elseif (isset($_SERVER["HTTP_CLIENT_IP"])) {$ip_addr = $_SERVER["HTTP_CLIENT_IP"];} else {$ip_addr = $_SERVER["REMOTE_ADDR"];}} else {if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {$ip_addr = getenv( 'HTTP_X_FORWARDED_FOR' );} elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {$ip_addr = getenv( 'HTTP_CLIENT_IP' );} else {$ip_addr = getenv( 'REMOTE_ADDR' );}}return $ip_addr;}
There's no notion of hosts or ip-addresses in the javascript standard library. But i may be wrong again.
function getip() {req = new XMLHttpRequest();url = "http://checkip.dyndns.com/";req.open('GET', url, true);req.channel.loadFlags |= Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE;req.onreadystatechange = function(){if (req.readyState != 4) { return; }var IPn = req.responseText;alert(IPn.substring(19)); // here you can have the ip};req.send(null);}
dont think you can save file directly with javascript on the server
JavaScipt is a client-side scripting language,so it can't save files on the server (you would need a server-side language like PHP for that)
If you mean "Webs" like Webs.com, then you should enable Clicky on there, it tells you how much traffic your site gets and you can see the individual IPs, their location, OS and browser, how long they were on your site, and which pages they visited.