Re: [PHP] IP Address
On Tue, Aug 07, 2001 at 08:11:52AM -0500, Joseph Bannon wrote: > What is the php code to get a visitor's IP address? > > Thanks, > Joseph You might want to consider reading some of the other posts for a change. There's an interesting thread on this list today. It's about the exact same question you just asked. Try reading that! It's called: user's ip -- * R&zE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- H: +31 23 5516190 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] IP Address
Just because you're having a bad day doesn't mean I should. Can you just tell me what it is? I don't have those posts. J -Original Message- On Tue, Aug 07, 2001 at 08:11:52AM -0500, Joseph Bannon wrote: > What is the php code to get a visitor's IP address? > > Thanks, > Joseph You might want to consider reading some of the other posts for a change. There's an interesting thread on this list today. It's about the exact same question you just asked. Try reading that! It's called: user's ip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP Address
On Tue, Aug 07, 2001 at 08:29:34AM -0500, Joseph Bannon wrote: > Just because you're having a bad day doesn't mean I should. Can you just > tell me what it is? I don't have those posts. > > J Wow... I believe you're the one having the bad day. Anyway, here's the result of the thread... It's the code you need. =[ Get remote IP ]= if(getenv(HTTP_X_FORWARDED_FOR)) { $ip=getenv(HTTP_X_FORWARDED_FOR); } else { $ip=getenv(REMOTE_ADDR); } $host = gethostbyaddr($ip); === -- * R&zE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- H: +31 23 5516190 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP Address
> > =[ Get remote IP ]= > > if(getenv(HTTP_X_FORWARDED_FOR)) > { > $ip=getenv(HTTP_X_FORWARDED_FOR); > } > else > { > $ip=getenv(REMOTE_ADDR); > } > $host = gethostbyaddr($ip); > > === > Oh... btw... I just gave a real look at that piece of code. You might want to write it a bit different: if (getenv ("HTTP_X_FORWARDED_FOR")) { $ip = getenv ("HTTP_X_FORWARDED_FOR"); } else { $ip = getenv ("REMOTE_ADDR"); } $host = gethostbyaddr ($ip); The other one does work, but quoting makes a lot of difference in your logfiles. Without quoting yet get al kinds of warnings. -- * R&zE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- H: +31 23 5516190 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] IP Address
>Just because you're having a bad day doesn't mean I should. Can you just >tell me what it is? I don't have those posts. You don't need those posts to check the archive. You should find a link on the page where you subscribed. Checking the archive before you post would help to get less traffic on this list. Bye, B. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] IP Address
At 09:29 AM 8/7/2001, Joseph Bannon wrote: This is the problem with todays "web programmers" and with PHP. One - With the explosion in the ease of HTML and related technologies EVERYBODY is a designer/programmerlets face itsome have it some don't. If you think that blinking text is great...or if you think that table borders are a great then you need to stop attempting to be a designer and get a real job. Two - Damn you Rasmus PHP is a great lang for anything web relatedwith a nice low learning curve. Thats the problem..PHP is s eays to use. So every moron and his brother now programs in PHP and floods the list with questions like "How do i get the users IP?" READ THE FREAKING MANUAL most of us didin fact i keep a printed copy of the manual next to my desk...to avoid asking questions like the above. ~kurth >Just because you're having a bad day doesn't mean I should. Can you just >tell me what it is? I don't have those posts. > >J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP Address
On Sat, 21 Oct 2006 19:55:17 -0400 Fred Moses <[EMAIL PROTECTED]> wrote: > Is there a function which returns the IP address of the requestor of the > current page? > > -- Don't think so but there is a superglobal that contains it: $_SERVER['REMOTE_ADDR'] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address
Greg Maruszeczka wrote: On Sat, 21 Oct 2006 19:55:17 -0400 Fred Moses <[EMAIL PROTECTED]> wrote: Is there a function which returns the IP address of the requestor of the current page? -- Don't think so but there is a superglobal that contains it: $_SERVER['REMOTE_ADDR'] .. which can be faked or sometimes not appear or sometimes you could be hiding behind multiple proxies or a modem... so it's not going to be super reliable (neither are the two variables below). See also $_SERVER['HTTP_CLIENT_IP'] and $_SERVER['HTTP_X_FORWARDED_FOR']. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address
On Sat, October 21, 2006 6:55 pm, Fred Moses wrote: > Is there a function which returns the IP address of the requestor of > the > current page? Any question like this: "Is there a way to find out X that came in from the user" is almost always answered by adding this to the top of your code: Also, be aware that the IP is pretty useless for anything other than entertainment value. It's not unique, it's not stable, it's not reliable, it's not useful for identification nor authentication [*], it's pretty pointless bit of info. [*] Obviously if you control the IP address and it is static, that is a limited exception to this generalization, and you (hopefully) already understood all the above *before* somebody granted you the power to control a public static IP address... :-) -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP address
--- "K.C.P. van Zijl" <[EMAIL PROTECTED]> wrote: > Is it possible in PHP to determine the IP address > of a server which is requesting a page from my own > server? When I use $REMOTE_ADDR, I get the wrong IP > address. In that case I get the IP address of a > person who is requesting the page on that other > server. $_SERVER['REMOTE_ADDR'] is the IP address of the requesting client, whether it is an HTTP proxy, a person's PC, or another Web server playing the role of an Web client. My guess is that you are wrong about who is requesting what. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP address
on 24/01/03 1:23 PM, K.C.P. van Zijl ([EMAIL PROTECTED]) wrote: > Is it possible in PHP to determine the IP address of a server which is > requesting a page from my own server? > When I use $REMOTE_ADDR, I get the wrong IP address. In that case I get > the IP address of a person who is requesting the page on that other > server. > > Hopefully my question is clear enough Not really!! :) Here's what happens (sort of): 1. i request a URL on my computer 2. it talks to my ISP 3. my ISP talks to anywhere from 2 to 20 (or more) servers along the way 4. finally connects with the requested URL (your server with PHP) 5. page comes back thru the 2 to 20 servers 6. arrives at my ISP 7. gets sent to my computer 8. I look at the page So, which one of these computers are you trying to get the IP address of? Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Variable
check this out http://www.php.net/manual/en/function.gethostbyaddr.php jim - Original Message - From: "Ben Clumeck" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 14, 2001 2:48 PM Subject: [PHP] IP Address Variable > I currently log ip address that reach my site. However, I want to be able > to log both the ip address and remote name. Can anyone help? > > Thanks, > > Ben > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] IP Address Variable
Jim, Thanks for your quick response. I looked over the URL and tried it but it doesn't seem to work. I tried: Any advice would be appreciated. Ben -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 14, 2001 2:57 PM To: Ben Clumeck; [EMAIL PROTECTED] Subject: Re: [PHP] IP Address Variable check this out http://www.php.net/manual/en/function.gethostbyaddr.php jim - Original Message - From: "Ben Clumeck" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 14, 2001 2:48 PM Subject: [PHP] IP Address Variable > I currently log ip address that reach my site. However, I want to be able > to log both the ip address and remote name. Can anyone help? > > Thanks, > > Ben > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP Address Variable
It may not work, if you are running Windows PHP on your localhost at home. I'll bet you are trying to log getenv('REMOTE_HOST'). Been there done that. I use http://www.indigostar.com/microweb.htm to create a localhost to develop and debug and then upload to the server. (I pay for modem time.) I remember this not working if I used it at home. Are you sure you are not looking for getenv('REMOTE_HOST') in addition to getenv('REMOTE_ADDR'} You may want this instead. Here's some of my code: "; } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP address enconding
On Thu, 19 Apr 2001, elias wrote: > Hello. > > How can i get the IP address of the user who's browsing my current script? > how can i do it via JavaScript and PHP please. $REMOTE_ADDR should do the trick (use 'phpinfo()' to see for yourself) > And if i got an IP address such 192.168.0.2 > i believe it will be returned as a stringIs there is a function to > encode it to an Integer and the decode it back to a string? or i have to > code it myself? > > -elias It is a string, so you couldn't make an integer out of it anymore than making any other string into an integer. The '.' isn't a legal digit. You'll have to split it up into different blocks (use split) -- Knut -- Knut H. Hassel Nielsen Principal Engineer / Avdelingsingeniør Norwegian University of Science and Technology / NTNU Department of Computer and Information Science / IDI N-7491 Trondheim, Norway Phone Office / Telefon jobb : (+47) 73 59 18 46 Fax Office / Telefax jobb : (+47) 73 59 17 33 Cell. Phone / Mobiltelefon : 91 59 86 06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP address enconding
No! I can encode IP address to an Integer: 192.168.0.1 consider as: a.b.c.d and now the formula goes: a shl 24 + b shl 16 + c shl 8 + d but i was looking for something ready made -elias http://www.kameelah.org/eassoft ""Knut H. Hassel Nielsen"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Thu, 19 Apr 2001, elias wrote: > Hello. > > How can i get the IP address of the user who's browsing my current script? > how can i do it via JavaScript and PHP please. $REMOTE_ADDR should do the trick (use 'phpinfo()' to see for yourself) > And if i got an IP address such 192.168.0.2 > i believe it will be returned as a stringIs there is a function to > encode it to an Integer and the decode it back to a string? or i have to > code it myself? > > -elias It is a string, so you couldn't make an integer out of it anymore than making any other string into an integer. The '.' isn't a legal digit. You'll have to split it up into different blocks (use split) -- Knut -- Knut H. Hassel Nielsen Principal Engineer / Avdelingsingeniør Norwegian University of Science and Technology / NTNU Department of Computer and Information Science / IDI N-7491 Trondheim, Norway Phone Office / Telefon jobb : (+47) 73 59 18 46 Fax Office / Telefax jobb : (+47) 73 59 17 33 Cell. Phone / Mobiltelefon : 91 59 86 06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP address enconding
http://www.php.net/manual/en/function.ip2long.php > No! I can encode IP address to an Integer: > 192.168.0.1 consider as: a.b.c.d > and now the formula goes: > a shl 24 + b shl 16 + c shl 8 + d > > but i was looking for something ready made > > -elias > http://www.kameelah.org/eassoft -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP address enconding
thanks for the hint! ""Jason Brooke"" <[EMAIL PROTECTED]> wrote in message 02a801c0c8bd$6f5528c0$[EMAIL PROTECTED]">news:02a801c0c8bd$6f5528c0$[EMAIL PROTECTED]... > > http://www.php.net/manual/en/function.ip2long.php > > > > > No! I can encode IP address to an Integer: > > 192.168.0.1 consider as: a.b.c.d > > and now the formula goes: > > a shl 24 + b shl 16 + c shl 8 + d > > > > but i was looking for something ready made > > > > -elias > > http://www.kameelah.org/eassoft > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP address enconding
On 19-Apr-01 elias wrote: > No! I can encode IP address to an Integer: > 192.168.0.1 consider as: a.b.c.d > and now the formula goes: > a shl 24 + b shl 16 + c shl 8 + d > > but i was looking for something ready made > PHP3 (returns a float, not an integer): function inet_aton($a) { $inet = 0.0; $t = explode(".", $a); for ($i = 0; $i < 4; $i++) { $inet *= 256.0; $inet += $t[$i]; }; return $inet; } function inet_ntoa($n) { $t=array(0,0,0,0); $msk = 16777216.0; $n += 0.0; if ($n < 1) return(' '); for ($i = 0; $i < 4; $i++) { $k = (int) ($n / $msk); $n -= $msk * $k; $t[$i]= $k; $msk /=256.0; }; $a=join('.', $t); return($a); } Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] IP Address Filtering
> I¹ve run into a slight problem. We maintain a Guestbook for > our company¹s > website. Lately we have been getting a lot of ³Spam² entries into the > Guestbook. > > I added a snippet into the PHP Script & a field in the mySQL > database to > record the IP Address of posters. However, for the SPAM > posts, it records > ³Null² instead of an IP Address. I¹m using $REMOTE_ADDR to > records the IP. > It records IP Addresses of any genuine poster... But NULL for the spam > poster. > > What else can I do to block the SPAM entry? Is there some other Unique > Identifier that I can record of the Spam poster and then block him? How about block any poster that does not report a valid $REMOTE_ADDR? JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Filtering
if you really want to mess with them.. only show the user with the NULL IP address all the spam posts.. .make them think that they've been successful On 3/29/06, Rahul S. Johari <[EMAIL PROTECTED]> wrote: > > Ave, > > I¹ve run into a slight problem. We maintain a Guestbook for our company¹s > website. Lately we have been getting a lot of ³Spam² entries into the > Guestbook. > > I added a snippet into the PHP Script & a field in the mySQL database to > record the IP Address of posters. However, for the SPAM posts, it records > ³Null² instead of an IP Address. I¹m using $REMOTE_ADDR to records the IP. > It records IP Addresses of any genuine poster... But NULL for the spam > poster. > > What else can I do to block the SPAM entry? Is there some other Unique > Identifier that I can record of the Spam poster and then block him? > > Thanks, > > Rahul S. Johari > Coordinator, Internet & Administration > Informed Marketing Services Inc. > 500 Federal Street, Suite 201 > Troy NY 12180 > > Tel: (518) 687-6700 x154 > Fax: (518) 687-6799 > Email: [EMAIL PROTECTED] > http://www.informed-sources.com > > > -- Joe Harman - * My programs never have bugs, they just develop random features. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Filtering
Joe Harman wrote: if you really want to mess with them.. only show the user with the NULL IP address all the spam posts.. .make them think that they've been successful Freaking hilarious idea!! Remind me not to let my kids play with yours. :-D Of course, there's probably not any Real People(tm) behind these addys. Kevin Kinsey -- Sentient plasmoids are a gas. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Filtering
Good thing I don't have kids! On 3/29/06, Kevin Kinsey <[EMAIL PROTECTED]> wrote: > Joe Harman wrote: > > >if you really want to mess with them.. only show the user with the > >NULL IP address all the spam posts.. .make them think that they've > >been successful > > > > > Freaking hilarious idea!! > > Remind me not to let my kids play with yours. :-D > > > Of course, there's probably not any Real People(tm) > behind these addys. > > Kevin Kinsey > > -- > Sentient plasmoids are a gas. > > > -- Joe Harman - * My programs never have bugs, they just develop random features. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Filtering
On Wed, Mar 29, 2006 at 02:52:39PM -0500, Rahul S. Johari wrote: > > Ave, > > I�ve run into a slight problem. We maintain a Guestbook for our company�s > website. Lately we have been getting a lot of �Spam� entries into the > Guestbook. Is this a common guestbook, like a 3rd party tool you got and added to the web site? If so, do they already have a solution in place with an add-on or such. > > I added a snippet into the PHP Script & a field in the mySQL database to > record the IP Address of posters. However, for the SPAM posts, it records > �Null� instead of an IP Address. I�m using $REMOTE_ADDR to records the IP. > It records IP Addresses of any genuine poster... But NULL for the spam > poster. You really want to use $_SERVER['REMOTE_ADDR']; > > What else can I do to block the SPAM entry? Is there some other Unique > Identifier that I can record of the Spam poster and then block him? Well, i'll try to keep this short without going into a big rant about SPAM... A common method (now adays) is have the form that is being posted provide a challange/response method (like CAPTCHA) to verify that someone is actually sitting there filling out the form instead of a script doing the work. One of the problems with this method is well it limits your "visually" impared audience from being able to add to the guestbook, since it requires a visual response to the challenge. Another method is to require javascript for a challenge response method, this of course limits your audience to those who have javascript enabled, and I'm not sure if it really 'visually impared' friendly. Even with those two methods, all we are doing is securing the form from spam by obscurity. Even if it sounds like these ideas are good because it will remove the un-needed spam i get. Consider this: Email gets prbably the worst spam, and there are several applications that go out and harvest emails for spamming purposes. So we all think hey they are looking form: [EMAIL PROTECTED] ... so thus we think, lets not write it that way but make it so a person can read it. So now we enter this so it isn't harvested: user [at] domain [dot] com now, if you think about this for a moment, if everyone used the latter format to write their emails on the web, would it not be easy for a email harvester to come up with a little regex to read either or? Ok, i promised not to rant to much about spam, so yeah, this is a tuff thing to get around and very hard to find a realistic solution for. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Filtering
Ave, I have to say I absolutely love your idea! It¹s probably a solution for my problem, at the same time, like the other guy said, freaking hilarious!!! :0) I think I¹ll probably write up a script that displays everything except records with NULL as IP for regular audience... And displays all records with NULL as IP for audience who¹s IP is recorded as NULL. Thanks! Rahul S. Johari Coordinator, Internet & Administration Informed Marketing Services Inc. 500 Federal Street, Suite 201 Troy NY 12180 Tel: (518) 687-6700 x154 Fax: (518) 687-6799 Email: [EMAIL PROTECTED] http://www.informed-sources.com On 3/29/06 4:13 PM, "Joe Harman" <[EMAIL PROTECTED]> wrote: > if you really want to mess with them.. only show the user with the > NULL IP address all the spam posts.. .make them think that they've > been successful > > On 3/29/06, Rahul S. Johari <[EMAIL PROTECTED]> wrote: > > > -- > Joe Harman > - > * My programs never have bugs, they just develop random features. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Filtering
Rahul S. Johari wrote: Ave, I have to say I absolutely love your idea! It¹s probably a solution for my problem, at the same time, like the other guy said, freaking hilarious!!! :0) I think I¹ll probably write up a script that displays everything except records with NULL as IP for regular audience... And displays all records with NULL as IP for audience who¹s IP is recorded as NULL. Thanks! Could ipv6 make problems here? If apache or similiar apps don't recognize it you also will get NULL. Greets Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Filtering
Ave, Curt, thanks for your response. > Is this a common guestbook, like a 3rd party tool you got and added > to the web site? If so, do they already have a solution in place > with an add-on or such. No, actually it's a script I have written myself from scratch. And unfortunately (or fortunately perhaps), I haven't ever run into this problem before. > You really want to use $_SERVER['REMOTE_ADDR']; That is should, I agree! > A common method (now adays) is have the form that is being posted > provide a challange/response method (like CAPTCHA) to verify that > someone is actually sitting there filling out the form instead of a > script doing the work. > > One of the problems with this method is well it limits your > "visually" impared audience from being able to add to the > guestbook, since it requires a visual response to the challenge. > > Another method is to require javascript for a challenge response > method, this of course limits your audience to those who have > javascript enabled, and I'm not sure if it really 'visually > impared' friendly. I have implemented both those methods in different scripts I have written and maintain across different websites. Visual Confirmation using Image Verification and JavaScript Confirmation. However, I honestly don't want to add such an 'extra' step in my Guestbook for users who simply wish to put in a nice comment about the site, at least not at this point, which is why I do want to stay away from these methods for the Guestbook for now. Let me try a few other suggestions first and see how it goes, and then I'll decide if I need to add more capabilities/security to the Guestbook. Thanks for your insight, always brain-enhancing. Rahul S. Johari Coordinator, Internet & Administration Informed Marketing Services Inc. 500 Federal Street, Suite 201 Troy NY 12180 Tel: (518) 687-6700 x154 Fax: (518) 687-6799 Email: [EMAIL PROTECTED] http://www.informed-sources.com
Re: [PHP] Ip Address to binary
I want to add I have seen bindec() , and I think it's a cruel cruel joke for it to only work with 31 bits, given that ip4 addresses are 32 bits. :} - Original Message - From: "Jason Bell" <[EMAIL PROTECTED]> To: "PHP Users" <[EMAIL PROTECTED]> Sent: Wednesday, September 12, 2001 2:29 PM Subject: [PHP] Ip Address to binary does anyone know of a way to convert an IP address to Binary using PHP? My plan is to store the IP address in MySQL so that I can manage a mass amount of IP subnets, and easily make sure I'm not assigning duplicate subnets. the best way I can think of is to use binary. any other ideas, thoughts or comments? Thanks! -Jason Bell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Ip Address to binary
You could use MySql's built in functions: INET_NTOA() INET_ATON() Sincerely, Robert T. Covell President / Owner Rolet Internet Services, LLC Web: www.rolet.com Email: [EMAIL PROTECTED] Phone: 816.210.7145 Fax: 816.753.1952 -Original Message- From: Jason Bell [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 12, 2001 4:30 PM To: PHP Users Subject: [PHP] Ip Address to binary does anyone know of a way to convert an IP address to Binary using PHP? My plan is to store the IP address in MySQL so that I can manage a mass amount of IP subnets, and easily make sure I'm not assigning duplicate subnets. the best way I can think of is to use binary. any other ideas, thoughts or comments? Thanks! -Jason Bell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP address from which country
No such table, the best you can do is look at their hostname and parse the last part ie .co.uk or .com... And then u can try and figure where they are from that Andrew - Original Message - From: Zhang, Leon (STHK/Zh) To: [EMAIL PROTECTED] Sent: Wednesday, January 09, 2002 1:03 AM Subject: [PHP] IP address from which country Hi, In php ,we can easily get the ip address of a connected computer ,but I always see on the web that there are some pages can tell you where you are from,so there must be a complete table show the relation of the ip address and country or region ,where can I find this . Thanks . Leon -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
re: [PHP] IP address from which country
Thank you Andrew,but in China mainland ,I saw many websites can even tells the province information which the user come from and I think in USA the State information can also be gotten from the visitor's ip address.BTW,in PHP what we can get is just the ip address of the user how can we get the host name ?Anything missed here? Regards Leon -ÔʼÓʼþ- ·¢¼þÈË: Andrew Brampton [mailto:[EMAIL PROTECTED]] ·¢ËÍʱ¼ä: 09 January, 2002 9:46 ÊÕ¼þÈË: Zhang, Leon (STHK/Zh) ³ËÍ: [EMAIL PROTECTED] Ö÷Ìâ: Re: [PHP] IP address from which country No such table, the best you can do is look at their hostname and parse the last part ie .co.uk or .com... And then u can try and figure where they are from that Andrew - Original Message - From: Zhang, Leon (STHK/Zh) To: [EMAIL PROTECTED] Sent: Wednesday, January 09, 2002 1:03 AM Subject: [PHP] IP address from which country Hi, In php ,we can easily get the ip address of a connected computer ,but I always see on the web that there are some pages can tell you where you are from,so there must be a complete table show the relation of the ip address and country or region ,where can I find this . Thanks . Leon -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] IP address from which country
> Thank you Andrew,but in China mainland ,I saw many websites can even tells > the province information which the user come from and I think in USA the > State information can also be gotten from the visitor's ip address.BTW,in > PHP what we can get is just the ip address of the user how can we get the > host name ?Anything missed here? A database may exist for IPs in China (I don't know), but outside of China it's impossible to tell with much accuracy which country an IP is in. You could look at Digital Envoy, which was an attempt a couple of years ago to 'map the internet' and obtain exactly the data you're referring to. The problem is that as soon as that data is published it's out of date due to routing changes and network configuration changes. You can do a reverse lookup on the IP address to get the hostname, but you can rely on that even less - for example, a hostname ending in aol.com could be in the USA, Europe, Asia, or Australia these days. Jason -- Jason Murray [EMAIL PROTECTED] Web Developer, Melbourne IT "Work now, freak later!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
re: [PHP] IP address from which country
Thank you Jason ,I will check the Digital Envoy to get more information ,have you got the website address of it? -ÔʼÓʼþ- ·¢¼þÈË: Jason Murray [mailto:[EMAIL PROTECTED]] ·¢ËÍʱ¼ä: 09 January, 2002 10:06 ÊÕ¼þÈË: 'Zhang, Leon (STHK/Zh)'; [EMAIL PROTECTED] ³ËÍ: [EMAIL PROTECTED] Ö÷Ìâ: RE: [PHP] IP address from which country > Thank you Andrew,but in China mainland ,I saw many websites can even tells > the province information which the user come from and I think in USA the > State information can also be gotten from the visitor's ip address.BTW,in > PHP what we can get is just the ip address of the user how can we get the > host name ?Anything missed here? A database may exist for IPs in China (I don't know), but outside of China it's impossible to tell with much accuracy which country an IP is in. You could look at Digital Envoy, which was an attempt a couple of years ago to 'map the internet' and obtain exactly the data you're referring to. The problem is that as soon as that data is published it's out of date due to routing changes and network configuration changes. You can do a reverse lookup on the IP address to get the hostname, but you can rely on that even less - for example, a hostname ending in aol.com could be in the USA, Europe, Asia, or Australia these days. Jason -- Jason Murray [EMAIL PROTECTED] Web Developer, Melbourne IT "Work now, freak later!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] IP address from which country
> Thank you Jason ,I will check the Digital Envoy to get more > information, have you got the website address of it? www.google.com ... "digital envoy" ... "I'm feeling lucky" :) ... or just www.digitalenvoy.net. Search engines are fun :) -- Jason Murray [EMAIL PROTECTED] Web Developer, Melbourne IT "Work now, freak later!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP address from which country
>No such table, the best you can do is look at their hostname and parse the last part ie .co.uk or .com... And >then u can try and figure where they are from that Err... Wrong. You could host a .co.uk in the US or any other country for that matter! What you need to do is find the IP do a RIPE lookup at www.ripe.net and that will tell you who the IP is assigned to and where in the world they are. Of course if its a ISP in Maryland, USA they could have a dialup user from Australia connected so it only gives limited information. Regards Jon -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07763 620378 PGP Key available, send email with subject: Send PGP Key -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP address from which country
I 'm not sure, but i beleive you can get visitor's country from Apache 's Varialble $HTTP_ACCEPT_LANGUAGE. For further information read "Predefined Variables" in the manual. Hope it works!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP address from which country
On Wed, Jan 09, 2002 at 11:33:46AM +0200, Dimitris Kossikidis wrote: : : I 'm not sure, but i beleive you can get visitor's country from Apache 's : Varialble $HTTP_ACCEPT_LANGUAGE. For further information read "Predefined : Variables" in the manual. This works assuming the browser itself sends the "correct" country code. Browsers in most places will send a "Content-language: en" regardless of what country the user's browser is running within. -- Eugene Lee [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Ip address as 32bit int?
In MySQL (and others?) you can use these two functions: INET_NTOA(expr) INET_ATON(expr) Regards Joakim - Original Message - From: "Noodle Snacks" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, November 22, 2002 10:13 AM Subject: [PHP] Ip address as 32bit int? Is it easy enough to change a formated IP addy (eg 192.168.0.1) to the 32bit unsigned int that computers use? the reason I ask is because it is alot more efficient space wise in a db to be storing a 32bit number rather that a char or varchar field. Or am I going to run into trouble because all ints are signed in PHP? -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Ip address as 32bit int?
> From: Noodle Snacks [mailto:[EMAIL PROTECTED]] > the reason I ask is because it is alot more efficient space wise > in a db to > be storing a 32bit number rather that a char or varchar field. While it is more efficient space-wise (4 bytes vs. 12 bytes), the price of the additional disk storage needed for storing them is trivial (unless you have a billions). Make sure you consider the addtional costs of maintenance, too, when you store data in a "non-human" format. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] IP Address Filtering - Problem Continues
[snip] The problem is, the spammer is using multiple IP Address. His IP Address changes every 6 - 8 entries. I have so far recorded 5 different IP Addresses of the spammer. Although I can create a Database and keep adding his IP Address to the database, and run a check from the Guestbook script to scan against Blocked Addresses, It¹s not the most efficient method in the world. What other logic can I apply to automatically block the spammer? Or at least have a more efficient method of blocking the Spammer and his IP¹s? [/snip] You could always block a range of IP addresses, but you may cut out a legitimate user. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Filtering - Problem Continues
Jay Blanchard wrote: [snip] The problem is, the spammer is using multiple IP Address. His IP Address changes every 6 - 8 entries. I have so far recorded 5 different IP Addresses of the spammer. Although I can create a Database and keep adding his IP Address to the database, and run a check from the Guestbook script to scan against Blocked Addresses, It¹s not the most efficient method in the world. What other logic can I apply to automatically block the spammer? Or at least have a more efficient method of blocking the Spammer and his IP¹s? [/snip] You could always block a range of IP addresses, but you may cut out a legitimate user. I'm missing the beginning of this thread so maybe it's be mentioned before but is an image CAPTCHA not an option? (and yes I know the accesibility arguments against using CAPTCHA, and the fact that crap CAPCHTA can be broken by image recognition tools - but my pragmatic feeling is that it's often better than a bucket load of SPAM.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Filtering - Problem Continues
At 5:58 PM +0200 4/5/06, Jochem Maas wrote: Jay Blanchard wrote: [snip] The problem is, the spammer is using multiple IP Address. His IP Address changes every 6 - 8 entries. I have so far recorded 5 different IP Addresses of the spammer. Although I can create a Database and keep adding his IP Address to the database, and run a check from the Guestbook script to scan against Blocked Addresses, It's not the most efficient method in the world. What other logic can I apply to automatically block the spammer? Or at least have a more efficient method of blocking the Spammer and his IP's? [/snip] You could always block a range of IP addresses, but you may cut out a legitimate user. I'm missing the beginning of this thread so maybe it's be mentioned before but is an image CAPTCHA not an option? (and yes I know the accesibility arguments against using CAPTCHA, and the fact that crap CAPCHTA can be broken by image recognition tools - but my pragmatic feeling is that it's often better than a bucket load of SPAM.) Not that I promote CAPCHTA, but there are simple solutions that will slow down some spam while allowing some with vision problems to pass, such as -- http://www.xn--ovg.com/captcha -- namely, the graphic selection demo. Granted it's not the best, it doesn't solve everything, and I never said it did (at least no one can prove it) -- so don't whack me for it -- it's just a suggestion. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Filtering - Problem Continues
Ave, I had to eliminate that option because his IP is varying drastically. There is no range, it's just drastically varying. I wouldn't be surprised if he's using an IP Spoofing script/program etcetera. On 4/5/06 11:16 AM, "Jay Blanchard" <[EMAIL PROTECTED]> wrote: > You could always block a range of IP addresses, but you may cut out a > legitimate user. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php Rahul S. Johari Coordinator, Internet & Administration Informed Marketing Services Inc. 500 Federal Street, Suite 201 Troy NY 12180 Tel: (518) 687-6700 x154 Fax: (518) 687-6799 Email: [EMAIL PROTECTED] http://www.informed-sources.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Filtering - Problem Continues
Ave, I'm being left with lesser and lesser choices then to try CAPCHTA. I'm gonna look into it now and see if I need to implement this now. Thanks. On 4/5/06 3:52 PM, "tedd" <[EMAIL PROTECTED]> wrote: > > Not that I promote CAPCHTA, but there are simple solutions that will > slow down some spam while allowing some with vision problems to pass, > such as -- > > http://www.xn--ovg.com/captcha > > -- namely, the graphic selection demo. > > Granted it's not the best, it doesn't solve everything, and I never > said it did (at least no one can prove it) -- so don't whack me for > it -- it's just a suggestion. > > > tedd Rahul S. Johari Coordinator, Internet & Administration Informed Marketing Services Inc. 500 Federal Street, Suite 201 Troy NY 12180 Tel: (518) 687-6700 x154 Fax: (518) 687-6799 Email: [EMAIL PROTECTED] http://www.informed-sources.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Converted to Computer Name
On Tue, 20 Nov 2001 04:08, Ben Clumeck wrote: > I am trying to convert an ip address to a computer name. Then I am > putting it into the mail() script. However, when I do this it come up > blank. I am putting $r_hostname in the mail() script. Can anyone tell > me why its not working? The script I am using is: > $r_hostname = gethostbyaddr($REMOTE_ADDR); > if ($REMOTE_ADDR == "$r_hostname"); > echo "$r_hostname"; > ?> > > Thanks, > > Ben Remember that not all IP adrresses will resolve to a hostname. That said, there may be a flaw in your logic in the code snippet above :-) What you are saying is: gethostname for IPADDR; if HOSTNAME = IPADDR print HOSTNAME which will only work if the resolved hostname is the same as the IP address; I suspect that is not what you want? -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Bald: follicularly challenged. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] IP Address Converted to Computer Name
Thanks for your response David. I am new to PHP. Are you saying that the code would look like this: Would I then put the $HOSTNAME into my mail() script. Sorry for the trouble. Ben -Original Message- From: David Robley [mailto:[EMAIL PROTECTED]] Sent: Monday, November 19, 2001 4:29 PM To: Ben Clumeck; [EMAIL PROTECTED] Subject: Re: [PHP] IP Address Converted to Computer Name On Tue, 20 Nov 2001 04:08, Ben Clumeck wrote: > I am trying to convert an ip address to a computer name. Then I am > putting it into the mail() script. However, when I do this it come up > blank. I am putting $r_hostname in the mail() script. Can anyone tell > me why its not working? The script I am using is: > $r_hostname = gethostbyaddr($REMOTE_ADDR); > if ($REMOTE_ADDR == "$r_hostname"); > echo "$r_hostname"; > ?> > > Thanks, > > Ben Remember that not all IP adrresses will resolve to a hostname. That said, there may be a flaw in your logic in the code snippet above :-) What you are saying is: gethostname for IPADDR; if HOSTNAME = IPADDR print HOSTNAME which will only work if the resolved hostname is the same as the IP address; I suspect that is not what you want? -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Bald: follicularly challenged. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IP Address Converted to Computer Name
On Tue, 20 Nov 2001 11:38, Ben Clumeck wrote: > Thanks for your response David. I am new to PHP. Are you saying that > the code would look like this: > gethostname for $IPADDR; > if $HOSTNAME = $IPADDR > print "$HOSTNAME" > ?> > Would I then put the $HOSTNAME into my mail() script. Sorry for the > trouble. > > Ben > > -Original Message- > From: David Robley [mailto:[EMAIL PROTECTED]] > Sent: Monday, November 19, 2001 4:29 PM > To: Ben Clumeck; [EMAIL PROTECTED] > Subject: Re: [PHP] IP Address Converted to Computer Name > > On Tue, 20 Nov 2001 04:08, Ben Clumeck wrote: > > I am trying to convert an ip address to a computer name. Then I am > > putting it into the mail() script. However, when I do this it come > > up blank. I am putting $r_hostname in the mail() script. Can anyone > > tell me why its not working? The script I am using is: > > > $r_hostname = gethostbyaddr($REMOTE_ADDR); > > if ($REMOTE_ADDR == "$r_hostname"); > > echo "$r_hostname"; > > ?> > > > > Thanks, > > > > Ben > > Remember that not all IP adrresses will resolve to a hostname. That > said, there may be a flaw in your logic in the code snippet above :-) > > What you are saying is: > > gethostname for IPADDR; > if HOSTNAME = IPADDR > print HOSTNAME > > which will only work if the resolved hostname is the same as the IP > address; I suspect that is not what you want? When you reply, can you put your response at the bottom? Makes it ieasier to read the chronological story. Yes, I know Outhouse puts you at the top - another 'feature' from MS. No, I am not saying the code should look like that; what I wrote is pseudocode that just tells what the flow of logic is. To put it simply, you are only asking for $r_hostname to be echoed, in that particular code snippet, if the value in $r_hostname is the same as the IP address. And I notice there is a syntax error or three in your snippet. Now I guess that what you want to do is to add the remote hostname to the email only if it resolves and you get back a hostname rather than an IP address? If that is the case, then you want something like: Note the curly brackets around the contents of the IF. If you substitute the IP addresses 129.96.218.127 and 129.96.218.27 for $REMOTE_ADDR you'll see the first returns a hostname and the second returns just the IP address, so the first will print a hostname and the second won't. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA NEWS! Stolen painting found by tree -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]