How to set phpDVDProfiler's $LOCAL_LAN setting in LOCALSITECONFIG to use your IP based on your DDNS

Started by JMM, Friday, 22 April 2022, 05:44 UTC (GMT)

Previous topic - Next topic

JMM

Do you host your phpDVDProfiler site in your home?  If you have a static IP from your ISP, you can just set the actual external IP in your localsiteconfig file, so that when you view your private items such as purchase price, etc., phpDVDProfiler will display those private items to you in your home, but not to anyone else.

With my previous firewall & ISP modem's configuration, I could use my internal LAN's IP for the $local_lan setting, such as 10.10.10 or 192.168.1 , etc.  However with my current firewall & ISP modem's configuration, I need to use my external IP in order for phpDVDProfiler to determine that it is me inside my local LAN accessing phpDVDProfiler.

But what if your IP changes from time-to-time, or as in my case, every time my ISP's modem reboots?  Unless you access your phpDVDProfiler site by external IP only, chances are you use a DDNS (Dynamic DNS) service, such as No-IP, etc.

But phpDVDProfiler uses IP addresses to determine what the IP addresses are of your local LAN.  However, I figured out a way to get around this ;D.

As always, make a backup of your localsiteconfig.php file before making this change, just in case something goes wrong.

In your localsiteconfig.php file, look around line 418:
$local_lan = array(    // Set this to the IP nets that you want to consider to be local
//    "10.0.0.",
    "127.0.0.1",      // for people who are on this machine
    "192.168.1."
);

Add the following line of code above that, making sure to replace www.yourdomain.com with your own domain name ;):
$getip = gethostbyname('www.yourdomain.com');    // Gets your IP address from your domain name - change this to YOUR domain
So what you will end up with, is something like this:
$getip = gethostbyname('www.yourdomain.com');    // Gets your IP address from your domain name - change this to YOUR domain
$local_lan = array(    // Set this to the IP nets that you want to consider to be local
//    "10.0.0.",
    "127.0.0.1",      // for people who are on this machine
    "192.168.1."
);
In the above code, note that the IP addresses are in quotes, followed by a comma... except the last IP address, which has NO comma.

Place a comma after the last IP address, then add the following line of code (after the last IP address):
    $getip            // your external IP address, based on your DDNS

So what you should end up with is this:
$getip = gethostbyname('www.yourdomain.com');    // Gets your IP address from your domain name - change this to YOUR domain
$local_lan = array(    // Set this to the IP nets that you want to consider to be local
//    "10.0.0.",
    "127.0.0.1",     // for people who are on this machine
    "192.168.1.",    // note the comma after the IP address
    $getip           // your external IP address, based on your DDNS
);

That's it 8).  Enjoy.
My PHP-Fusion 7.02.07 site running under Chrome-Fusion v2.00.03 (using PHP 7.2.0 with MySQL 8.0.28):
   • FusionWings.com (my MAIN site)
 
My PHP-Fusion 7.02.07 site running under PHP-Fusion IUP 1.6 (using PHP 8.1.0 with MySQL 8.0.28):
   • FusionWings.me (my TEST site)
 
My PHP-Fusion 7.02.07 site running under Chrome-Fusion v2.00.03 (using PHP 7.2.0 with MySQL 8.0.28):
   • PanAurora-Tech.com (my business site)
 
 My phpDVDProfiler pages (using PHP 7.4.0 with MySQL 8.0.28):
   • My COINS
   • My MOVIES on DVD
   • My MOVIES on VIDEO
   • My TV Shows on VIDEO

 My Other sites
   • GenealogyWings.com (my Family Tree main website)
   • GenealogyWings.me (my Family Tree test website)

FusionWings.com © Copyright 2008-2022 by John Mark Motyer