2022-05-08 02:56:47 +09:00
|
|
|
<?php
|
|
|
|
include('config.php');
|
|
|
|
include('helper.php');
|
|
|
|
|
|
|
|
if (isset($_POST['langchange'])) {
|
2022-05-08 11:16:07 +09:00
|
|
|
$lang = null !== getcookie('lang') && getcookie('lang') == 'en' ? 'ja' : 'en';
|
2022-05-08 02:56:47 +09:00
|
|
|
setcookie('lang', $lang);
|
|
|
|
unset($_POST['langchange']);
|
|
|
|
header('Location: /');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_POST['addtocart'])) {
|
2022-05-08 11:16:07 +09:00
|
|
|
$cart = null !== getcookie('cart') ? getcookie('cart') : '';
|
2022-05-08 02:56:47 +09:00
|
|
|
$cart .= $_POST['item'].',';
|
|
|
|
setcookie('cart', $cart);
|
|
|
|
unset($_POST['item']);
|
|
|
|
unset($_POST['addtocart']);
|
|
|
|
header('Location: /cart.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_POST['cart-minus'])) {
|
2022-05-08 11:16:07 +09:00
|
|
|
$cart = null !== getcookie('cart') ? getcookie('cart') : '';
|
2022-05-08 02:56:47 +09:00
|
|
|
$cart = array_filter(explode(',', $cart));
|
|
|
|
foreach ($cart as $k => $v) {
|
|
|
|
if ($v == $_POST['item']) { unset($cart[$k]); break; }
|
|
|
|
}
|
|
|
|
$cart = array_values($cart);
|
|
|
|
$cart = implode(',', $cart).',';
|
|
|
|
setcookie('cart', $cart);
|
|
|
|
unset($_POST['item']);
|
|
|
|
unset($_POST['cart-minus']);
|
|
|
|
header('Location: /cart.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_POST['cart-plus'])) {
|
2022-05-08 11:16:07 +09:00
|
|
|
$cart = null !== getcookie('cart') ? getcookie('cart') : '';
|
2022-05-08 02:56:47 +09:00
|
|
|
$cart .= $_POST['item'].',';
|
|
|
|
setcookie('cart', $cart);
|
|
|
|
unset($_POST['item']);
|
|
|
|
unset($_POST['cart-minus']);
|
|
|
|
header('Location: /cart.php');
|
|
|
|
}
|
|
|
|
|
2022-05-08 11:16:07 +09:00
|
|
|
$eigo = null !== getcookie('lang') && getcookie('lang') == 'en';
|
|
|
|
$cart = null !== getcookie('cart') && getcookie('cart') != 0;
|
2022-05-08 02:56:47 +09:00
|
|
|
$styles = ['style'];
|
|
|
|
?>
|