Getting Site URL

Getting Site URL $domain = $_SERVER[‘SERVER_NAME’]; $domain = str_replace('www.', '', $domain); //Remove the leading www. if ($domain == 'somedomain.co.uk' || $domain == 'anothersite.net' || $domain == 'thirdsite.com' )

Read More

Detecting Name Of Page Include A File

//include_once('includes/my_include_file.php'); //Get the name of the file calling this include $calling_file = end(explode('/', $_SERVER[‘PHP_SELF’])); switch ($calling_file) { case 'some_file.php':

Read More

Site Root

You can’t do this in php: require_once ‘/s3_settings.php’; So instead do this: require_once($_SERVER[‘DOCUMENT_ROOT’] . ‘/s3_settings.php’);

Read More

Getting URL Arguments

Example GET URL Start with an ‘?’, then separate other values with an ‘&’ To read: Example For POST Parameters Sanitise Them!!! htmlentities() converts things like < > ” \ etc into HTML strings like < so they become harmless. POST OR GET Debug Show All Posted Values Is A Form Value Present Getting Form Values […]

Read More