Follow us on Twitter!
Understanding is the answer, hatred is the problem, and hackers are the slaves abused and destroyed in the process of peace online - Deshouleres
Thursday, April 24, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 20
Guests Online: 16
Members Online: 4

Registered Members: 82891
Newest Member: C0nQU3r0R
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

php ip logger issuses

BlackW0lf
Member

Your avatar

Posts: 15
Location: hmm
Joined: 19.03.08
Rank:
Apprentice
Posted on 21-08-08 01:20
hi i've been looking into php for a while now and know the basics but i made an ip logger and it only half works...
the problem is they log ips but not of the person who vists the link just the iternet severs there on

$ip = $REMOTE_ADDR;

but when i go to my log.txt it doesnt show there real ip... i tryed it with mine and it logged my servise providers ip...
can anyone help i would realy like this to work for the next task i have in mind Wink
Author

RE: php ip logger issuses


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 21-08-08 01:33
The correct variable for a visitor's ip is $_SERVER['REMOTE_ADDR'];. What is your code giving you? It shouldn't give anything unless PHP is getting $_SERVER since it doesn't have the variable defined anywhere else.

Edited by on 21-08-08 01:35
Author

RE: php ip logger issuses

BlackW0lf
Member

Your avatar

Posts: 15
Location: hmm
Joined: 19.03.08
Rank:
Apprentice
Posted on 21-08-08 01:47
<?
$log_file = "log.txt";
$date_time = date('d-m-Y/H:i:s'Wink;
$ip = $REMOTE_ADDR;
$page = $_SERVER['REQUEST_URI'];
$fp = fopen("$log_file", "a"Wink;


fputs ($fp,"
($date_time) ($ip) $page ;
flock($fp, 3);
fclose($fp);
?>

thats my full code yeah i know its not probly the best
(20-08-2008/23:46:58) (92.23.61.62) /
is what is logged
Author

RE: php ip logger issuses


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 21-08-08 02:02
The correct code would be:
Code

<?
$log_file = "log.txt";
$date_time = date('d-m-Y/H:i:s');
$ip = $_SERVER['REMOTE_ADDR'];
$page = $_SERVER['REQUEST_URI'];
$fp = fopen("$log_file", "a");


fputs ($fp," ($date_time) ($ip) $page");
flock($fp, 3);
fclose($fp);
?>





You missed a quotation and a parentheses and $ip=$REMOTE_ADDR; needs to be changed to $_SERVER['REMOTE_ADDR'];

Edited by on 21-08-08 02:02
Author

RE: php ip logger issuses

BlackW0lf
Member

Your avatar

Posts: 15
Location: hmm
Joined: 19.03.08
Rank:
Apprentice
Posted on 21-08-08 02:10
ahh yeah i see that thanks for spotting that im still kinda new to php :/
and just try it again but its still not logging my ip so onlything i could think of it being is awardspace.com my hosting website isnt alowing the php?
Author

RE: php ip logger issuses


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 21-08-08 02:32
It works on my server. Try doing <?php echo "test"; ?> and see if it outputs. Are you saving in a .html or a .php file?
Author

RE: php ip logger issuses

BlackW0lf
Member

Your avatar

Posts: 15
Location: hmm
Joined: 19.03.08
Rank:
Apprentice
Posted on 25-08-08 00:53
the php is working fine on the site but when it logs an ip it logs the servise providers ip not there computer which i want
Author

RE: php ip logger issuses

spyware
Member



Posts: 4192
Location:
Joined: 14.04.07
Rank:
God
Warn Level: 90
Posted on 25-08-08 00:57
BlackW0lf wrote:
the php is working fine on the site but when it logs an ip it logs the servise providers ip not there computer which i want


Post a sample IP (be sure to change some numbers).



img507.imageshack.us/img507/3580/spynewsig3il1.png
"The chowner of property." - Zeph
[small]
Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.
- Carl Sagan
[center]�Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?� - Ebert[/ce
Author

RE: php ip logger issuses

BlackW0lf
Member

Your avatar

Posts: 15
Location: hmm
Joined: 19.03.08
Rank:
Apprentice
Posted on 25-08-08 01:08
ok say this is my ip
82.38.**.***

when i vist my iploggers page the ip that is logged is
62.30.***.***

which when tracked points to my service provider
Author

RE: php ip logger issuses


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 25-08-08 02:03
BlackW0lf wrote:
ok say this is my ip
82.38.**.***

when i vist my iploggers page the ip that is logged is
62.30.***.***

which when tracked points to my service provider


Does your ISP proxy your connection? If so, then that's your problem. http://whatsmyip.. . . <---what does that say when you go to it?
Author

RE: php ip logger issuses

BlackW0lf
Member

Your avatar

Posts: 15
Location: hmm
Joined: 19.03.08
Rank:
Apprentice
Posted on 25-08-08 02:49
it says my ip ive checked this and ive asked 2 other people who trust me knowing there ip and it has the same results both got logged as there service providers ip not there computers ip
Author

RE: php ip logger issuses


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 25-08-08 12:01
That's really weird :/. I don't get why it would be logging the ISP for you, here's from my log file:
(25-08-2008/06:56:42) (24.213.194.119) /test2.php

It's showing my I.P. The only reasons I can think of are that your web-host is somehow making it so you can't log individual I.P.s. I'll do some googling and see if that's possible to do. If you have access to the apache access logs, does it show your real I.P. in it or the service provider's?
Author

RE: php ip logger issuses

BlackW0lf
Member

Your avatar

Posts: 15
Location: hmm
Joined: 19.03.08
Rank:
Apprentice
Posted on 28-08-08 02:14
im not sure how i accsess them but i found this
http://cp8.awardspace.com/phpinfo.html
unless thats them? i dont know what most of this means but its the only thing on there site about php that could say anything intresting