IP Service on Glbasic Server

Previous topic - Next topic

Marmor

some old sources which using http://www.glbasic.com/forum/index.php?topic=5400.msg42237#msg42237 will not work now ,because
website has some changes.
i think a little extra website on GLBASIC.com can help a lot in the future.

Moru

Such a service is always best to have on your own web-server. It's very simple to set up and you don't have to depend on someone elses server. If your game gets popular it does not risk killing this server either :-)

Make a file containing this code and upload to your server.
Code (glbasic) Select

<?php
echo $_SERVER['REMOTE_ADDR']

spicypixel

On http://ip.spicypixel.net I use this...

Code (glbasic) Select

<?php
//--------------------------------------------
//  Get User IP Address
//--------------------------------------------
$myip getRealIpAddr();
echo 
$myip;

function 
getRealIpAddr()
{
    if (!empty(
$_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet
    
{
      
$ip=$_SERVER['HTTP_CLIENT_IP'];
    }
    elseif (!empty(
$_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy
    
{
      
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    else
    {
      
$ip=$_SERVER['REMOTE_ADDR'];
    }
    return 
$ip;
}
?>

http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.