This repository has been archived on 2026-03-14. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
kekec_bbs/index.php
T
2023-09-01 01:53:54 +09:00

61 lines
1.3 KiB
PHP

<?php
require_once "${_SERVER['DOCUMENT_ROOT']}/database.php";
if (isset ($_GET['page'])):
$page = $_GET['page'];
else:
$page = 0;
endif;
if (isset ($_GET['thread'])):
$thread = $_GET['thread'];
else:
$thread = -1;
endif;
if (isset ($_GET['sort'])):
$sort = $_GET['sort'];
if (!(in_array ($sort, array ('td', 'eg', 'ta', 'eb')))):
$sort = 'td';
endif;
else:
$sort = 'td';
endif;
// 画像のディレクトリを開く.
$dir = '/images/';
$handle = opendir ($dir);
// MySQL 宣言
$mysqli = set_mysql ('miteruzo_bbs');
$mysqli -> set_charset ('utf8');
if ($result = $mysqli -> query ("SELECT * FROM threads WHERE id = $thread")):
$row = $result -> fetch_assoc ();
$title = $row['title'];
$explain = $row['explain'];
$result -> close ();
endif;
if (isset ($_GET['id'])
&& isset ($_GET['evaluate'])
&& (($_GET['evaluate'] == 'good') || ($_GET['evaluate'] == 'bad'))):
$mysqli -> query ("
UPDATE
responses
SET
{$_GET['evaluate']} = {$_GET['evaluate']} + 1
WHERE
(thread_id = $thread) AND (response_id = {$_GET['id']})");
header ("Location: ./?thread=$thread&sort=$sort");
endif;
require_once './forms/index.frm.php';