Welcome Guest, Not a member yet? Register   Sign In
How change Config (base_url) on a Controller
#3

You can store info in database then use code to detect valid domain.
Idea:
In admin controller, create CRUD to manager domain list:

Code:
//DATABASE TABLE domainList:
[domain, isActive, ... ]
1. abc.mydomain.com - 1
2. xyz.mydomain.com - 1
3. other.mydomain.com - 0

Include to header file:

Code:
//check valid domain, $currentDomain = $_SERVER['SERVER_NAME'];
// use where clause in DB BUILDER, ex: where("domain LIKE '%mydomain.com'"); where("isActive", 1); 
if(!$currentDomain in DB TABLE)
{
die ("Invalid domain");
}
else
{
$base_url = get_base_url();
//if domain in db - $base_url = current domain, else $base_url = default_url (get from file config)
}
Reply


Messages In This Thread
RE: How change Config (base_url) on a Controller - by pvt - 05-14-2022, 04:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB