Results 1 to 4 of 4
  1. #1
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default PHP Help - Noone looks in Coding bit :)

    Hi all,

    Can someone make me a line of code that will output:

    Your 'Real' IP is: "Users IP Here", But using our proxy your IP will be: "Servers IP Here"!

    Please help!

    Thanks
    Tom

    Edited by Lµke (Forum Moderator): Thread Moved from Website Designing. Please post in the correct section next time, Thanks .
    Last edited by Lµke; 04-02-2007 at 06:18 PM.
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  2. #2
    Join Date
    Jan 2007
    Location
    West Yorkshire
    Posts
    384
    Tokens
    0

    Default

    PHP Code:
    <?php
    echo "Your 'Real' IP is: ".$_SERVER['REMOTE_ADDR'].", But using our proxy your IP will be: ".$_SERVER['SERVER_ADDR']."!";
    ?>
    That should work.

    “two players, two sides.
    one is light, one is dark.”
    - John Locke

  3. #3
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    At simplist

    PHP Code:
    echo "your ip is ".$_SERVER['REMOTE_ADDR'].". with prox your ip will be ".$_SERVER['SERVER_ADDR']; 
    or if you want to see threw proxies they may already be useing

    PHP Code:
    $ip "";
    if ((isset(
    $_SERVER['HTTP_X_FORWARDED_FOR'])) && (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])))
    {
             
    $ip $_SERVER['HTTP_X_FORWARDED_FOR'];
     }
     elseif ((isset(
    $_SERVER['HTTP_CLIENT_IP'])) && (!empty($_SERVER['HTTP_CLIENT_IP'])))
     {
            
    $ip explode(".",$_SERVER['HTTP_CLIENT_IP']);
             
    $ip $ip[3].".".$ip[2].".".$ip[1].".".$ip[0];
     }
     elseif ((!isset(
    $_SERVER['HTTP_X_FORWARDED_FOR'])) || (empty($_SERVER['HTTP_X_FORWARDED_FOR'])))
     {
             if ((!isset(
    $_SERVER['HTTP_CLIENT_IP'])) && (empty($_SERVER['HTTP_CLIENT_IP'])))
             {
                     
    $ip $_SERVER['REMOTE_ADDR'];
             }
     }
     else
     {
            
    $ip "0.0.0.0";
     } 
    My be a better way to access there current ip adress

  4. #4
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by 01101101entor View Post
    At simplist

    PHP Code:
    echo "your ip is ".$_SERVER['REMOTE_ADDR'].". with prox your ip will be ".$_SERVER['SERVER_ADDR']; 
    or if you want to see threw proxies they may already be useing

    PHP Code:
    $ip "";
    if ((isset(
    $_SERVER['HTTP_X_FORWARDED_FOR'])) && (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])))
    {
             
    $ip $_SERVER['HTTP_X_FORWARDED_FOR'];
     }
     elseif ((isset(
    $_SERVER['HTTP_CLIENT_IP'])) && (!empty($_SERVER['HTTP_CLIENT_IP'])))
     {
            
    $ip explode(".",$_SERVER['HTTP_CLIENT_IP']);
             
    $ip $ip[3].".".$ip[2].".".$ip[1].".".$ip[0];
     }
     elseif ((!isset(
    $_SERVER['HTTP_X_FORWARDED_FOR'])) || (empty($_SERVER['HTTP_X_FORWARDED_FOR'])))
     {
             if ((!isset(
    $_SERVER['HTTP_CLIENT_IP'])) && (empty($_SERVER['HTTP_CLIENT_IP'])))
             {
                     
    $ip $_SERVER['REMOTE_ADDR'];
             }
     }
     else
     {
            
    $ip "0.0.0.0";
     } 
    My be a better way to access there current ip adress

    +rep for showing more advanced way ;P

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •