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

From aMember Pro Documentation
Revision as of 06:33, 29 August 2018 by Caesar (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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");
        header("Access-Control-Allow-Headers: origin, x-requested-with, cookie");