-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_frontNoticeSlct.php
254 lines (185 loc) · 8.11 KB
/
admin_frontNoticeSlct.php
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<!DOCTYPE html>
<html lang="ko">
<head>
<?php include "admin_head.php"; ?>
</head>
<body>
<?php
include 'bbdd_db_conn.php';
$sqlStandingZin = "SELECT * FROM zin WHERE publish = 'standing'";
$resultStandingZin = $conn->query($sqlStandingZin) or die($conn->error);
$rowStandingZin = $resultStandingZin->fetch_assoc();
// $zin_column = $rowStandingZin['zin_column'];
// $zin_color = $rowStandingZin['zin_color'];
// $title_color = $rowStandingZin['title_color'];
// $point_color = $rowStandingZin['point_color'];
// $nav_color = $rowStandingZin['nav_color'];
$sqlZinNow = "SELECT * FROM zin WHERE publish='now' AND display = 'on' ORDER BY id DESC LIMIT 1";
$resultZinNow = $conn->query($sqlZinNow) or die($conn->error);
$rowZinNow = $resultZinNow->fetch_assoc();
$zin_column = $rowZinNow['zin_column'];
$zin_color = $rowZinNow['zin_color'];
$title_color = $rowZinNow['title_color'];
$point_color = $rowZinNow['point_color'];
$nav_color = $rowZinNow['nav_color'];
$q = intval($_GET['q']);
// $r = intval($_GET['r']);
$qVal = $_GET['q'];
// $rVal = $_GET['r'];
session_start();
$sql = "SELECT * FROM zin WHERE id = $q ";
$result = $conn->query($sql) or die($conn->error);
$rows = mysqli_fetch_assoc($result);
$zinTitle = $rows['title'];
$zinDate = $rows['date'];
$zinDetail = $rows['zin_detail'];
$sqlIdMax = "SELECT id FROM zin WHERE display='on' AND publish='ready' ORDER BY id DESC LIMIT 1";
$resultIdMax = $conn->query($sqlIdMax) or die($conn->error);
$rowsIdMax = mysqli_fetch_assoc($resultIdMax);
$idMax = $rowsIdMax['id'];
$sqlIdMin = "SELECT id FROM zin WHERE display='on' AND publish='ready' ORDER BY id ASC LIMIT 1";
$resultIdMin = $conn->query($sqlIdMin) or die($conn->error);
$rowsIdMin = mysqli_fetch_assoc($resultIdMin);
$idMin = $rowsIdMin['id'];
$sqlNext = "SELECT * FROM zin WHERE id > $q AND display='on' AND publish='ready' ORDER BY id ASC LIMIT 1";
$sqlPrev = "SELECT * FROM zin WHERE id < $q AND display='on' AND publish='ready' ORDER BY id DESC LIMIT 1";
if($q < $idMax && $q > $idMin) {
$sqlNext = "SELECT * FROM zin WHERE id > $q AND display='on' AND publish='ready' ORDER BY id ASC LIMIT 1";
$sqlPrev = "SELECT * FROM zin WHERE id < $q AND display='on' AND publish='ready' ORDER BY id DESC LIMIT 1";
} else if($q == $idMax && $q > $idMin) {
$sqlNext = "SELECT * FROM zin WHERE id = $q AND display='on' AND publish='ready'";
} else if($q == $idMin && $q < $idMax) {
$sqlPrev = "SELECT * FROM zin WHERE id = $q AND display='on' AND publish='ready'";
} else if($q ==$idMin && $q == $idMax) {
$sqlNext = "SELECT * FROM zin WHERE id = $q AND display='on' AND publish='ready' ";
$sqlPrev = "SELECT * FROM zin WHERE id = $q AND display='on' AND publish='ready' ";
}
$resultNext = $conn->query($sqlNext) or die($conn->error);
$rowsNext = mysqli_fetch_assoc($resultNext);
$idNext = $rowsNext['id'];
$resultPrev = $conn->query($sqlPrev) or die($conn->error);
$rowsPrev = mysqli_fetch_assoc($resultPrev);
$idPrev = $rowsPrev['id'];
$noCont = "noCont";
if($qVal < $idMax && $qVal > $idMin) {
$idNext = $rowsNext['id'];
$idPrev = $rowsPrev['id'];
} else if($qVal == $idMax && $qVal !== $idMin) {
$idNext = $noCont;
} else if($qVal == $idMin && $qVal !== $idMax) {
$idPrev = $noCont;
} else if($qVal == $idMin && $qVal == $idMax) {
$idNext = $noCont;
$idPrev = $noCont;
}
?>
<div id="bbdd_body">
<header id="bbdd_hd">
<?php include "admin_header.php"; ?>
</header>
<section id="bbdd_sc">
<div id="bbdd_sc_wrap">
<div id="bbdd_sc_area">
<div class="view_wrap">
<div class="view_wrap_line">
<div class = 'gg-batang view_cont_content'>
<!-- <?php// echo $rows['content']?> -->
<div class='magazin_title'>
<?php echo $zinTitle; ?>
</div>
<div class='magazin_date'>
<?php echo $zinDate; ?>
</div>
<div class='magazin_detail'>
<p>
<?php echo $zinDetail; ?>
</p>
</div>
<div class='cat_wrap'>
<?php
$sqlCat = "SELECT * FROM thumbs WHERE display = 'on'";
$resultCat = $conn->query($sqlCat) or die($conn->error);
if($resultCat->num_rows > 0) {
while($rowCat = $resultCat->fetch_assoc()) {
$catTitle = $rowCat['category'];
$sqlCatZinCont = "SELECT * FROM contents WHERE display = 'on' AND zin = '$zinTitle' AND category = '$catTitle' ORDER BY id DESC LIMIT 1";
$resultCatZinCont = $conn->query($sqlCatZinCont) or die($conn->error);
// $stmt = mysqli_stmt_init($conn);
// if (!mysqli_stmt_prepare($stmt, $sqlZinCont)) {
// // echo "sqlZinCont error";
// } else {
// mysqli_stmt_bind_param($stmt, "ss", $zinTitle, $catTitle);
// mysqli_stmt_execute($stmt);
// $resultCatZinCont = mysqli_stmt_get_result($stmt);
// }
$rowCatZinCont = $resultCatZinCont->fetch_assoc();
if($resultCatZinCont->num_rows > 0) {
echo "
<div class='category'>
<div class='category_list'>
<a id='{$rowCat["id"]}' class='cat frontCat' onclick='adminAllCatShow(this.id)' >";
echo " <div class='cat_img' style=background-image:url(";
echo '"';
echo $rowCat['img_dir'];
echo '");';
echo "'>";
echo '
<div class="cat_title">
<h2 class="gg-bold">';
echo $rowCat['category'];
echo ' </h2>
<div class="cat_author">
<h4>';
echo $rowCat['author'];
echo ' </h4>
</div>
</div>
</div>
</a>
</div>
</div>
';
}
}
}
?>
</div>
<div class = 'view_btn front_point_color'>
<?php
echo "
<div class='view_btn_past $idPrev' id='$idPrev' onclick='adminNoticeSlctShow(this.id)'>
←
</div>
<div class='view_btn_list' onclick='adminNoticeShow()'>
≡
</div>
<div class='view_btn_next $idNext' id='$idNext' onclick='adminNoticeSlctShow(this.id)'>
→
</div>
";
?>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<footer id="bbdd_ft">
<?php include "footer.php";?>
</footer>
</div>
<nav id="bbdd_nav">
<?php include "admin_nav.php"; ?>
</nav>
<div id="body_bg"></div>
<?php include "jsGroup.php"; ?>
<?php include "admin_jsGroup.php"; ?>
<script>
document.getElementById("bbdd_sc_area").style.backgroundColor = "rgb(255, 255, 255)";
document.getElementById("bbdd_ft_area").style.backgroundColor = "rgb(255, 255, 255)";
document.querySelector("body").style.backgroundColor = "rgb(255, 255, 255)";
frontListColor("rgb(255,255,255)", "<?php echo $title_color; ?>", "<?php echo $point_color; ?>", "<?php echo $nav_color; ?>");
</script>
</body>
</html>