Jump to content

Recommended Posts

Hey guys... This should be my last question for a while  :shy:

 

My friend showed me a PHP snippet he had where it got the HTML from a page (http://ipchicken.com/) and under Current IP Address it had my IP address. So he had used my IP address to visit a site. How can I do this? For the code I am writing now, it needs to use the user's IP. It can't use the server's.

 

I know this is possible, just looking for a way how.

Link to comment
https://forums.phpfreaks.com/topic/203249-connect-to-a-site-using-the-users-ip/
Share on other sites

If you want to get the IP of the person viewing your page you can use the following function to retrieve it easily (not mine, snipped off one of the first few google results):

 

function VisitorIP()
    { 
    if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
        $TheIp=$_SERVER['HTTP_X_FORWARDED_FOR'];
    else $TheIp=$_SERVER['REMOTE_ADDR'];

    return trim($TheIp);
    }

 

I'm not quite sure what you mean by connecting to a site using someone else's IP. Unless I'm misunderstanding what you're asking, that isn't possible and really goes against how networking works.

I know how to get the IP just fine. Someone told me it's possible if you loop through a bunch of ports and find one that's open.

 

That's called a port scan and is unrelated to what you're asking. You can't just "use somebody else's IP" to connect to stuff without access to their computer/network.

You can't. Think about it.

 

Firstly, there is no such thing as a connection using http, you simply make a request and the server responds.

 

Now, if you where to fool a server into thinking you where using some one else's ip address, where do you think the server would send the response to?

Now, if you where to fool a server into thinking you where using some one else's ip address, where do you think the server would send the response to?

 

To make this a bit more clearer (as you clearly don't have any networking background) take your friends street address and number and yours now assume your friend requests a package and gives your street adress + number, where does the mail send it to?

 

I think your friend tricked you by changing the source and took a screen shot of this altered version.

I know it wasn't a trick. He had a PHP login up for a site that I am IPBanned from. I tried to login thru HIS site and HIS site said "you are IP banned". Everyone else could login from his/her IP. And in the admin CP I saw that everyone who was logging in through his site was using his/her IP.

Everyone else could login from his/her IP

 

Are they IP banned?

 

And in the admin CP I saw that everyone who was logging in through his site was using his/her IP.

 

Of course everyone has his own IP.

 

His site would login to example.com. I am IPBanned from example.com so when I tried to login from his site to example.com, it would output: you are IP banned. But everyone else could login to example.com from his site. I am the owner of example.com and I saw that every login that logged in from his site each had a unique IP address. I emailed some of the users who used his site and when I asked if that was their IP address (the one from AdminCP), they all said it was theirs.

 

Understand yet? :D

I'm just trying to prove the point that it uses HIS/HER IP address. Not the server's.

 

Nobody has suggested otherwise. When you connect to any website (or anything else on a modern network), you are "using" your own IP. That IP was given to each user by their ISP. Nobody else can just start using it at will.

 

I think you are a bit confused here and your friend is either confused as well or messing with you. This has nothing at all to do with PHP. The closest thing ito "using somebody elses IP" is a proxy. If for example your friend has any sort of proxy server software installed (an SSH tunnell) would work, you could point your browser to that proxy so that website requests would go to his computer, then to the website, then back to your friends computer, and finally back to you.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.