Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
t_henson
Regular
Regular



Joined: Feb 02, 2007
Posts: 65
Location: Cincinnati, Ohio

PostPosted: Fri Feb 02, 2007 3:22 am Reply with quote

hi, im looking for information on retrieving some visitor info that i can put into a phpnuke block. i want to get the ip, isp, and the browser. i am currently using these 3 functions:

$browser = $_SERVER['HTTP_USER_AGENT'];
$ip = $_SERVER['REMOTE_ADDR'];
$isp = gethostbyaddr($_SERVER['REMOTE_ADDR']);

this works, and turns out like this (edited of course):

Your IP Address: xx.xx.xx.xx

Your Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061206 Firefox/1.5.0.9

Your ISP: cpe-xx-xx-xx-xx.cinci.res.rr.com

but its not exactly what im looking for. im lookin for something like this:

Your IP Address xx.xx.xx.xx

Your Browser Firefox

Your ISP: Road Runner

is there a way of doing this?
 
View user's profile Send private message
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Fri Feb 02, 2007 10:47 am Reply with quote

Well for the browser, you can use the code like used for the Statistics module to determine what they are using. See includes/counter.php

For the ISP, there isn't a set standard. Esp since there are many many ISPs, it would be really hard to implement in code. You'd really have to get a list of every ISP

_________________
- Only registered users can see links on this board! Get registered or login! -

Need help? Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
t_henson







PostPosted: Fri Feb 02, 2007 12:48 pm Reply with quote

well that worked, thanks.

what im essentially trying to achieve is the same style of info similiar to this image. i just want it to be text instead of an image obviously.

Image
 
hitwalker
Sells PC To Pay For Divorce



Joined:
Posts: 5661

PostPosted: Fri Feb 02, 2007 3:20 pm Reply with quote

i think i have this one right...
put together,works for me....

Code:


<?
// add new browsers in lower case here, separated
// by spaces -  order is important: from left to
// right browser family becomes more precise
$browsers = "mozilla msie gecko firefox ";
$browsers.= "konqueror safari netscape navigator ";
$browsers.= "opera mosaic lynx amaya omniweb";
$browsers = split(" ", $browsers);
$nua = strToLower( $_SERVER['HTTP_USER_AGENT']);
$l = strlen($nua);
for ($i=0; $i<count($browsers); $i++){
$browser = $browsers[$i];
$n = stristr($nua, $browser);
if(strlen($n)>0){
$GLOBALS["ver"] = "";
$GLOBALS["nav"] = $browser;
$j=strpos($nua, $GLOBALS["nav"])+$n+strlen($GLOBALS["nav"])+1;
for (; $j<=$l; $j++){
$s = substr ($nua, $j, 1);
if(is_numeric($GLOBALS["ver"].$s) )
$GLOBALS["ver"] .= $s;
else
break;
}
}
}
echo("<pre>Your browser: ");
echo($GLOBALS["nav"] . " " . $GLOBALS["ver"] . "</pre>");
$agent = getenv("http_user_agent");
$ip = $_SERVER['REMOTE_ADDR'];
$fullhost = gethostbyaddr($ip);
$host = preg_replace('/^[^.]+./', '*.', $fullhost);
?>
IP address <?=$ip?><br />
Host: <?=$host?>
 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©