<li><a href="?plugin=CJApi/cj.php&action=links">Links</a></li> <li><a href="?plugin=CJApi/main.php&action=sales">Sales</a></li> <li><a href="?plugin=CJApi/options.php">Settings</a></li> </ul> </div> </div> <span>Assign a CJ.com ID to an existing store</span> </div>'; $imported = \plugin\CJApi\inc\import::store_imported(); if (!empty($_GET['id'])) { if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'cjapi_csrf')) { if (isset($_POST['store'])) { if (\plugin\CJApi\inc\actions::assign(array('cjID' => (int) $_POST['store'] === 0 ? 0 : $_GET['id'], 'storeID' => (int) $_POST['store'] === 0 && $imported ? $imported->ID : $_POST['store']))) { echo '<div class="a-success">Saved!</div>'; $imported = (object) array('ID' => !empty($_POST['store']) ? (int) $_POST['store'] : ''); } else { echo '<div class="a-error">Error!</div>'; } } } $csrf = $_SESSION['cjapi_csrf'] = \site\utils::str_random(10); echo '<div class="form-table"> <form action="#" method="POST" autocomplete="off"> <div class="row"><span>Assign Store ID:</span><div data-search="store"><input type="text" name="store" value="' . ($imported ? $imported->ID : '') . '" /><a href="#">S</a></div></div> <div class="row"><span>To CJ.com ID:</span><div><input type="text" name="cjid" value="' . (int) $_GET['id'] . '" disabled /></div></div>