$cart = $do->get(); $max_cart = $MOD['max_cart']; if ($action == 'ajax') { $itemid or exit('-1'); $s1 = isset($s1) ? intval($s1) : 0; $s2 = isset($s2) ? intval($s2) : 0; $s3 = isset($s3) ? intval($s3) : 0; $key = $itemid . '-' . $s1 . '-' . $s2 . '-' . $s3; if (strpos($cart . ',', ',' . $key . ',') !== false) { exit('-2'); } $item = $db->get_one("SELECT itemid,status,username FROM {$table} WHERE itemid={$itemid}"); if ($item && $item['status'] == 3) { if ($item['username'] != $_username) { $cart = ',' . $key . $cart; $do->set($cart); exit('1'); } else { exit('-4'); } } else { exit('-3'); } } else { if ($action == 'clear') { $key = isset($key) ? trim($key) : ''; if (preg_match("/^[0-9]{1,}-[0-9]{1,}-[0-9]{1,}-[0-9]{1,}\$/", $key)) { $cart = str_replace(',' . $key . ',', ',', $cart . ','); if (substr($cart, -1) == ',') { $cart = substr($cart, 0, -1); }