Results 1 to 2 of 2

Thread: PHP hardcode ip

  1. #1

    PHP hardcode ip

    Hello, i am running a small script to show the ip (and some other information) of my dedicated server. The problem i am having is that its getting the ip of my webserver (where the script is hosted) and not the ip of my dedicated server. Can anyone tell me how i can hardcode the ip so i can just put my dedicated servers ip in manually?

    PHP Code:
     // 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. #2
    Join Date
    Jun 2002
    If you know that your dedicated servers IP address is always going to be the same, then hardcode it in like:

    $server_ip = "";

    (or whatever the IP address is)


Posting Permissions

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