Author Topic: When someone visits your website, how can you log their IP?  (Read 2235 times)

0 Members and 1 Guest are viewing this topic.

Offline Nerotic7

  • Ultimate Faggot 9001
  • Knight
  • **
  • Posts: 151
  • Cookies: -37
    • View Profile
When someone visits your website, how can you log their IP?
« on: November 15, 2012, 03:47:55 pm »
I can program, but I was taught to program games, not IP Loggers.
I'm attempting to take baby steps when it comes to "hacking".


Webs doesn't allow you to see visitors IP's, just their first names.
So, is there anything I can do to see the IP's?


<@Phage> I was put in place ONLY to take care of you.

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: When someone visits your website, how can you log their IP?
« Reply #1 on: November 15, 2012, 04:01:55 pm »
I'm assuming by "first names" you mean what IP resolves to (the hostname). In any case, PHP can log the IP in the decimal form.

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
Re: When someone visits your website, how can you log their IP?
« Reply #2 on: November 15, 2012, 04:05:05 pm »
You can get the ip with:
Code: [Select]
<?php
$IP 
$_SERVER['REMOTE_ADDR'];
?>
then save $IP to a file with:
Code: [Select]
<?php
$file 
"ip_log.csv";
$fh fopen($file'a');
fwrite($fh$IP '\n');
fclose($fh);
?>

And don't forget to save it as a .php!
« Last Edit: November 15, 2012, 04:08:06 pm by Area_13 »
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline iTpHo3NiX

  • EZ's Pirate Captain
  • Administrator
  • Titan
  • *
  • Posts: 2920
  • Cookies: 328
    • View Profile
    • EvilZone
Re: When someone visits your website, how can you log their IP?
« Reply #3 on: November 15, 2012, 09:29:20 pm »
http://www.hotscripts.com/blog/logging-visitor-details-to-text-file/

You can also use different variables to get different IP information:

Code: (php) [Select]
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;
}

Have fun. You can also do one with javascript, as well as MySQL (and other databases)

Lastly, you can always do this as well:
http://bit.ly/UIZIYw
« Last Edit: November 15, 2012, 09:30:48 pm by skidiot.h »
[09:27] (+lenoch) iTpHo3NiX can even manipulate me to suck dick
[09:27] (+lenoch) oh no that's voluntary
[09:27] (+lenoch) sorry

Offline theellimist

  • Knight
  • **
  • Posts: 371
  • Cookies: 17
    • View Profile
    • TheEllimist's Game
Re: When someone visits your website, how can you log their IP?
« Reply #4 on: November 15, 2012, 09:32:59 pm »
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.

Offline m0l0ko

  • Peasant
  • *
  • Posts: 129
  • Cookies: -4
    • View Profile
Re: When someone visits your website, how can you log their IP?
« Reply #5 on: November 16, 2012, 05:34:08 pm »
Can javascript log IPs too or is it just server side scripts that can do it?

Offline geXXos

  • Royal Highness
  • ****
  • Posts: 646
  • Cookies: 178
    • View Profile
Re: When someone visits your website, how can you log their IP?
« Reply #6 on: November 16, 2012, 05:39:02 pm »
There's no notion of hosts or ip-addresses in the javascript standard library. But i may be wrong again.

Offline iTpHo3NiX

  • EZ's Pirate Captain
  • Administrator
  • Titan
  • *
  • Posts: 2920
  • Cookies: 328
    • View Profile
    • EvilZone
Re: When someone visits your website, how can you log their IP?
« Reply #7 on: November 16, 2012, 06:11:16 pm »
There's no notion of hosts or ip-addresses in the javascript standard library. But i may be wrong again.

I'll try to find it but I had a javascript do the logging to a text file. I'll have to try and find it again.
[09:27] (+lenoch) iTpHo3NiX can even manipulate me to suck dick
[09:27] (+lenoch) oh no that's voluntary
[09:27] (+lenoch) sorry

Offline relax

  • Sir
  • ***
  • Posts: 562
  • Cookies: 114
  • The one and only
    • View Profile
Re: When someone visits your website, how can you log their IP?
« Reply #8 on: November 17, 2012, 03:30:27 am »
javascript:
Code: (javascript) [Select]
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 know how to save to loggfile tho
maybe xmlhttprequest to other language script

or just check the webserver loggs
dont think you can save file directly with javascript on the server
« Last Edit: November 17, 2012, 03:32:48 am by relax »

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
Re: When someone visits your website, how can you log their IP?
« Reply #9 on: November 17, 2012, 10:52:38 am »
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)
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline relax

  • Sir
  • ***
  • Posts: 562
  • Cookies: 114
  • The one and only
    • View Profile
Re: When someone visits your website, how can you log their IP?
« Reply #10 on: November 17, 2012, 11:30:43 am »
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)

yeah ofc, was late ^^

Offline Nerotic7

  • Ultimate Faggot 9001
  • Knight
  • **
  • Posts: 151
  • Cookies: -37
    • View Profile
Re: When someone visits your website, how can you log their IP?
« Reply #11 on: November 19, 2012, 10:09:42 pm »
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.

How?
<@Phage> I was put in place ONLY to take care of you.

Offline theellimist

  • Knight
  • **
  • Posts: 371
  • Cookies: 17
    • View Profile
    • TheEllimist's Game
Re: When someone visits your website, how can you log their IP?
« Reply #12 on: November 20, 2012, 01:35:27 am »
Seriously bro, you can't look around a bit? It is not hard to find, go to your control panel and click "Website Statistics" This will tell you how much traffic your site is getting, and if you go to the visitors tab you can look at individual visitors information like IP and such.