NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Rather Easy PHP Question

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 01-08-2006, 10:16 PM THREAD STARTER               #1 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)

Talking Rather Easy PHP Question


Call me stupid, but how do you find the user's IP address through a proxy?

This is MY money on the line, so I need to make sure that users can't submit a form more than once and get more of my money fraudulently or through proxies.

I need one of the best IP finder scripts you can get me... free of course

$REMOTE_ADDR, yeah, I use that, but what about going PAST the proxy?

Any help appreciated,
-Matt
mholt is offline  
Old 01-08-2006, 10:39 PM   #2 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Wouldn't something like this work? Heh, I may do some searching, but anyway...

PHP Code:
<?php

if($_SERVER['HTTP_X_FORWARDED_FOR'])
{
  echo 
$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
  echo 
$_SERVER['REMOTE_ADDR'];
????: NamePros.com http://www.namepros.com/programming/155615-rather-easy-php-question.html
}

?>
Eric is offline  
Old 01-08-2006, 10:41 PM   #3 (permalink)
NamePros Regular
Join Date: Dec 2005
Posts: 210
wackyjoe is on a distinguished road
 



getip() will return the most accurate client IP possible:

PHP Code:
<?php
function validip($ip) {
   if (!empty(
$ip) && ip2long($ip)!=-1) {
       
$reserved_ips = array (
       array(
'0.0.0.0','2.255.255.255'),
????: NamePros.com http://www.namepros.com/showthread.php?t=155615
       array(
'10.0.0.0','10.255.255.255'),
       array(
'127.0.0.0','127.255.255.255'),
       array(
'169.254.0.0','169.254.255.255'),
       array(
'172.16.0.0','172.31.255.255'),
       array(
'192.0.2.0','192.0.2.255'),
       array(
'192.168.0.0','192.168.255.255'),
       array(
'255.255.255.0','255.255.255.255')
       );

       foreach (
$reserved_ips as $r) {
           
$min ip2long($r[0]);
           
$max ip2long($r[1]);
           if ((
ip2long($ip) >= $min) && (ip2long($ip) <= $max)) return false;
       }
       return 
true;
   } else {
       return 
false;
   }
}

function 
getip() {
   if (
validip($_SERVER["HTTP_CLIENT_IP"])) {
       return 
$_SERVER["HTTP_CLIENT_IP"];
   }
   foreach (
explode(",",$_SERVER["HTTP_X_FORWARDED_FOR"]) as $ip) {
       if (
validip(trim($ip))) {
           return 
$ip;
       }
   }
   if (
validip($_SERVER["HTTP_X_FORWARDED"])) {
       return 
$_SERVER["HTTP_X_FORWARDED"];
   } elseif (
validip($_SERVER["HTTP_FORWARDED_FOR"])) {
       return 
$_SERVER["HTTP_FORWARDED_FOR"];
   } elseif (
validip($_SERVER["HTTP_FORWARDED"])) {
       return 
$_SERVER["HTTP_FORWARDED"];
   } elseif (
validip($_SERVER["HTTP_X_FORWARDED"])) {
????: NamePros.com http://www.namepros.com/showthread.php?t=155615
       return 
$_SERVER["HTTP_X_FORWARDED"];
   } else {
       return 
$_SERVER["REMOTE_ADDR"];
   }
}
?>
wackyjoe is offline  
Old 01-08-2006, 11:07 PM THREAD STARTER               #4 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Thanks, both! What does validip() do? Return true if it's a real IP address? Should I use both?
mholt is offline  
Old 01-09-2006, 01:15 AM   #5 (permalink)
NamePros Regular
Join Date: Dec 2005
Posts: 210
wackyjoe is on a distinguished road
 



yes use both
wackyjoe is offline  
Old 01-10-2006, 01:41 PM THREAD STARTER               #6 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Hey,

Thanks a lot for the scripts

However, I tried using my site with a proxy and it still wouldn't come up with the error message I was expecting...

The proxy I was using is www.freeproxy.us

Any ideas?
mholt is offline  
Old 01-10-2006, 03:54 PM   #7 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,556
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
The bottom line is that some proxies are anonymous and some are not.
Proxies that reveal your actual IP via HTTP variables like HTTP_X_FORWARDED_FOR are not anonymous.
Therefore it is not always possible to check if a visitor is concealing their real IP.
It depends on how transparent or anonymous the proxy is.
Also some proxies may reveal the visitor IP in non-standard HTTP variables names, so they won't be noticed by your script but may appear at eye glance.

Some info here which you may find useful: http://www.stayinvisible.com/index.p...ymity_of_proxy
__________________
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
sdsinc is offline  
Old 01-10-2006, 04:54 PM THREAD STARTER               #8 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Ah, thanks...

-Matt (Rep +)
mholt is offline  
Old 01-11-2006, 03:37 PM   #9 (permalink)
Account Closed
 
axilant's Avatar
Join Date: May 2004
Location: /etc/passwd
Posts: 2,178
axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold
 

Member of the Month
July 2005

I have a database with 189,471 working proxy ip addresses (Updated daily)

Willing to sell this list $325. This is probably the most efficient way to block a proxy.

Cody
axilant is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie PHP Question thetzfreak Programming 6 12-30-2005 03:25 PM
PHP BB Question Clarity Pictures Programming 1 12-29-2005 06:29 PM
Huge Xmas script pack sale $5.00 KPR Scripts For Sale 1 12-08-2005 07:25 PM
Have a question it's either MYSQL or PHP. Coolprogram Programming 11 10-13-2005 02:14 AM
PHP question bena8705 Programming 4 12-23-2004 08:28 AM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 12:14 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger