Ip sig problem

Mitch

New Member
Messages
908
Reaction score
0
Points
0
I have got a ip sig. It works but the os and browser are not visible.
http://mitch.exofire.net/ip2.php
PHP:
<?php

if(!empty($_SERVER['HTTP_USER_AGENT'])) //look if you can use the modern http user agent
{ 
   $browserinfo = $_SERVER['HTTP_USER_AGENT'];
} 
elseif(!empty($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) //else look that we can use the old one.
{ 
   $browserinfo = $HTTP_SERVER_VARS['HTTP_USER_AGENT']; 
} 

if(isset($browserinfo)) // HTTP_USER_AGENT Data
{
    
    $browser = array(array('Opera', 'Opera(/| )([0-9].[0-9]{1,2})', 2),
                     array('iCab', 'iCab ([0-9].[0-9].[0-9])', 1),
                     array('Blazer', 'Blazer/([0-9].[0-9])', 1),
                     array('Internet Explorer', 'MSIE ([0-9].[0-9]{1,2})', 1),
                     array('Ombiweb', 'OmniWeb/([0-9].[0-9]{1,2})', 1),
                     array('Netscape', 'Netscape/([0-9].[0-9])', 1),
                     array('Firefox', 'Firefox/([0-9].(([0-9]{1,2})|([0-9].[0-9]{1,2})))', 1),
                     array('Konqueror', 'Konqueror/([0-9].[0-9]{1,2})', 1),
                     array('Safari', 'Safari/([0-9].[0-9]{1,2})', 1),
                     array('Lynx', 'Lynx/([0-9].[0-9].(([0-9]{1,2})|([0-9][a-z]+.[0-9])))', 1), 
                     array('Wget', 'Wget/([0-9].[0-9]{1,2}.[0-9])', 1),
                     array('Mozilla', 'Mozilla/([0-9].[0-9]{1,2})', 1),
                     array('Konqueror', 'Konqueror/([0-9].[0-9]{1,2})', 1));
    
    foreach($browser as $navigator) //
    {
        if(ereg($navigator[1], $browserinfo, $versie))
        { 
           $browser = $navigator[0]; // what for browser it is.
           $browserversie = $versie[$navigator[2]];  // version
           break; // stopped the foreach
        }
    }
    

    $os = array(array('Linux', 'linux'),
                     array('Windows', 'win32'),
                     array('Palm OS', 'Palm'),
                     array('Windows ME', 'Win 9x 4.90'),
                     array('Windows XP Mediacenter edition', 'Media Center PC'),
                     array('Windows 2000', 'windows 2000'),
                     array('Windows 2000', 'windows nt)( ){0,1}(5.0)'),
                     array('Windows Vista', 'windows NT (6.[0-9])'),
                     array('Windows XP', '(windows nt)( ){0,1}(5.1)'),
                     array('Windows Mobile', 'Windows CE'),
                     array('Windows ', '(windows) ([0-9]{2})', 2),
                     array('Windows NT ', '(winnt)([0-9]{1,2}.[0-9]{1,2}){0,1}', 2),
                     array('Windows NT ', '(windows nt)( ){0,1}([0-9]{1,2}.[0-9]{1,2}){0,1}', 3),
                     array('Mac OS X', 'Mac OS X'),
                     array('mac', 'MAC'),
                     array('SunOS ', '(sunos) ([0-9]{1,2}.[0-9]{1,2}){0,1}', 2),
                     array('BeOS ', '(beos) r([0-9]{1,2}.[0-9]{1,2}){0,1}', 2),
                     array('FreeBSD', 'freebsd'),
                     array('OpenBSD', 'openbsd'),
                     array('IRIX', 'irix'),
                     array('OS/2', 'os/2)'),
                     array('plan', 'Plan9'),
                     array('Unix', 'unix'),
                     array('OSF', 'osf'));

    foreach($os as $besturingss) 
    {
        if(isset($bestuuringss[2]))
        {
            if(eregi($besturingss[1],$browserinfo,$versie))
            {
                $best = $besturingss[0].$versie[$besturingss[2]];
                break; 
            }
        }
        else 
        {
            if(eregi($besturingss[1],$browserinfo)) 
            {
                $best = $besturingss[0]; 
                break; 
            }
        }
    }

    $gegevens['browser']        = (isset($browser)) ? $browser : 'Unknown';
    $gegevens['browserversie']    = (isset($browserversie)) ? $browserversie : 'Unknown';
    $gegevens['os']                = (isset($best)) ? $best : 'Unknown';
    
    /*

        Not really needed.

    */
    
    foreach($gegevens as $controle) 
    {
        if($controle == 'unknown') 
        {
            $gegevens['unknown'] = $browserinfo; 
            break; 
        }
    }
    
        if(isset($gegevens['unknown']))
    {
        echo $gegevens['unknown']; 
    }

}
else // if http_vars is not available
{
    echo 'This function cannot be executed this server'; 
}
    
$image = "ip.png";
// Color
$im = imagecreatefrompng($image);
$red = imagecolorallocate ($im, 255, 0, 0);
$blue = imagecolorallocate ($im, 0, 0, 255);
$white = imagecolorallocate ($im, 255, 255, 255);
$black = imagecolorallocate ($im, 0, 0, 0);
imagecolortransparent($im, $white);
imagefill($im, 0, 0, $white);

$number = "Your IP is " . $_SERVER['REMOTE_ADDR'];
$rquote = random_quote();
$font = 10;
$font2 = 1;

// Number
$image_width = imagesx($im);
$string_width = imagefontwidth($font)*strlen($number);
$center = ($image_width-$string_width)/2;

// Quote = 72
$image_width2 = imagesx($im);
$string_width2 = imagefontwidth($font2)*strlen($rquote);
$center2 = ($image_width2-$string_width2)/2;

Imagestring($im, $font, $center, 17, $number, $red);
Imagestring($im , $font2, $center2, 40, $rquote, $blue);

    function random_quote( ) 

    {

    $quotes[] = "Copyrights MITCH.EXOFIRE.NET";
    
    $quotes[] = "Your provider: " . $_SERVER['REMOTE_HOST'];
    
    $quotes[] = "Your OS: " . $gegevens['os'];
    
    $quotes[] = "Your Browser: " . $gegevens['browser'];
    
    srand ((double) microtime() * 1000000);

    $random_number = rand(0,count($quotes)-1); 

    return $quotes[$random_number];

    }

header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
 

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
Sorry i am not in a mood to debug your code, rather i will post another code which i have download from the internet for you.

PHP:
<?php
/*****************************************************************

    File name: browser.php
    Author: Gary White
    Last modified: November 10, 2003
    
    **************************************************************

    Copyright (C) 2003  Gary White
    
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details at:
    http://www.gnu.org/copyleft/gpl.html

    **************************************************************

    Browser class
    
    Identifies the user's Operating system, browser and version
    by parsing the HTTP_USER_AGENT string sent to the server
    
    Typical Usage:
    
        require_once($_SERVER['DOCUMENT_ROOT'].'/include/browser.php');
        $br = new Browser;
        echo "$br->Platform, $br->Name version $br->Version";
    
    For operating systems, it will correctly identify:
        Microsoft Windows
        MacIntosh
        Linux

    Anything not determined to be one of the above is considered to by Unix
    because most Unix based browsers seem to not report the operating system.
    The only known problem here is that, if a HTTP_USER_AGENT string does not
    contain the operating system, it will be identified as Unix. For unknown
    browsers, this may not be correct.
    
    For browsers, it should correctly identify all versions of:
        Amaya
        Galeon
        iCab
        Internet Explorer
            For AOL versions it will identify as Internet Explorer (AOL) and the version
            will be the AOL version instead of the IE version.
        Konqueror
        Lynx
        Mozilla
        Netscape Navigator/Communicator
        OmniWeb
        Opera
        Pocket Internet Explorer for handhelds
        Safari
        WebTV
*****************************************************************/

class browser{

    var $Name = "Unknown";
    var $Version = "Unknown";
    var $Platform = "Unknown";
    var $UserAgent = "Not reported";
    var $AOL = false;

    function browser(){
        $agent = $_SERVER['HTTP_USER_AGENT'];

        // initialize properties
        $bd['platform'] = "Unknown";
        $bd['browser'] = "Unknown";
        $bd['version'] = "Unknown";
        $this->UserAgent = $agent;

        // find operating system
        if (eregi("win", $agent))
            $bd['platform'] = "Windows";
        elseif (eregi("mac", $agent))
            $bd['platform'] = "MacIntosh";
        elseif (eregi("linux", $agent))
            $bd['platform'] = "Linux";
        elseif (eregi("OS/2", $agent))
            $bd['platform'] = "OS/2";
        elseif (eregi("BeOS", $agent))
            $bd['platform'] = "BeOS";

        // test for Opera        
        if (eregi("opera",$agent)){
            $val = stristr($agent, "opera");
            if (eregi("/", $val)){
                $val = explode("/",$val);
                $bd['browser'] = $val[0];
                $val = explode(" ",$val[1]);
                $bd['version'] = $val[0];
            }else{
                $val = explode(" ",stristr($val,"opera"));
                $bd['browser'] = $val[0];
                $bd['version'] = $val[1];
            }

        // test for WebTV
        }elseif(eregi("webtv",$agent)){
            $val = explode("/",stristr($agent,"webtv"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
        
        // test for MS Internet Explorer version 1
        }elseif(eregi("microsoft internet explorer", $agent)){
            $bd['browser'] = "MSIE";
            $bd['version'] = "1.0";
            $var = stristr($agent, "/");
            if (ereg("308|425|426|474|0b1", $var)){
                $bd['version'] = "1.5";
            }

        // test for NetPositive
        }elseif(eregi("NetPositive", $agent)){
            $val = explode("/",stristr($agent,"NetPositive"));
            $bd['platform'] = "BeOS";
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];

        // test for MS Internet Explorer
        }elseif(eregi("msie",$agent) && !eregi("opera",$agent)){
            $val = explode(" ",stristr($agent,"msie"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
        
        // test for MS Pocket Internet Explorer
        }elseif(eregi("mspie",$agent) || eregi('pocket', $agent)){
            $val = explode(" ",stristr($agent,"mspie"));
            $bd['browser'] = "MSPIE";
            $bd['platform'] = "WindowsCE";
            if (eregi("mspie", $agent))
                $bd['version'] = $val[1];
            else {
                $val = explode("/",$agent);
                $bd['version'] = $val[1];
            }
            
        // test for Galeon
        }elseif(eregi("galeon",$agent)){
            $val = explode(" ",stristr($agent,"galeon"));
            $val = explode("/",$val[0]);
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
            
        // test for Konqueror
        }elseif(eregi("Konqueror",$agent)){
            $val = explode(" ",stristr($agent,"Konqueror"));
            $val = explode("/",$val[0]);
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
            
        // test for iCab
        }elseif(eregi("icab",$agent)){
            $val = explode(" ",stristr($agent,"icab"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];

        // test for OmniWeb
        }elseif(eregi("omniweb",$agent)){
            $val = explode("/",stristr($agent,"omniweb"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];

        // test for Phoenix
        }elseif(eregi("Phoenix", $agent)){
            $bd['browser'] = "Phoenix";
            $val = explode("/", stristr($agent,"Phoenix/"));
            $bd['version'] = $val[1];
        
        // test for Firebird
        }elseif(eregi("firebird", $agent)){
            $bd['browser']="Firebird";
            $val = stristr($agent, "Firebird");
            $val = explode("/",$val);
            $bd['version'] = $val[1];
            
        // test for Firefox
        }elseif(eregi("Firefox", $agent)){
            $bd['browser']="Firefox";
            $val = stristr($agent, "Firefox");
            $val = explode("/",$val);
            $bd['version'] = $val[1];
            
      // test for Mozilla Alpha/Beta Versions
        }elseif(eregi("mozilla",$agent) && 
            eregi("rv:[0-9].[0-9][a-b]",$agent) && !eregi("netscape",$agent)){
            $bd['browser'] = "Mozilla";
            $val = explode(" ",stristr($agent,"rv:"));
            eregi("rv:[0-9].[0-9][a-b]",$agent,$val);
            $bd['version'] = str_replace("rv:","",$val[0]);
            
        // test for Mozilla Stable Versions
        }elseif(eregi("mozilla",$agent) &&
            eregi("rv:[0-9]\.[0-9]",$agent) && !eregi("netscape",$agent)){
            $bd['browser'] = "Mozilla";
            $val = explode(" ",stristr($agent,"rv:"));
            eregi("rv:[0-9]\.[0-9]\.[0-9]",$agent,$val);
            $bd['version'] = str_replace("rv:","",$val[0]);
        
        // test for Lynx & Amaya
        }elseif(eregi("libwww", $agent)){
            if (eregi("amaya", $agent)){
                $val = explode("/",stristr($agent,"amaya"));
                $bd['browser'] = "Amaya";
                $val = explode(" ", $val[1]);
                $bd['version'] = $val[0];
            } else {
                $val = explode("/",$agent);
                $bd['browser'] = "Lynx";
                $bd['version'] = $val[1];
            }
        
        // test for Safari
        }elseif(eregi("safari", $agent)){
            $bd['browser'] = "Safari";
            $bd['version'] = "";

        // remaining two tests are for Netscape
        }elseif(eregi("netscape",$agent)){
            $val = explode(" ",stristr($agent,"netscape"));
            $val = explode("/",$val[0]);
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
        }elseif(eregi("mozilla",$agent) && !eregi("rv:[0-9]\.[0-9]\.[0-9]",$agent)){
            $val = explode(" ",stristr($agent,"mozilla"));
            $val = explode("/",$val[0]);
            $bd['browser'] = "Netscape";
            $bd['version'] = $val[1];
        }
        
        // clean up extraneous garbage that may be in the name
        $bd['browser'] = ereg_replace("[^a-z,A-Z]", "", $bd['browser']);
        // clean up extraneous garbage that may be in the version        
        $bd['version'] = ereg_replace("[^0-9,.,a-z,A-Z]", "", $bd['version']);
        
        // check for AOL
        if (eregi("AOL", $agent)){
            $var = stristr($agent, "AOL");
            $var = explode(" ", $var);
            $bd['aol'] = ereg_replace("[^0-9,.,a-z,A-Z]", "", $var[1]);
        }
        
        // finally assign our properties
        $this->Name = $bd['browser'];
        $this->Version = $bd['version'];
        $this->Platform = $bd['platform'];
        $this->AOL = $bd['aol'];
    }
}
?>

Hope this helps you
 

Mitch

New Member
Messages
908
Reaction score
0
Points
0
I tried to do this:
PHP:
<?php

class browser{

    var $Name = "Unknown";
    var $Version = "Unknown";
    var $Platform = "Unknown";
    var $UserAgent = "Not reported";
    var $AOL = false;

    function browser(){
        $agent = $_SERVER['HTTP_USER_AGENT'];

        // initialize properties
        $bd['platform'] = "Unknown";
        $bd['browser'] = "Unknown";
        $bd['version'] = "Unknown";
        $this->UserAgent = $agent;

        // find operating system
        if (eregi("win", $agent))
            $bd['platform'] = "Windows";
        elseif (eregi("mac", $agent))
            $bd['platform'] = "MacIntosh";
        elseif (eregi("linux", $agent))
            $bd['platform'] = "Linux";
        elseif (eregi("OS/2", $agent))
            $bd['platform'] = "OS/2";
        elseif (eregi("BeOS", $agent))
            $bd['platform'] = "BeOS";

        // test for Opera        
        if (eregi("opera",$agent)){
            $val = stristr($agent, "opera");
            if (eregi("/", $val)){
                $val = explode("/",$val);
                $bd['browser'] = $val[0];
                $val = explode(" ",$val[1]);
                $bd['version'] = $val[0];
            }else{
                $val = explode(" ",stristr($val,"opera"));
                $bd['browser'] = $val[0];
                $bd['version'] = $val[1];
            }

        // test for WebTV
        }elseif(eregi("webtv",$agent)){
            $val = explode("/",stristr($agent,"webtv"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
        
        // test for MS Internet Explorer version 1
        }elseif(eregi("microsoft internet explorer", $agent)){
            $bd['browser'] = "MSIE";
            $bd['version'] = "1.0";
            $var = stristr($agent, "/");
            if (ereg("308|425|426|474|0b1", $var)){
                $bd['version'] = "1.5";
            }

        // test for NetPositive
        }elseif(eregi("NetPositive", $agent)){
            $val = explode("/",stristr($agent,"NetPositive"));
            $bd['platform'] = "BeOS";
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];

        // test for MS Internet Explorer
        }elseif(eregi("msie",$agent) && !eregi("opera",$agent)){
            $val = explode(" ",stristr($agent,"msie"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
        
        // test for MS Pocket Internet Explorer
        }elseif(eregi("mspie",$agent) || eregi('pocket', $agent)){
            $val = explode(" ",stristr($agent,"mspie"));
            $bd['browser'] = "MSPIE";
            $bd['platform'] = "WindowsCE";
            if (eregi("mspie", $agent))
                $bd['version'] = $val[1];
            else {
                $val = explode("/",$agent);
                $bd['version'] = $val[1];
            }
            
        // test for Galeon
        }elseif(eregi("galeon",$agent)){
            $val = explode(" ",stristr($agent,"galeon"));
            $val = explode("/",$val[0]);
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
            
        // test for Konqueror
        }elseif(eregi("Konqueror",$agent)){
            $val = explode(" ",stristr($agent,"Konqueror"));
            $val = explode("/",$val[0]);
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
            
        // test for iCab
        }elseif(eregi("icab",$agent)){
            $val = explode(" ",stristr($agent,"icab"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];

        // test for OmniWeb
        }elseif(eregi("omniweb",$agent)){
            $val = explode("/",stristr($agent,"omniweb"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];

        // test for Phoenix
        }elseif(eregi("Phoenix", $agent)){
            $bd['browser'] = "Phoenix";
            $val = explode("/", stristr($agent,"Phoenix/"));
            $bd['version'] = $val[1];
        
        // test for Firebird
        }elseif(eregi("firebird", $agent)){
            $bd['browser']="Firebird";
            $val = stristr($agent, "Firebird");
            $val = explode("/",$val);
            $bd['version'] = $val[1];
            
        // test for Firefox
        }elseif(eregi("Firefox", $agent)){
            $bd['browser']="Firefox";
            $val = stristr($agent, "Firefox");
            $val = explode("/",$val);
            $bd['version'] = $val[1];
            
      // test for Mozilla Alpha/Beta Versions
        }elseif(eregi("mozilla",$agent) && 
            eregi("rv:[0-9].[0-9][a-b]",$agent) && !eregi("netscape",$agent)){
            $bd['browser'] = "Mozilla";
            $val = explode(" ",stristr($agent,"rv:"));
            eregi("rv:[0-9].[0-9][a-b]",$agent,$val);
            $bd['version'] = str_replace("rv:","",$val[0]);
            
        // test for Mozilla Stable Versions
        }elseif(eregi("mozilla",$agent) &&
            eregi("rv:[0-9]\.[0-9]",$agent) && !eregi("netscape",$agent)){
            $bd['browser'] = "Mozilla";
            $val = explode(" ",stristr($agent,"rv:"));
            eregi("rv:[0-9]\.[0-9]\.[0-9]",$agent,$val);
            $bd['version'] = str_replace("rv:","",$val[0]);
        
        // test for Lynx & Amaya
        }elseif(eregi("libwww", $agent)){
            if (eregi("amaya", $agent)){
                $val = explode("/",stristr($agent,"amaya"));
                $bd['browser'] = "Amaya";
                $val = explode(" ", $val[1]);
                $bd['version'] = $val[0];
            } else {
                $val = explode("/",$agent);
                $bd['browser'] = "Lynx";
                $bd['version'] = $val[1];
            }
        
        // test for Safari
        }elseif(eregi("safari", $agent)){
            $bd['browser'] = "Safari";
            $bd['version'] = "";

        // remaining two tests are for Netscape
        }elseif(eregi("netscape",$agent)){
            $val = explode(" ",stristr($agent,"netscape"));
            $val = explode("/",$val[0]);
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
        }elseif(eregi("mozilla",$agent) && !eregi("rv:[0-9]\.[0-9]\.[0-9]",$agent)){
            $val = explode(" ",stristr($agent,"mozilla"));
            $val = explode("/",$val[0]);
            $bd['browser'] = "Netscape";
            $bd['version'] = $val[1];
        }
        
        // clean up extraneous garbage that may be in the name
        $bd['browser'] = ereg_replace("[^a-z,A-Z]", "", $bd['browser']);
        // clean up extraneous garbage that may be in the version        
        $bd['version'] = ereg_replace("[^0-9,.,a-z,A-Z]", "", $bd['version']);
        
        // check for AOL
        if (eregi("AOL", $agent)){
            $var = stristr($agent, "AOL");
            $var = explode(" ", $var);
            $bd['aol'] = ereg_replace("[^0-9,.,a-z,A-Z]", "", $var[1]);
        }
        
        // finally assign our properties
        $this->Name = $bd['browser'];
        $this->Version = $bd['version'];
        $this->Platform = $bd['platform'];
        $this->AOL = $bd['aol'];
    }
}
	
$image = "ip.png";
// Color
$im = imagecreatefrompng($image);
$red = imagecolorallocate ($im, 255, 0, 0);
$blue = imagecolorallocate ($im, 0, 0, 255);
$white = imagecolorallocate ($im, 255, 255, 255);
$black = imagecolorallocate ($im, 0, 0, 0);
imagecolortransparent($im, $white);
imagefill($im, 0, 0, $white);

$number = "Your IP is " . $_SERVER['REMOTE_ADDR'];
$rquote = random_quote();
$font = 10;
$font2 = 1;

// Number
$image_width = imagesx($im);
$string_width = imagefontwidth($font)*strlen($number);
$center = ($image_width-$string_width)/2;

// Quote = 72
$image_width2 = imagesx($im);
$string_width2 = imagefontwidth($font2)*strlen($rquote);
$center2 = ($image_width2-$string_width2)/2;

Imagestring($im, $font, $center, 17, $number, $red);
Imagestring($im , $font2, $center2, 40, $rquote, $blue);

    function random_quote( ) 

    {

    $quotes[] = "Copyrights MITCH.EXOFIRE.NET";
    
	$quotes[] = "Your provider: " . $_SERVER['REMOTE_HOST'];
	
	$quotes[] = "Your OS: " . $bd['platform'];
	
	$quotes[] = "Your Browser: " . $bd['browser'];
	
    srand ((double) microtime() * 1000000);

    $random_number = rand(0,count($quotes)-1); 

    return $quotes[$random_number];

    }

header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
But it doesn't work

I think the problem is somewhere here
PHP:
    {

    $quotes[] = "Copyrights MITCH.EXOFIRE.NET";
    
    $quotes[] = "Your provider: " . $_SERVER['REMOTE_HOST'];
    
    $quotes[] = "Your OS: " . $bd['platform'];
    
    $quotes[] = "Your Browser: " . $bd['browser'];
    
    srand ((double) microtime() * 1000000);

    $random_number = rand(0,count($quotes)-1); 

    return $quotes[$random_number];

    }
 
Last edited:

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
didnt read the usage part?

here its:-

Typical Usage:

require_once($_SERVER['DOCUMENT_ROOT'].'/include/browser.php');
$br = new Browser;
echo "$br->Platform, $br->Name version $br->Version";

It will work 101% as i have previously used this.

 

Mitch

New Member
Messages
908
Reaction score
0
Points
0
I can't get out of this.
The one who makes a os, platform and lang at quotes will get 50 credits.

PHP:
<?php
	
$image = "ip.png";
// Color
$im = imagecreatefrompng($image);
$red = imagecolorallocate ($im, 255, 0, 0);
$blue = imagecolorallocate ($im, 0, 0, 255);
$white = imagecolorallocate ($im, 255, 255, 255);
$black = imagecolorallocate ($im, 0, 0, 0);
imagecolortransparent($im, $white);
imagefill($im, 0, 0, $white);

$number = "Your IP is ".$_SERVER['REMOTE_ADDR'];
$rquote = random_quote();
$font = 10;
$font2 = 1;

// Number
$image_width = imagesx($im);
$string_width = imagefontwidth($font)*strlen($number);
$center = ($image_width-$string_width)/2;

// Quote = 72
$image_width2 = imagesx($im);
$string_width2 = imagefontwidth($font2)*strlen($rquote);
$center2 = ($image_width2-$string_width2)/2;

Imagestring($im, $font, $center, 17, $number, $red);
Imagestring($im , $font2, $center2, 40, $rquote, $blue);

    function random_quote( ) 

    {

    $quotes[] = 'Copyrights MITCH.EXOFIRE.NET';
    
	$quotes[] = 'Your LANG: ';
	
	$quotes[] = 'Your OS: ';
	
	$quotes[] = 'Your Browser: ';
	
    srand ((double) microtime() * 1000000);

    $random_number = rand(0,count($quotes)-1); 

    return $quotes[$random_number];

    }

header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
 
Last edited:

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
ok since you are asking here is the code. just past it in the file and use it.

PHP:
<?php
    
$image = "ip.png";
// Color
$im = imagecreatefrompng($image);
$red = imagecolorallocate ($im, 255, 0, 0);
$blue = imagecolorallocate ($im, 0, 0, 255);
$white = imagecolorallocate ($im, 255, 255, 255);
$black = imagecolorallocate ($im, 0, 0, 0);
imagecolortransparent($im, $white);
imagefill($im, 0, 0, $white);

$number = "Your IP is ".$_SERVER['REMOTE_ADDR'];
$rquote = random_quote();
$font = 10;
$font2 = 1;

// Number
$image_width = imagesx($im);
$string_width = imagefontwidth($font)*strlen($number);
$center = ($image_width-$string_width)/2;

// Quote = 72
$image_width2 = imagesx($im);
$string_width2 = imagefontwidth($font2)*strlen($rquote);
$center2 = ($image_width2-$string_width2)/2;

Imagestring($im, $font, $center, 17, $number, $red);
Imagestring($im , $font2, $center2, 40, $rquote, $blue);

    function random_quote( ) 

    {
     $br = new Browser;
    $quotes[] = 'Copyrights MITCH.EXOFIRE.NET';
    
    $quotes[] = 'Language :- '.substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,5);
    
    $quotes[] = 'Operating System :- '.$br->Platform;
    
    $quotes[] = 'Browser :- '.$br->Name;
    
    srand ((double) microtime() * 1000000);

    $random_number = rand(0,count($quotes)-1); 

    return $quotes[$random_number];

    }

header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?> 

<?php
/*****************************************************************

    File name: browser.php
    Author: Gary White
    Last modified: November 10, 2003
    
    **************************************************************

    Copyright (C) 2003  Gary White
    
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details at:
    http://www.gnu.org/copyleft/gpl.html
**********************************************************************/
class browser{

    var $Name = "Unknown";
    var $Version = "Unknown";
    var $Platform = "Unknown";
    var $UserAgent = "Not reported";
    var $AOL = false;

    function browser(){
        $agent = $_SERVER['HTTP_USER_AGENT'];

        // initialize properties
        $bd['platform'] = "Unknown";
        $bd['browser'] = "Unknown";
        $bd['version'] = "Unknown";
        $this->UserAgent = $agent;

        // find operating system
        if (eregi("win", $agent))
            $bd['platform'] = "Windows";
        elseif (eregi("mac", $agent))
            $bd['platform'] = "MacIntosh";
        elseif (eregi("linux", $agent))
            $bd['platform'] = "Linux";
        elseif (eregi("OS/2", $agent))
            $bd['platform'] = "OS/2";
        elseif (eregi("BeOS", $agent))
            $bd['platform'] = "BeOS";

        // test for Opera        
        if (eregi("opera",$agent)){
            $val = stristr($agent, "opera");
            if (eregi("/", $val)){
                $val = explode("/",$val);
                $bd['browser'] = $val[0];
                $val = explode(" ",$val[1]);
                $bd['version'] = $val[0];
            }else{
                $val = explode(" ",stristr($val,"opera"));
                $bd['browser'] = $val[0];
                $bd['version'] = $val[1];
            }

        // test for WebTV
        }elseif(eregi("webtv",$agent)){
            $val = explode("/",stristr($agent,"webtv"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
        
        // test for MS Internet Explorer version 1
        }elseif(eregi("microsoft internet explorer", $agent)){
            $bd['browser'] = "MSIE";
            $bd['version'] = "1.0";
            $var = stristr($agent, "/");
            if (ereg("308|425|426|474|0b1", $var)){
                $bd['version'] = "1.5";
            }

        // test for NetPositive
        }elseif(eregi("NetPositive", $agent)){
            $val = explode("/",stristr($agent,"NetPositive"));
            $bd['platform'] = "BeOS";
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];

        // test for MS Internet Explorer
        }elseif(eregi("msie",$agent) && !eregi("opera",$agent)){
            $val = explode(" ",stristr($agent,"msie"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
        
        // test for MS Pocket Internet Explorer
        }elseif(eregi("mspie",$agent) || eregi('pocket', $agent)){
            $val = explode(" ",stristr($agent,"mspie"));
            $bd['browser'] = "MSPIE";
            $bd['platform'] = "WindowsCE";
            if (eregi("mspie", $agent))
                $bd['version'] = $val[1];
            else {
                $val = explode("/",$agent);
                $bd['version'] = $val[1];
            }
            
        // test for Galeon
        }elseif(eregi("galeon",$agent)){
            $val = explode(" ",stristr($agent,"galeon"));
            $val = explode("/",$val[0]);
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
            
        // test for Konqueror
        }elseif(eregi("Konqueror",$agent)){
            $val = explode(" ",stristr($agent,"Konqueror"));
            $val = explode("/",$val[0]);
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
            
        // test for iCab
        }elseif(eregi("icab",$agent)){
            $val = explode(" ",stristr($agent,"icab"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];

        // test for OmniWeb
        }elseif(eregi("omniweb",$agent)){
            $val = explode("/",stristr($agent,"omniweb"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];

        // test for Phoenix
        }elseif(eregi("Phoenix", $agent)){
            $bd['browser'] = "Phoenix";
            $val = explode("/", stristr($agent,"Phoenix/"));
            $bd['version'] = $val[1];
        
        // test for Firebird
        }elseif(eregi("firebird", $agent)){
            $bd['browser']="Firebird";
            $val = stristr($agent, "Firebird");
            $val = explode("/",$val);
            $bd['version'] = $val[1];
            
        // test for Firefox
        }elseif(eregi("Firefox", $agent)){
            $bd['browser']="Firefox";
            $val = stristr($agent, "Firefox");
            $val = explode("/",$val);
            $bd['version'] = $val[1];
            
      // test for Mozilla Alpha/Beta Versions
        }elseif(eregi("mozilla",$agent) && 
            eregi("rv:[0-9].[0-9][a-b]",$agent) && !eregi("netscape",$agent)){
            $bd['browser'] = "Mozilla";
            $val = explode(" ",stristr($agent,"rv:"));
            eregi("rv:[0-9].[0-9][a-b]",$agent,$val);
            $bd['version'] = str_replace("rv:","",$val[0]);
            
        // test for Mozilla Stable Versions
        }elseif(eregi("mozilla",$agent) &&
            eregi("rv:[0-9]\.[0-9]",$agent) && !eregi("netscape",$agent)){
            $bd['browser'] = "Mozilla";
            $val = explode(" ",stristr($agent,"rv:"));
            eregi("rv:[0-9]\.[0-9]\.[0-9]",$agent,$val);
            $bd['version'] = str_replace("rv:","",$val[0]);
        
        // test for Lynx & Amaya
        }elseif(eregi("libwww", $agent)){
            if (eregi("amaya", $agent)){
                $val = explode("/",stristr($agent,"amaya"));
                $bd['browser'] = "Amaya";
                $val = explode(" ", $val[1]);
                $bd['version'] = $val[0];
            } else {
                $val = explode("/",$agent);
                $bd['browser'] = "Lynx";
                $bd['version'] = $val[1];
            }
        
        // test for Safari
        }elseif(eregi("safari", $agent)){
            $bd['browser'] = "Safari";
            $bd['version'] = "";

        // remaining two tests are for Netscape
        }elseif(eregi("netscape",$agent)){
            $val = explode(" ",stristr($agent,"netscape"));
            $val = explode("/",$val[0]);
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
        }elseif(eregi("mozilla",$agent) && !eregi("rv:[0-9]\.[0-9]\.[0-9]",$agent)){
            $val = explode(" ",stristr($agent,"mozilla"));
            $val = explode("/",$val[0]);
            $bd['browser'] = "Netscape";
            $bd['version'] = $val[1];
        }
        
        // clean up extraneous garbage that may be in the name
        $bd['browser'] = ereg_replace("[^a-z,A-Z]", "", $bd['browser']);
        // clean up extraneous garbage that may be in the version        
        $bd['version'] = ereg_replace("[^0-9,.,a-z,A-Z]", "", $bd['version']);
        
        // check for AOL
        if (eregi("AOL", $agent)){
            $var = stristr($agent, "AOL");
            $var = explode(" ", $var);
            $bd['aol'] = ereg_replace("[^0-9,.,a-z,A-Z]", "", $var[1]);
        }
        
        // finally assign our properties
        $this->Name = $bd['browser'];
        $this->Version = $bd['version'];
        $this->Platform = $bd['platform'];
        $this->AOL = $bd['aol'];
    }
}
?>
 

Mitch

New Member
Messages
908
Reaction score
0
Points
0
Yes, it works.
If you like to see it. Refresh this page.
ip2.php
 
Last edited:

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
ok fine. i see them do you want some thing else to be done there. like random picture, random fonts any thing
 
Top