PHP and IP Adress

Hey guys! Im building a website on a local apache server that contains a config.php file.

One of the statements in this config file are for example:

$basic_directory = “http://55.88.44.666”;

For the website to run properly off of my server the ip adress needs to be static. Unfortunatly mine isnt, every night at about 1am my ISP makes a short disconnecy refreshing the IP adresses which forces me to adjust the config file manually.

Is there ANY way one could make a script or code where the computers IP adress is automatically read and insterted into the $basic_directory as a variable even after it changes?

Ive been pulling my hair out over this one but nope, nothing…

Thanks in advance!

you can use $_SERVER[‘REMOTE_ADDR’] to get the users IP address like:

[php]$basic_directory = “http://”.$_SERVER[‘REMOTE_ADDR’];[/php]

but that would get the IP address of the user not a problem when using a local PC but it would be when run from a server, why do you need the IP address?

Sponsor our Newsletter | Privacy Policy | Terms of Service