→getcookie
このコミットが含まれているのは:
コミット
daa7d9cb88
4
cart.php
4
cart.php
|
@ -7,7 +7,7 @@
|
||||||
<?php
|
<?php
|
||||||
$items = [];
|
$items = [];
|
||||||
$total = 0;
|
$total = 0;
|
||||||
$cart = array_filter(explode(',', $_COOKIE['cart']));
|
$cart = array_filter(explode(',', getcookie('cart')));
|
||||||
|
|
||||||
$sql = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
$sql = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||||
if (mysqli_connect_errno()) {
|
if (mysqli_connect_errno()) {
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
mysqli_stmt_bind_result($stmt, $name, $slug, $language, $author, $price, $filename);
|
mysqli_stmt_bind_result($stmt, $name, $slug, $language, $author, $price, $filename);
|
||||||
mysqli_stmt_fetch($stmt);
|
mysqli_stmt_fetch($stmt);
|
||||||
mysqli_stmt_close($stmt);
|
mysqli_stmt_close($stmt);
|
||||||
|
|
||||||
$booklang = $language == 'en' ? ($eigo ? 'English' : '英語') : ($eigo ? 'Japanese' : '日本語');
|
$booklang = $language == 'en' ? ($eigo ? 'English' : '英語') : ($eigo ? 'Japanese' : '日本語');
|
||||||
|
|
||||||
if (!isset($items[$c])) $items[$c] = [
|
if (!isset($items[$c])) $items[$c] = [
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
include('helper.php');
|
include('helper.php');
|
||||||
|
|
||||||
if (isset($_POST['langchange'])) {
|
if (isset($_POST['langchange'])) {
|
||||||
$lang = null !== $_COOKIE['lang'] && $_COOKIE['lang'] == 'en' ? 'ja' : 'en';
|
$lang = null !== getcookie('lang') && getcookie('lang') == 'en' ? 'ja' : 'en';
|
||||||
setcookie('lang', $lang);
|
setcookie('lang', $lang);
|
||||||
unset($_POST['langchange']);
|
unset($_POST['langchange']);
|
||||||
header('Location: /');
|
header('Location: /');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['addtocart'])) {
|
if (isset($_POST['addtocart'])) {
|
||||||
$cart = null !== $_COOKIE['cart'] ? $_COOKIE['cart'] : '';
|
$cart = null !== getcookie('cart') ? getcookie('cart') : '';
|
||||||
$cart .= $_POST['item'].',';
|
$cart .= $_POST['item'].',';
|
||||||
setcookie('cart', $cart);
|
setcookie('cart', $cart);
|
||||||
unset($_POST['item']);
|
unset($_POST['item']);
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['cart-minus'])) {
|
if (isset($_POST['cart-minus'])) {
|
||||||
$cart = null !== $_COOKIE['cart'] ? $_COOKIE['cart'] : '';
|
$cart = null !== getcookie('cart') ? getcookie('cart') : '';
|
||||||
$cart = array_filter(explode(',', $cart));
|
$cart = array_filter(explode(',', $cart));
|
||||||
foreach ($cart as $k => $v) {
|
foreach ($cart as $k => $v) {
|
||||||
if ($v == $_POST['item']) { unset($cart[$k]); break; }
|
if ($v == $_POST['item']) { unset($cart[$k]); break; }
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['cart-plus'])) {
|
if (isset($_POST['cart-plus'])) {
|
||||||
$cart = null !== $_COOKIE['cart'] ? $_COOKIE['cart'] : '';
|
$cart = null !== getcookie('cart') ? getcookie('cart') : '';
|
||||||
$cart .= $_POST['item'].',';
|
$cart .= $_POST['item'].',';
|
||||||
setcookie('cart', $cart);
|
setcookie('cart', $cart);
|
||||||
unset($_POST['item']);
|
unset($_POST['item']);
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
header('Location: /cart.php');
|
header('Location: /cart.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$eigo = null !== $_COOKIE['lang'] && $_COOKIE['lang'] == 'en';
|
$eigo = null !== getcookie('lang') && getcookie('lang') == 'en';
|
||||||
$cart = null !== $_COOKIE['cart'] && $_COOKIE['cart'] != 0;
|
$cart = null !== getcookie('cart') && getcookie('cart') != 0;
|
||||||
$styles = ['style'];
|
$styles = ['style'];
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
</form>
|
</form>
|
||||||
<h2><?php echo $pagetitle; ?></h2>
|
<h2><?php echo $pagetitle; ?></h2>
|
||||||
|
|
||||||
<?php $countcart = count(array_filter(explode(',', $_COOKIE['cart']))); ?>
|
<?php $countcart = count(array_filter(explode(',', getcookie('cart')))); ?>
|
||||||
<div class="nav">
|
<div class="nav">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/"><?php echo $eigo ? 'Home' : 'トップページ'; ?></a></li>
|
<li><a href="/"><?php echo $eigo ? 'Home' : 'トップページ'; ?></a></li>
|
||||||
|
|
新しいイシューから参照