ZachMEdwards Posted May 29, 2010 Share Posted May 29, 2010 Hey guys... This should be my last question for a while 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. Quote Link to comment https://forums.phpfreaks.com/topic/203249-connect-to-a-site-using-the-users-ip/ Share on other sites More sharing options...
DWilliams Posted May 29, 2010 Share Posted May 29, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/203249-connect-to-a-site-using-the-users-ip/#findComment-1064900 Share on other sites More sharing options...
ZachMEdwards Posted May 29, 2010 Author Share Posted May 29, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/203249-connect-to-a-site-using-the-users-ip/#findComment-1064901 Share on other sites More sharing options...
DWilliams Posted May 29, 2010 Share Posted May 29, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/203249-connect-to-a-site-using-the-users-ip/#findComment-1064903 Share on other sites More sharing options...
ZachMEdwards Posted May 29, 2010 Author Share Posted May 29, 2010 Well then how do I connect to a site with their IP? Quote Link to comment https://forums.phpfreaks.com/topic/203249-connect-to-a-site-using-the-users-ip/#findComment-1064905 Share on other sites More sharing options...
trq Posted May 29, 2010 Share Posted May 29, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/203249-connect-to-a-site-using-the-users-ip/#findComment-1064912 Share on other sites More sharing options...
ignace Posted May 29, 2010 Share Posted May 29, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/203249-connect-to-a-site-using-the-users-ip/#findComment-1064947 Share on other sites More sharing options...
ZachMEdwards Posted May 29, 2010 Author Share Posted May 29, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/203249-connect-to-a-site-using-the-users-ip/#findComment-1065022 Share on other sites More sharing options...
ignace Posted May 29, 2010 Share Posted May 29, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/203249-connect-to-a-site-using-the-users-ip/#findComment-1065034 Share on other sites More sharing options...
ZachMEdwards Posted May 29, 2010 Author Share Posted May 29, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/203249-connect-to-a-site-using-the-users-ip/#findComment-1065045 Share on other sites More sharing options...
ignace Posted May 29, 2010 Share Posted May 29, 2010 Understand yet? This applies more to you then it is to me. If you IP banned yourself then of course you are banned and the others aren't because they do not have your IP address. Quote Link to comment https://forums.phpfreaks.com/topic/203249-connect-to-a-site-using-the-users-ip/#findComment-1065056 Share on other sites More sharing options...
ZachMEdwards Posted May 29, 2010 Author Share Posted May 29, 2010 I'm just trying to prove the point that it uses HIS/HER IP address. Not the server's. Quote Link to comment https://forums.phpfreaks.com/topic/203249-connect-to-a-site-using-the-users-ip/#findComment-1065064 Share on other sites More sharing options...
DWilliams Posted May 29, 2010 Share Posted May 29, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/203249-connect-to-a-site-using-the-users-ip/#findComment-1065095 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.