gsquare567 Posted April 28, 2007 Share Posted April 28, 2007 does $_SERVER['REMOTE_ADDR']; give the IP address that is different for every computer? im looking for the type of IP that is unique for every computer and does not change. Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/ Share on other sites More sharing options...
MadTechie Posted April 28, 2007 Share Posted April 28, 2007 what your looking for Doesn't exist, the closest your get is the MAC address (serial number of the network card) but they can be spoofed! Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240600 Share on other sites More sharing options...
gsquare567 Posted April 28, 2007 Author Share Posted April 28, 2007 so is the way i'm checking the IP now correct? or how about an IP unique to every computer that can change? on-the-side question1: how do i tab in an echo? <t> doesnt work. on-the-side question2: how do i get the length of a varchar? Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240612 Share on other sites More sharing options...
MadTechie Posted April 28, 2007 Share Posted April 28, 2007 your IP check is ok or can't be done side 1 try \t side 2 try strlen("hello"); Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240618 Share on other sites More sharing options...
gsquare567 Posted April 28, 2007 Author Share Posted April 28, 2007 im sure it can, because i just saw after all my posts this site has my IP address! and i tried strlen("$row['IP']") but it doesnt work =S EDIT: changed to $ip = $row['IP']; if(strlen($ip) == 0) and works! so now down to one question: how do i get the IP like this site does? Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240619 Share on other sites More sharing options...
AndyB Posted April 28, 2007 Share Posted April 28, 2007 so now down to one question: how do i get the IP like this site does? Exactly what you posted in the starter post of this thread. Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240658 Share on other sites More sharing options...
gsquare567 Posted April 28, 2007 Author Share Posted April 28, 2007 no that one returns ###.###.#.#, the one on this site is ##.###.##.## Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240664 Share on other sites More sharing options...
AndyB Posted April 28, 2007 Share Posted April 28, 2007 What? There's only one way to get the IP of the remote agent, and you already posted it. If you happen to be surfing via some proxy or spoofing your IP then you're not going to get the 'real' IP of the computer you are using. Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240669 Share on other sites More sharing options...
bobleny Posted April 28, 2007 Share Posted April 28, 2007 Thats me! I haven't seen a site with my real ip address... This is a cool site though... http://www.whatismyipaddress.com/ lol it's completely wrong on where I live though. Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240672 Share on other sites More sharing options...
per1os Posted April 28, 2007 Share Posted April 28, 2007 On a side note EVERY IP changes. There are ways to get a local IP of a computer on a network. Check the php.net functions. I know some people created it. If the IP does not change it is static, but that does not mean it WILL not change. Let's say I am logging in from a school computer, if you ban that IP every person in that school is banned. IP's only go so far. That and they can be spoofed. It sucks yes, but oh well. If I really wanted to, I can easily go in through a proxy and bam have access to you site with a new IP. That is just how IP's work. Why are you looking into this, for banning of users? Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240674 Share on other sites More sharing options...
gsquare567 Posted April 28, 2007 Author Share Posted April 28, 2007 precisely Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240682 Share on other sites More sharing options...
Dragen Posted April 28, 2007 Share Posted April 28, 2007 find another way to ban than by ip... It's a pain, because it blocks off so many other legitimate users as well as the few who spam etc. Try image captcha or something. Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240689 Share on other sites More sharing options...
gsquare567 Posted April 29, 2007 Author Share Posted April 29, 2007 how would that help? im tryin to ban humans lol Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240789 Share on other sites More sharing options...
tcollie Posted April 29, 2007 Share Posted April 29, 2007 I just glanced at your post, but I'm guessing that when you run the code $_SERVER['REMOTE_ADDR']; it shows your IP address as 127.0.0.1. Am I correct? or 192.168.10.1 or something like that? Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240794 Share on other sites More sharing options...
gsquare567 Posted April 29, 2007 Author Share Posted April 29, 2007 127.0.0.1 howd u know? Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240799 Share on other sites More sharing options...
tcollie Posted April 29, 2007 Share Posted April 29, 2007 b/c when you're working on your own server (dev machine) that isn't actually an online server, it will show that as your IP. That's your localhost IP on your computer. If you upload your script to an actual web server, it will show your IP in the same manner as you see on here. Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240803 Share on other sites More sharing options...
gsquare567 Posted April 29, 2007 Author Share Posted April 29, 2007 dangit, well how does THIS SITE get the ip, because it gets it somehow! man this is tough, i searched throughout the directories and this is the only 1 i found with IP Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240817 Share on other sites More sharing options...
kenrbnsn Posted April 29, 2007 Share Posted April 29, 2007 Here's the code I use which tries to get the "true" address, but it doesn't always work: <?php if ($_SERVER["HTTP_X_FORWARDED_FOR"] != ""){ $IP = $_SERVER["HTTP_X_FORWARDED_FOR"]; $proxy = $_SERVER["REMOTE_ADDR"]; $host = @gethostbyaddr($_SERVER["HTTP_X_FORWARDED_FOR"]); }else{ $IP = $_SERVER["REMOTE_ADDR"]; $host = @gethostbyaddr($_SERVER["REMOTE_ADDR"]); } ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240820 Share on other sites More sharing options...
gsquare567 Posted April 29, 2007 Author Share Posted April 29, 2007 cool, all that showed up for me was my host Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240821 Share on other sites More sharing options...
AndyB Posted April 29, 2007 Share Posted April 29, 2007 cool, all that showed up for me was my host Not 72.136.77.xx ?? Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240822 Share on other sites More sharing options...
gsquare567 Posted April 29, 2007 Author Share Posted April 29, 2007 CPE0006259b85d7-CM014380004733.cpe.net.cable.rogers.com Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240824 Share on other sites More sharing options...
AndyB Posted April 29, 2007 Share Posted April 29, 2007 And your IP is still displayed here. Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240825 Share on other sites More sharing options...
kenrbnsn Posted April 29, 2007 Share Posted April 29, 2007 That's because I use the funtion gethostbyaddr() to try to get the full qualified domain name. If you just want the IP, change the code accordingly: <?php if ($_SERVER["HTTP_X_FORWARDED_FOR"] != ""){ $IP = $_SERVER["HTTP_X_FORWARDED_FOR"]; $proxy = $_SERVER["REMOTE_ADDR"]; $host = $_SERVER["HTTP_X_FORWARDED_FOR"]; }else{ $IP = $_SERVER["REMOTE_ADDR"]; $host = $IP; } ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240828 Share on other sites More sharing options...
trq Posted April 29, 2007 Share Posted April 29, 2007 Are you echoing $host or $IP from the above code snippet? Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240829 Share on other sites More sharing options...
gsquare567 Posted April 29, 2007 Author Share Posted April 29, 2007 echo "HOST: " . $host . "<br>"; echo "PROXY: " . $proxy . "<br>"; echo "IP: " . $ip . "<br>"; returns HOST: **.***.**.** PROXY: IP: Quote Link to comment https://forums.phpfreaks.com/topic/49105-local-ip-or-whatever-ip-is-unique-to-every-computer-iunno/#findComment-240830 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.