How to use shopping cart buttons on domains other than domain where aMember is installed

From aMember Pro Documentation
Revision as of 08:04, 11 July 2018 by Alex-scott (talk | contribs)
Jump to: navigation, search

Add this code to site.php file:

 * list of domains where you want to use shopping cart buttons
 * one domain per line
$list = <<<CUT

if (isset($_SERVER['HTTP_ORIGIN'])) {
    $origin = $_SERVER['HTTP_ORIGIN'];
    $host = parse_url($origin, PHP_URL_HOST);
    if (in_array($host, explode("\n", $list))) {
        header("Access-Control-Allow-Origin: $origin");
        header("Access-Control-Allow-Credentials: true");