-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboard_list.php
More file actions
195 lines (175 loc) · 5.72 KB
/
board_list.php
File metadata and controls
195 lines (175 loc) · 5.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<?php
session_start();
$conn = new mysqli("localhost", "root", "", "sample");
if ($conn->connect_error) {
die("DB 연결 실패");
}
$result = $conn -> query("SELECT * FROM board ORDER BY id DESC");
$total = $result -> num_rows;
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>한줄평 목록 - CGV</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Malgun Gothic', -apple-system, sans-serif;
background-color: #f5f5f5;
min-height: 100vh;
}
/* 앱 컨테이너 */
.app-container {
max-width: 480px;
margin: 0 auto;
background-color: white;
min-height: 100vh;
position: relative;
box-shadow: 0 0 20px rgba(0,0,0,0.1);
}
/* 헤더 스타일 */
.header {
background-color: #dc2626;
color: white;
padding: 16px 20px;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.header h1 { font-size: 24px; font-weight: bold; letter-spacing: -0.5px; }
.header-link { color: white; text-decoration: none; font-size: 14px; opacity: 0.9; }
/* 컨텐츠 */
.content {
padding: 20px;
}
/* 페이지 타이틀 & 글쓰기 버튼 */
.page-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
border-bottom: 2px solid #333;
padding-bottom: 12px;
}
.page-title {
font-size: 18px;
font-weight: bold;
color: #111;
}
.btn-write {
background-color: #dc2626;
color: white;
padding: 6px 14px;
border-radius: 6px;
font-size: 13px;
font-weight: bold;
text-decoration: none;
transition: background 0.2s;
}
.btn-write:hover { background-color: #b91c1c; }
/* 게시판 테이블 */
table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
th {
background-color: #f9fafb;
color: #555;
padding: 10px 4px;
border-bottom: 1px solid #e5e7eb;
font-weight: 600;
text-align: center;
}
td {
padding: 12px 4px;
border-bottom: 1px solid #f3f4f6;
color: #333;
text-align: center;
}
/* 제목 */
.col-title {
text-align: left;
padding-left: 8px;
}
.col-title a {
color: #111;
text-decoration: none;
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 160px;
}
/* 부가 정보 */
.col-small {
font-size: 12px;
color: #888;
}
/* 리스트가 없을 때 */
.empty-list {
text-align: center;
padding: 40px 0;
color: #999;
font-size: 14px;
}
</style>
</head>
<body>
<div class="app-container">
<div class="header">
<h1>CGV</h1>
<!-- 홈으로 돌아가는 링크 -->
<a href="home.php" class="header-link">홈으로</a>
</div>
<div class="content">
<div class="page-header">
<h2 class="page-title">영화 한줄평</h2>
<a href="board_write.php" class="btn-write">글쓰기</a>
</div>
<!-- 리스트 -->
<table>
<colgroup>
<col style="width: 12%"> <!-- 번호 -->
<col style="width: auto"> <!-- 제목 -->
<col style="width: 20%"> <!-- 작성자 -->
<col style="width: 15%"> <!-- 날짜 -->
</colgroup>
<thead>
<tr>
<th>NO</th>
<th>제목</th>
<th>작성자</th>
<th>날짜</th>
<th>조회수</th>
</tr>
</thead>
<tbody>
<?php if($total == 0): ?>
<tr><td colspan="4" class="empty-list">작성된 한줄평이 없습니다.</td></tr>
<?php else: ?>
<?php while($row = $result -> fetch_assoc()) {
$date = date("m.d", strtotime($row['created_at']));
?>
<tr>
<td class="col-small"><?=$total--?></td>
<td class="col-title">
<a href="board_view.php?id=<?=$row['id']?>">
<?= htmlspecialchars($row['title']) ?>
</a>
</td>
<td><?= htmlspecialchars($row['userid']) ?></td>
<td class="col-small"><?= $date ?></td>
<td class="col-small"><?= $row['hits'] ?></td>
</tr>
<?php } ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</body>
</html>