IP archiver

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

User avatar
asi0917
Forum Commoner
Posts: 41
Joined: Thu Nov 25, 2004 10:37 am
Location: Shoreline, Washington
Contact:

IP archiver

Post by asi0917 »

very crude but gets the job done
http://hosting.mixcat.com/asi0917/ips.php
saves ips to
http://hosting.mixcat.com/asi0917/test.txt
don't worry, im not saving any, for show off purposes only
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

First of all, wrong forum. Second of all, whats your point?
User avatar
asi0917
Forum Commoner
Posts: 41
Joined: Thu Nov 25, 2004 10:37 am
Location: Shoreline, Washington
Contact:

Post by asi0917 »

which foru should it be in?
personal pride, last week i didn't know a drop of php
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Read the forum descriptions..

I would have been it in general or misc
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Congrats on the script. Was this just a project that you were doing to practice or do you plan on incorporating this script into a site of yours?

Btw, i've moved the post to the general discussion forum.
User avatar
asi0917
Forum Commoner
Posts: 41
Joined: Thu Nov 25, 2004 10:37 am
Location: Shoreline, Washington
Contact:

Post by asi0917 »

i just learnt php, fealt inclined to make something, made this
thats all
thnx 4 the move
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

Congrats on getting a script up and running, one small problem, it captures the wrong IP address for me.
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

yup, its grabing my ISP's proxy server, try this.

Code: Select all

<?php
$ip = (empty($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_X_FORWARDED_FOR'];
?>
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

from the php manual ;)

Code: Select all

<?php

function getIP() {
$ip;

if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
else if(getenv("HTTP_X_FORWARDED_FOR)) $ip = getenv("HTTP_X_FORWARDED_FOR");
else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
else $ip = "UNKNOWN";

return $ip;

}
?>
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

without the parse error ... :P

Code: Select all

<?php

function getIP() {
$ip;

if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");
else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
else $ip = "UNKNOWN";

return $ip;

}
?>
User avatar
asi0917
Forum Commoner
Posts: 41
Joined: Thu Nov 25, 2004 10:37 am
Location: Shoreline, Washington
Contact:

Post by asi0917 »

wow, who realoded the page 3 hundred billion times?
P.S. thanks for scripts
User avatar
asi0917
Forum Commoner
Posts: 41
Joined: Thu Nov 25, 2004 10:37 am
Location: Shoreline, Washington
Contact:

Post by asi0917 »

i need mySQL for those scripts given here right?
my free hosting doesn't have mySQL i think be cause timvw's script doesn't work

anyone know of a free php host with mySQL and a database?
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

nope, these are just php functions and IF statments to find the real ip, thats all.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

asi0917 wrote:wow, who realoded the page 3 hundred billion times?
me actually :-)

I was bored...

you might wanna make it so that if some one reloads it 10 times in less then 10 seconds they get banned from your site or something, this prevents you from getting 300 MB log files to go through when an idiot like me decides he wants to flood you for no apparent reason.

Code: Select all

function flood($site) {
  $x=10;
  while ($x < 5) {
     file_get_contents($site);
  }
}
flood ("http://hosting.mixcat.com/asi0917/ips.php");
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

uhh..

Code: Select all

while ($x < 5) {
     file_get_contents($site);
  }
so.. it never runs? nice script :)

I take it that wasnt a copy and paste job.
Post Reply