コミットを比較
4 コミット
e6d5e206f6
...
9095635c68
作成者 | SHA1 | 日付 |
---|---|---|
守矢諏訪子 | 9095635c68 | |
守矢諏訪子 | 2eefac479c | |
守矢諏訪子 | 7c28c82a0b | |
守矢諏訪子 | daa7d9cb88 |
|
@ -1,4 +1,5 @@
|
|||
include/config.php
|
||||
img/*
|
||||
tbl2
|
||||
!img/.suwawa
|
||||
!img/nowprinting.jpg
|
||||
|
|
8
cart.php
8
cart.php
|
@ -7,7 +7,7 @@
|
|||
<?php
|
||||
$items = [];
|
||||
$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);
|
||||
if (mysqli_connect_errno()) {
|
||||
|
@ -22,7 +22,7 @@
|
|||
mysqli_stmt_bind_result($stmt, $name, $slug, $language, $author, $price, $filename);
|
||||
mysqli_stmt_fetch($stmt);
|
||||
mysqli_stmt_close($stmt);
|
||||
|
||||
|
||||
$booklang = $language == 'en' ? ($eigo ? 'English' : '英語') : ($eigo ? 'Japanese' : '日本語');
|
||||
|
||||
if (!isset($items[$c])) $items[$c] = [
|
||||
|
@ -71,4 +71,8 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<form action="/shipping.php" method="post">
|
||||
<input type="submit" name="toshipping" value="<?php echo $eigo ? 'To shipping information' : '配送情報へ' ?>" />
|
||||
</form>
|
||||
|
||||
<?php require_once('include/footer.php'); ?>
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
include('helper.php');
|
||||
|
||||
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);
|
||||
unset($_POST['langchange']);
|
||||
header('Location: /');
|
||||
}
|
||||
|
||||
if (isset($_POST['addtocart'])) {
|
||||
$cart = null !== $_COOKIE['cart'] ? $_COOKIE['cart'] : '';
|
||||
$cart = null !== getcookie('cart') ? getcookie('cart') : '';
|
||||
$cart .= $_POST['item'].',';
|
||||
setcookie('cart', $cart);
|
||||
unset($_POST['item']);
|
||||
|
@ -19,7 +19,7 @@
|
|||
}
|
||||
|
||||
if (isset($_POST['cart-minus'])) {
|
||||
$cart = null !== $_COOKIE['cart'] ? $_COOKIE['cart'] : '';
|
||||
$cart = null !== getcookie('cart') ? getcookie('cart') : '';
|
||||
$cart = array_filter(explode(',', $cart));
|
||||
foreach ($cart as $k => $v) {
|
||||
if ($v == $_POST['item']) { unset($cart[$k]); break; }
|
||||
|
@ -33,7 +33,7 @@
|
|||
}
|
||||
|
||||
if (isset($_POST['cart-plus'])) {
|
||||
$cart = null !== $_COOKIE['cart'] ? $_COOKIE['cart'] : '';
|
||||
$cart = null !== getcookie('cart') ? getcookie('cart') : '';
|
||||
$cart .= $_POST['item'].',';
|
||||
setcookie('cart', $cart);
|
||||
unset($_POST['item']);
|
||||
|
@ -41,7 +41,7 @@
|
|||
header('Location: /cart.php');
|
||||
}
|
||||
|
||||
$eigo = null !== $_COOKIE['lang'] && $_COOKIE['lang'] == 'en';
|
||||
$cart = null !== $_COOKIE['cart'] && $_COOKIE['cart'] != 0;
|
||||
$eigo = null !== getcookie('lang') && getcookie('lang') == 'en';
|
||||
$cart = null !== getcookie('cart') && getcookie('cart') != 0;
|
||||
$styles = ['style'];
|
||||
?>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</form>
|
||||
<h2><?php echo $pagetitle; ?></h2>
|
||||
|
||||
<?php $countcart = count(array_filter(explode(',', $_COOKIE['cart']))); ?>
|
||||
<?php $countcart = count(array_filter(explode(',', getcookie('cart')))); ?>
|
||||
<div class="nav">
|
||||
<ul>
|
||||
<li><a href="/"><?php echo $eigo ? 'Home' : 'トップページ'; ?></a></li>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
die();
|
||||
}
|
||||
|
||||
function uuid () {
|
||||
function uuid (): string {
|
||||
return sprintf(
|
||||
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
||||
mt_rand(0, 0xffff), mt_rand(0, 0xffff), // 32bitlow
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
if (!isset($_POST['toshipping']) && !isset($_POST['topayment']) && !isset($_POST['complete'])) {
|
||||
echo '禁止';
|
||||
die();
|
||||
}
|
||||
|
||||
include('include/god.php');
|
||||
$pagetitle = $eigo ? 'Shipping' : '発送';
|
||||
$item = $_GET['item'];
|
||||
$step = 1;
|
||||
$errcheck = [];
|
||||
$err = '';
|
||||
$tmpstore = [
|
||||
'name' => null !== $_POST['name'] ? htmlspecialchars($_POST['name']) : '',
|
||||
'zip' => null !== $_POST['zip'] ? htmlspecialchars($_POST['zip']) : '',
|
||||
'prefecture' => null !== $_POST['prefecture'] ? htmlspecialchars($_POST['prefecture']) : '',
|
||||
'city' => null !== $_POST['city'] ? htmlspecialchars($_POST['city']) : '',
|
||||
'address1' => null !== $_POST['address1'] ? htmlspecialchars($_POST['address1']) : '',
|
||||
'address2' => null !== $_POST['address2'] ? htmlspecialchars($_POST['address2']) : '',
|
||||
'country' => null !== $_POST['country'] ? htmlspecialchars($_POST['country']) : '',
|
||||
'email' => null !== $_POST['email'] ? htmlspecialchars($_POST['email']) : '',
|
||||
];
|
||||
|
||||
if (isset($_POST['topayment'])) {
|
||||
if (!isset($_POST['name']) || $_POST['name'] == '') $errcheck['name'] = $eigo ? 'Name' : 'お名前';
|
||||
if (!isset($_POST['zip']) || $_POST['zip'] == '') $errcheck['zip'] = $eigo ? 'ZIP Code' : '郵便番号';
|
||||
if (!isset($_POST['prefecture']) || $_POST['prefecture'] == '') $errcheck['prefecture'] = $eigo ? 'State/Province/Prefecture' : '都道府県';
|
||||
if (!isset($_POST['city']) || $_POST['city'] == '') $errcheck['city'] = $eigo ? 'City/Town' : '市区町村';
|
||||
if (!isset($_POST['address1']) || $_POST['address1'] == '') $errcheck['address1'] = $eigo ? 'Address 1' : '町名+番地';
|
||||
if (!isset($_POST['country']) || $_POST['country'] == '') $errcheck['country'] = $eigo ? 'Country' : '国';
|
||||
if (!isset($_POST['email']) || $_POST['email'] == '' || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) $errcheck['email'] = $eigo ? 'Email' : 'メール';
|
||||
unset($_POST['topayment']);
|
||||
|
||||
if (count($errcheck) > 0) {
|
||||
$err = $eigo ? 'Please check the following fields:' : '下記のフィールドをご確認下さい:';
|
||||
echo $err .= '<br />';
|
||||
foreach ($errcheck as $e) {
|
||||
$err .= $e.'<br />';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$step = 2;
|
||||
}
|
||||
}
|
||||
else if (isset($_POST['complete'])) {
|
||||
dd($_POST);
|
||||
// TODO
|
||||
// ・QRコード及びアドレスの表示
|
||||
// ・支払いの確認
|
||||
// ・支払いIDと配送情報をDBに入って、メールの送信
|
||||
// ・管理者は毎日午後5時(日本時間)まで手動で確認すると、翌日午前12時(日本時間)配送予定ってメッセージの表示
|
||||
// ・郵便局で配送すると、午後3時(日本時間)までメールで郵便追跡番号を送る
|
||||
// ・3日間後、配送情報は自動でDBから削除される(crontab)
|
||||
}
|
||||
|
||||
$total = 0;
|
||||
$cart = array_filter(explode(',', getcookie('cart')));
|
||||
|
||||
$sql = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||
if (mysqli_connect_errno()) {
|
||||
printf("Connect failed: %s\n", mysqli_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
foreach ($cart as $c) {
|
||||
if ($stmt = mysqli_prepare($sql, 'SELECT price FROM item WHERE slug = ?')) {
|
||||
mysqli_stmt_bind_param($stmt, 's', $c);
|
||||
mysqli_stmt_execute($stmt);
|
||||
mysqli_stmt_bind_result($stmt, $price);
|
||||
mysqli_stmt_fetch($stmt);
|
||||
mysqli_stmt_close($stmt);
|
||||
|
||||
if (!isset($items[$c])) $items[$c] = [
|
||||
'price' => $price,
|
||||
'count' => 1
|
||||
];
|
||||
else $items[$c]['count']++;
|
||||
}
|
||||
}
|
||||
|
||||
mysqli_close($sql);
|
||||
|
||||
if ($err != '') {
|
||||
?>
|
||||
<div class="error"><?php echo $err; ?></div>
|
||||
<?php
|
||||
}
|
||||
require_once('include/header.php');
|
||||
|
||||
// TODO: 合計の表示
|
||||
include('shipping/'.$step.'.php');
|
||||
|
||||
require_once('include/footer.php');
|
||||
?>
|
|
@ -0,0 +1 @@
|
|||
.
|
|
@ -0,0 +1,38 @@
|
|||
<form method="post" action="/shipping.php">
|
||||
<table class="address-form" border="0">
|
||||
<tr>
|
||||
<td class="required"><?php echo $eigo ? 'Name (nickname OK)' : 'お名前(異名OK)'; ?></td>
|
||||
<td><input type="text" name="name" placeholder="<?php echo $eigo ? 'Anonymous' : 'アノニマス'; ?>" value="<?php echo $tmpstore['name'] ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="required"><?php echo $eigo ? 'ZIP Code' : '郵便番号'; ?></td>
|
||||
<td><input type="text" name="zip" placeholder="100-0001" value="<?php echo $tmpstore['zip'] ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="required"><?php echo $eigo ? 'State/Province/Prefecture' : '都道府県'; ?></td>
|
||||
<td><input type="text" name="prefecture" placeholder="<?php echo $eigo ? 'Tokyo' : '東京都'; ?>" value="<?php echo $tmpstore['prefecture'] ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="required"><?php echo $eigo ? 'City/Town' : '市区町村'; ?></td>
|
||||
<td><input type="text" name="city" placeholder="<?php echo $eigo ? 'Shibuya' : '渋谷区'; ?>" value="<?php echo $tmpstore['city'] ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="required"><?php echo $eigo ? 'Address 1 (street + number)' : '町名+番地'; ?></td>
|
||||
<td><input type="text" name="address1" placeholder="<?php echo $eigo ? 'Ebisu 1-2-3' : '恵比寿1丁目2-3'; ?>" value="<?php echo $tmpstore['address1'] ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $eigo ? 'Address 2 (optional)' : 'マンション(任意)'; ?></td>
|
||||
<td><input type="text" name="address2" placeholder="<?php echo $eigo ? 'Moriya Shrine 200F' : '守谷神社 200階'; ?>" value="<?php echo $tmpstore['address2'] ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="required"><?php echo $eigo ? 'Country' : '国'; ?></td>
|
||||
<td><input type="text" name="country" placeholder="<?php echo $eigo ? 'Japan' : '日本'; ?>" value="<?php echo $tmpstore['country'] ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="required"><?php echo $eigo ? 'Email' : 'メール'; ?></td>
|
||||
<td><input type="text" name="email" placeholder="weareanonymous@weare.legion" value="<?php echo $tmpstore['email'] ?>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<input type="submit" class="nextbutton" name="topayment" value="支払いへ" />
|
||||
</form>
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
$address = 'monero:'.MONERO_ADDRESS.'?tx_amount='.$sum;
|
||||
?>
|
||||
<img src="" alt="<?php echo $address; ?>" />
|
|
@ -169,3 +169,15 @@ a {
|
|||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.address-form > tbody > tr > td > input {
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.error {
|
||||
background-color: #da4453;
|
||||
margin-top: 40px;
|
||||
padding: 10px;
|
||||
z-index: 5000;
|
||||
border: 4px #ff1212 ridge;
|
||||
}
|
||||
|
|
新しいイシューから参照