Nov 21, 2009
Pages: 1, 2

How Can I Get User's Ip

free web hosting

Read Latest Entries..: (Post #14) by twitch on Nov 2 2005, 04:24 PM.
Well, 2,305,843,009,213,693,952 individual addresses can be used for IPv6. This is better than the IPv4, helps with security and is a lot more long-term.
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion & Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

How Can I Get User's Ip

PureHeart
I'm a PHP coder.
I saw many sites that read user's IP address and display on the page (like some free dns website). They also let me know where I am (the country).

So, my question is.
How to know user's IP address. .

Remember, I'm using PHP

Please include the code in reply.

Comment/Reply (w/o sign-up)

hazeshow
So I think it goes something like this:

<?php

$test=getenv("REMOTE_ADDR");

echo $test;
?>


Try it out. smile.gif

Comment/Reply (w/o sign-up)

PureHeart
QUOTE(hazeshow @ Oct 8 2005, 04:41 PM)
So I think it goes something like this:

<?php

$test=getenv("REMOTE_ADDR");

echo $test;
?>


Try it out.  smile.gif
*



Yeah, it worked. Thank you very much.





Comment/Reply (w/o sign-up)

Fate
QUOTE(PureHeart @ Oct 8 2005, 11:56 AM)
Yeah, it worked. Thank you very much.
*



there is a more common way to do it.

CODE

<?php
$test = $_SERVER['REMOTE_ADDR'];
echo $test;
?>


u can get alot of information about the user, u can use
CODE

<?php
phpinfo();
?>

to get all the variables...

Comment/Reply (w/o sign-up)

Houdini
Most all sites that use PHP use such schemes to kick certain IPs off the site usually forums and CMS need this to keep abusive people off the site. PHP-Nuke, Mamba Xoops, Invision, PHPbb, and many other such systems already track the IPs and if necessary the administrator can ban that IP...

How do you think people get banned from these forums, it is not by their user name necessarily but the IP.

Comment/Reply (w/o sign-up)

hazeshow
QUOTE(Houdini @ Oct 9 2005, 04:12 PM)
How do you think people get banned from these forums, it is not by their user name necessarily but the IP.

But what if I have a new IP every time I visit the forum? Me for example, I get a dynamic IP adress assigend by my provider everytime I enter the interent. I think I can't be banned by a forum administrator except if he tries to ban ALL IP adresses coming from a certain IP range.

Comment/Reply (w/o sign-up)

Houdini
That is simple, you ban the IP as well as the User, but that should go without saying then you if baneed unless you have a few hundred email addresses, and can come up with some unique usernames you will probably not be aloowed back on.

Comment/Reply (w/o sign-up)

mastercomputers
QUOTE(Houdini @ Oct 13 2005, 12:42 PM)
That is simple, you ban the IP as well as the User, but that should go without saying then you if baneed unless you have a few hundred email addresses, and can come up with some unique usernames you will probably not be aloowed back on.
*



Just to clear this up, users will not be banned by IP addresses due to their dynamic nature and that we may accidently ban people who should not be banned.

We ban the user and their email address. They can continue registering with a new username and email address, and we will continue banning them if they step out of line again. They think they can register over a hundred emails, good, because we can ban over a hundred emails too and we don't mind doing our job. Eventually they will get sick of this, and no doubt we would be sick of it too, but we won't give up since that is our job of making sure we keep our forums to an acceptable level.

Cheers,


MC

 

 

 


Comment/Reply (w/o sign-up)

twitch
As far as I am aware, there are several ways in which to ban someone.

1. Remove all the privilages for that account, so it literally becomes null.
2. Delete the account.
3. Ban username
4. Ban IP

If it is possible to use PHP to find the TRUE IP, instead of a dynamic one, then banning would be a bit easier. And as MC pointed out, it is the job of the admin/mods to maintain that problem accounts are banned. People who get banned once, are more often than not banned again and again due to their repetitive defiance. Those people always have the same mannerisms, so it is easy to spot them.

Comment/Reply (w/o sign-up)

Hercco
QUOTE(guy @ Oct 13 2005, 06:33 PM)
If it is possible to use PHP to find the TRUE IP, instead of a dynamic one, then banning would be a bit easier.
*



There is no such thing as TRUE IP. Or to put it other way around dynamic IPs are just as true as any. DHCP servers just hand out random IP addresses to clients connecting. They have no other addresses.

Now the only truly unique address each client has is the MAC address of the NIC or cabel modem's or whatever. But these are not sent on HTTP requests.


And when banning IP addresses dynamic addressing isn't the only issue. Proxy servers and NATs are far more worse. Ban the proxy's or NAT gateways address and you ban all people behind it. This could mean several thousand clients.


Comment/Reply (w/o sign-up)

Latest Entries

twitch
Well, 2,305,843,009,213,693,952 individual addresses can be used for IPv6. This is better than the IPv4, helps with security and is a lot more long-term.

Comment/Reply (w/o sign-up)

Hercco
QUOTE(guy @ Oct 30 2005, 09:28 AM)
Wouldn't it be easier if we all had a single state IP instead of this dynamic system?
*



Yes it would. But there is a reason why this isn't the case: there aren't enough addresses! The version four of the IP protocol is the one that's commonly used now. IPv4 supports 32-bit addresses, meaning that there can some 4 billion different addresses. And as you know, more and more computers and other appliances (especially cell phones) are getting connected Internet is getting more and more popular in the population rich asian countries. When Internet originated, the number of connected computers were hugely underestimated. Other problem is that the addresses aren't equally distributed. As Internet originated in the USA, US companies get to reserve address ranges first. You could say that USA is hogging IPv4 addresses.

But there is a cure for this: the IPv6. Yes, that's not typo, they decided to skip the version 5. IPv6 has 128-bit addressing, which means some 3.4 × 10^38 addresses. I remember hearing that the number of addresses are enough to have several addresses for each atom of every human being alive. Yep, they screwed up with the IPv4 addresses and with Ipv6 they go to overkill biggrin.gif One lecturer said that once the intellectual clothing becomes popular they're probably going to assign each button a couple of IPv6 addresses...

Comment/Reply (w/o sign-up)

twitch
QUOTE(Hercco @ Oct 13 2005, 05:35 PM)
There is no such thing as TRUE IP. Or to put it other way around dynamic IPs are just as true as any. DHCP servers just hand out random IP addresses to clients connecting. They have no other addresses.

Now the only truly unique address each client has is the MAC address of the NIC or cabel modem's or whatever. But these are not sent on HTTP requests.
And when banning IP addresses dynamic addressing isn't the only issue. Proxy servers and NATs are far more worse. Ban the proxy's or NAT gateways address and you ban all people behind it. This could mean several thousand clients.
*


Thanks for clearing that up. IP and connected technologies are not my forte.

Wouldn't it be easier if we all had a single state IP instead of this dynamic system?

Comment/Reply (w/o sign-up)

Hercco
QUOTE(vujsa @ Oct 14 2005, 03:10 AM)

At some point in time you should try to learn how to use the $_COOKIE and $_SESSION superglobals.  It gives you a lot of options for user specific options and authentication.

*




Word.

Definitely worth studying. The thing about stuff like this is that, even though you might not have immediate use for them, by studying you'll know that they do exist and what stuff you can do with them. Generally speaking PHP manual is worth glancing through entirely. It is sometimes so frustrating when you have spend time implementing something yourself to notice that it is already built in the language.


Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Pages: 1, 2
Similar Topics

Keywords : User39s Ip


    Looking for users, ip

See Also,

*SIMILAR VIDEOS*
Searching Video's for users, ip
advertisement



How Can I Get User's Ip

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com