php - hardcode ip

Discussion in 'OT Technology' started by Hoof, Apr 14, 2005.

  1. Hoof

    Hoof 1@#)$(*@#)$(&)#$^*^@%#)*@ #%^*)(#% OT Supporter

    Joined:
    Nov 9, 2004
    Messages:
    4,474
    Likes Received:
    0
    Location:
    lulz
    I am having a problem with this script, it is getting my webserver ip, instead of my dedicated server's ip (i want it to show my dedicated server's ip). Im not too good with php does anyone know how i can hardcode the ip so i can just put my dedicated server's ip in it?

    PHP:
     // Determine the server's IP Address
    if (getenv("HTTP_X_FORWARDED_FOR")) {
    $server_ip getenv("HTTP_X_FORWARDED_FOR");
    if (
    $server_ip == '') {
    $server_ip $_SERVER["REMOTE_ADDR"];
    }
    $server_ip preg_replace"/,.*$/"""$server_ip );
    } else {
    $server_ip getenv("REMOTE_ADDR");
    if (
    $server_ip == '') {
    $server_ip $_SERVER["REMOTE_ADDR"];
    }
     
  2. EkriirkE

    EkriirkE Zika Xenu OT Supporter

    Joined:
    Jan 11, 2004
    Messages:
    14,799
    Likes Received:
    0
    Location:
    Dublin & San Francisco, CA
    do what your topic says, hard-code it?
     
  3. Juvenall

    Juvenall What Would Juvie Do?

    Joined:
    Dec 31, 2004
    Messages:
    2,221
    Likes Received:
    0
    Location:
    #!/usr/bin/Detroit
    :werd:

    If it's a real "dedicated box", the IP won't change so you shouldn't need to have PHP figure it out. Just a waste of resources IMHO.

    PHP:
    <?php
      
      
    echo '127.0.0.1';
      
      
    ?>
    Not really trying to be a smart-ass here, butI just can't see why you need PHP to do the extra work.
     
  4. Chaotic Reality

    Chaotic Reality New Member

    Joined:
    Jun 22, 2004
    Messages:
    29,052
    Likes Received:
    0
    Location:
    Phoenix, AZ

Share This Page