User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 363,391 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,818 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 391 | Replies: 2 | Solved
Reply
Join Date: Sep 2007
Posts: 61
Reputation: cwarn23 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 6
cwarn23 cwarn23 is offline Offline
Junior Poster in Training

isp auto-detect

  #1  
May 10th, 2008
I have been designing a security system to stop bots from spamming my forum. Basically, it will check if there is any isp name detected from the ip address then if there is no detected isp, the submitted post will not be made. I know to detect the ip address, I simply use:
$ip=$_SERVER[REMOTE_ADDR];
However it will only get the ip numbers. I need a php script which will only get the isp so i can do something along the lines of the following.
if($isp='') { } else {
//rest of code
}
The above code is just a sketch of what I think it will look like but I just need to be able to get the isp information in the $isp variable. I have searched and searched all over google and the hotscripts website and still haven't found the answer. Would anybody here be able to provide any links or ways to find the isp without any other info being bundled in the defining of the $isp variable. An example of what the data stored in the $isp variable would look like is:
qld.bigpond.net.au
or
nyc.res.rr.com

Thanks in advance
Signature note:
Do not edit the registry just because someone on the forum says so. Do some research on the internet before editing the registry.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2005
Location: New York state
Posts: 438
Reputation: ShawnCplus will become famous soon enough ShawnCplus will become famous soon enough 
Rep Power: 5
Solved Threads: 61
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey

Re: isp auto-detect

  #2  
May 10th, 2008
What you're looking to get is the hostname, not the IP. http://us.php.net/manual/en/function.gethostbyaddr.php
GCS d- s+:+ a-->? C++(++++) UL+++ P+>+++ L+++ !E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r z+*
Reply With Quote  
Join Date: Sep 2007
Posts: 61
Reputation: cwarn23 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 6
cwarn23 cwarn23 is offline Offline
Junior Poster in Training

Re: isp auto-detect

  #3  
May 10th, 2008
It took a long time looking at the page you have suggested but I found the answer deep within the page ShawnCplus suggested. Below is the script I found deep within the suggested link which works perfectly.
<?php
    $ip = $_SERVER['REMOTE_ADDR'];
    $fullhost = gethostbyaddr($ip);
    $host = preg_replace("/^[^.]+./", "", $fullhost);

echo $host;
?>
So thanks ShawnCplus as your reply will really help with preventing bots from spamming my forum.
*Solved*
Signature note:
Do not edit the registry just because someone on the forum says so. Do some research on the internet before editing the registry.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

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

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 12:35 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC