-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboard_view.php
More file actions
236 lines (214 loc) · 11.4 KB
/
board_view.php
File metadata and controls
236 lines (214 loc) · 11.4 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<meta name="description" content=""/>
<meta name="author" content=""/>
<title>Kotation</title>
<!-- Favicon-->
<link rel="icon" type="image/x-icon" href="assets/favicon.ico"/>
<!-- Font Awesome icons (free version)-->
<script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script>
<!-- Google fonts-->
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css"/>
<link href="https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700" rel="stylesheet" type="text/css"/>
<!-- Core theme CSS (includes Bootstrap)-->
<link rel="stylesheet" type="text/css" href="./css/board.css">
<link rel="stylesheet" type="text/css" href="./css/graph.scss">
<link href="css/styles.css" rel="stylesheet"/>
<script>
function add_option1_choice() {
$option1_choice = 0;
}
</script>
</head>
<body id="page-top">
<header class="masthead">
<?php include "header.php"; ?>
</header>
<section>
<div id="board_box">
<h3 class="title">
게시판 > 내용보기
</h3>
<?php
$num = $_GET["num"];
$page = $_GET["page"];
$con = mysqli_connect("localhost", "user1", "12345", "sample");
$sql = "select * from board where num=$num";
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result);
$id = $row["id"];
$name = $row["name"];
$regist_day = $row["regist_day"];
$subject = $row["subject"];
$option1 = $row["option1"];
$option2 = $row["option2"];
$option3 = $row["option3"];
$option4 = $row["option4"];
$option5 = $row["option5"];
$hit = $row["hit"];
$option1_choice = $row["option1_choice"];
$option2_choice = $row["option2_choice"];
$option3_choice = $row["option3_choice"];
$option4_choice = $row["option4_choice"];
$option5_choice = $row["option5_choice"];
$option1 = str_replace(" ", " ", $option1);
$option1 = str_replace("\n", "<br>", $option1);
$option2 = str_replace(" ", " ", $option2);
$option2 = str_replace("\n", "<br>", $option2);
$option3 = str_replace(" ", " ", $option3);
$option3 = str_replace("\n", "<br>", $option3);
$option4 = str_replace(" ", " ", $option4);
$option4 = str_replace("\n", "<br>", $option4);
$option5 = str_replace(" ", " ", $option5);
$option5 = str_replace("\n", "<br>", $option5);
$new_hit = $hit + 1;
$sql = "update board set hit=$new_hit where num=$num";
mysqli_query($con, $sql);
?>
<ul id="view_content">
<li>
<span class="col1"><b>제목 :</b> <?=$subject?></span>
<span class="col2"><?=$name?> | <?=$regist_day?></span>
</li>
<?php if ((!empty($option1_choice) || !empty($option2_choice) ||
!empty($option3_choice) || !empty($option4_choice) || !empty($option5_choice))): ?>
<div class="stats_graph_box">
<div class="graph">
<?php if (!empty($option1)): ?>
<div class="bar green" style="width: <?= number_format(($option1_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1) ?>%;">
<dl class="desc">
<dt><?= $option1 ?></dt>
<dd><em><?= $option1_choice ?></em>개(<?= number_format(($option1_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1)?>%)</dd>
</dl>
</div>
<?php endif; ?>
<?php if (!empty($option2)): ?>
<div class="bar pink" style="width: <?= number_format(($option2_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1) ?>%;">
<dl class="desc">
<dt><?= $option2 ?></dt>
<dd><em><?= $option2_choice ?></em>개(<?= number_format(($option2_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1)?>%)</dd>
</dl>
</div>
<?php endif; ?>
<?php if (!empty($option3)): ?>
<div class="bar clear" style="width: <?= number_format(($option3_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1) ?>%;">
<dl class="desc">
<dt><?= $option3 ?></dt>
<dd><em><?= $option3_choice ?></em>개(<?= number_format(($option3_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1)?>%)</dd>
</dl>
</div>
<?php endif; ?>
<?php if (!empty($option4)): ?>
<div class="bar orange" style="width: <?= number_format(($option4_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1) ?>%;">
<dl class="desc">
<dt><?= $option4 ?></dt>
<dd><em><?= $option4_choice ?></em>개(<?= number_format(($option4_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1)?>%)</dd>
</dl>
</div>
<?php endif; ?>
<?php if (!empty($option5)): ?>
<div class="bar blue" style="width: <?= number_format(($option5_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1) ?>%;">
<dl class="desc">
<dt><?= $option5 ?></dt>
<dd><em><?= $option5_choice ?></em>개(<?= number_format(($option5_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1)?>%)</dd>
</dl>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<li>
<?php if (!empty($option1)): ?>
<?= $option1 ?> : <?= $option1_choice ?>
<?php if (!empty($option1_choice)): ?>
(<?= number_format(($option1_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1) ?>%)
<?php endif; ?>
<br/>
<?php endif; ?>
<?php if (!empty($option2)): ?>
<?= $option2 ?> : <?= $option2_choice ?>
<?php if (!empty($option2_choice)): ?>
(<?= number_format(($option2_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1) ?>%)
<?php endif; ?>
<br/>
<?php endif; ?>
<?php if (!empty($option3)): ?>
<?= $option3 ?> : <?= $option3_choice ?>
<?php if (!empty($option3_choice)): ?>
(<?= number_format(($option3_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1) ?>%)
<?php endif; ?>
<br/>
<?php endif; ?>
<?php if (!empty($option4)): ?>
<?= $option4 ?> : <?= $option4_choice ?>
<?php if (!empty($option4_choice)): ?>
(<?= number_format(($option4_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1) ?>%)
<?php endif; ?>
<br/>
<?php endif; ?>
<?php if (!empty($option5)): ?>
<?= $option5 ?> : <?= $option5_choice ?>
<?php if (!empty($option5_choice)): ?>
(<?= number_format(($option5_choice / ($option1_choice + $option2_choice + $option3_choice + $option4_choice + $option5_choice)) * 100, 1) ?>%)
<?php endif; ?>
<br/>
<?php endif; ?>
</li>
</ul>
<div class="text-center gap-5">
<br/>
<?php if (!empty($option1)): ?>
<button class="btn btn-primary btn-xl text-uppercase" id="submitButton" type="submit"
onclick="location.href='update_option1_choice.php?num=<?=$num?>&page=<?=$page?>'">
<?= $option1 ?>
</button>
<?php endif; ?>
<?php if (!empty($option2)): ?>
<button class="btn btn-primary btn-xl text-uppercase" id="submitButton" type="submit"
onclick="location.href='update_option2_choice.php?num=<?=$num?>&page=<?=$page?>'">
<?= $option2 ?>
</button>
<?php endif; ?>
<?php if (!empty($option3)): ?>
<button class="btn btn-primary btn-xl text-uppercase" id="submitButton" type="submit"
onclick="location.href='update_option3_choice.php?num=<?=$num?>&page=<?=$page?>'">
<?= $option3 ?>
</button>
<?php endif; ?>
<?php if (!empty($option4)): ?>
<button class="btn btn-primary btn-xl text-uppercase" id="submitButton" type="submit"
onclick="location.href='update_option4_choice.php?num=<?=$num?>&page=<?=$page?>'">
<?= $option4 ?>
</button>
<?php endif; ?>
<?php if (!empty($option5)): ?>
<button class="btn btn-primary btn-xl text-uppercase" id="submitButton" type="submit"
onclick="location.href='update_option5_choice.php?num=<?=$num?>&page=<?=$page?>'">
<?= $option5 ?>
</button>
<?php endif; ?>
</div>
<ul class="buttons">
<li><button onclick="location.href='board_list.php?page=<?=$page?>'">목록</button></li>
<li><button onclick="location.href='board_delete.php?num=<?=$num?>&page=<?=$page?>'">삭제</button></li>
<li><button onclick="location.href='board_form.php'">글쓰기</button></li>
</ul>
</div> <!-- board_box -->
</section>
<footer>
<?php include "footer.php";?>
</footer>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="js/scripts.js"></script>
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *-->
<!-- * * SB Forms JS * *-->
<!-- * * Activate your form at https://startbootstrap.com/solution/contact-forms * *-->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *-->
<script src="https://cdn.startbootstrap.com/sb-forms-latest.js"></script>
</body>
</html>