In Progress

378616 php code to remove http www

Hello

I have code that works fine when used on a regular domain like [url removed, login to view] but if used on a subdomain like [url removed, login to view] it is not working, it strips everything but [url removed, login to view]

Here is what I need it to do. The $domain is pulled from the database on the host site it could be [url removed, login to view] or [url removed, login to view] or even [url removed, login to view] and maybe even sometimes [url removed, login to view]

I need to check $domain for the host site against the $siteurl data that is stored in the database, all of the $siteurls are the domain only no http or www.

so what I need it to do is if $domain ([url removed, login to view]) remove the http://www and compare it to the $siteurls stored in the database which would be [url removed, login to view], if a match then do this action.

Hope I explained that well enough for someone to understand.

Here is the existing code:

$pattern = '/\w+\..{2,3}(?:\..{2,3})?(?:$|(?=\/))/i';

$url = $domain;

if (preg_match($pattern, $url, $domain1) === 1) {

if($domain1[0]=="$siteurl1") {

$enabled = $sitestatus1;

$site = $site1;

} elseif($domain1[0]=="$siteurl2") {

$enabled = $sitestatus2;

$site = $site2;

} elseif($domain1[0]=="$siteurl3") {

$enabled = $sitestatus3;

$site = $site3;

} elseif($domain1[0]=="$siteurl4") {

$enabled = $sitestatus4;

$site = $site4;

}

} //end prgmatch

Skills: Anything Goes, MySQL, PHP

See more: code that, Remove, php code test, code check, subdomain php code, code test, php action, action php, php elseif, code code database, code stored database, mysql database php code, check pattern pattern, www match com, php remove url, strips, subdomain database, url mysql php, code subdomain, php preg_match php, php code mysql, preg_match, code url mysql, code code, check pattern

About the Employer:
( 50 reviews ) Hollister, United States

Project ID: #2124462

Awarded to:

basicersl

No Problem.

$30 USD in 0 days
(70 Reviews)
4.9