2022-05-08 02:56:47 +09:00
|
|
|
|
<?php
|
|
|
|
|
include('include/god.php');
|
|
|
|
|
$pagetitle = $eigo ? 'Home' : 'トップページ';
|
|
|
|
|
$books = [];
|
|
|
|
|
|
|
|
|
|
$sql = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
|
|
|
|
if (mysqli_connect_errno()) {
|
|
|
|
|
printf("Connect failed: %s\n", mysqli_connect_error());
|
|
|
|
|
exit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($stmt = mysqli_prepare($sql, 'SELECT name, slug, author, price, quantity, filename FROM item')) {
|
|
|
|
|
mysqli_stmt_execute($stmt);
|
|
|
|
|
mysqli_stmt_bind_result($stmt, $name, $slug, $author, $price, $quantity, $filename);
|
|
|
|
|
while (mysqli_stmt_fetch($stmt)) {
|
|
|
|
|
$books[] = [
|
|
|
|
|
'name' => $name,
|
|
|
|
|
'slug' => $slug,
|
|
|
|
|
'author' => $author,
|
|
|
|
|
'price' => $price,
|
|
|
|
|
'quantity' => $quantity,
|
|
|
|
|
'filename' => $filename
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
mysqli_stmt_close($stmt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysqli_close($sql);
|
|
|
|
|
?>
|
|
|
|
|
<?php require_once('include/header.php'); ?>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
foreach ($books as $b) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="item-card">
|
|
|
|
|
<?php $fname = null !== $b['filename'] ? $b['filename'] : 'nowprinting.png'; ?>
|
2022-08-25 22:19:21 +09:00
|
|
|
|
<a href="/item.php?slug=<?= $b['slug']; ?>"><img src="/img/<?= $fname; ?>" alt="<?= $fname; ?>" style="width: 200px;" /></a>
|
|
|
|
|
<h3><a href="/item.php?slug=<?= $b['slug']; ?>"><?= mb_strlen($b['name']) > 9 ? mb_substr($b['name'], 0, 9).'…' : $b['name']; ?></a></h3>
|
|
|
|
|
<p class="author"><?= $b['author']; ?></p>
|
|
|
|
|
<p class="price">XMR <?= $b['price']; ?> / <?= $eigo ? 'Quantity' : '商品数'; ?>:<?= $b['quantity']; ?></p>
|
2022-05-08 02:56:47 +09:00
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<?php require_once('include/footer.php'); ?>
|