-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_frontAllCat.php
213 lines (167 loc) · 6.82 KB
/
admin_frontAllCat.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
<!DOCTYPE html>
<html lang="ko">
<head>
<?php include "admin_head.php"; ?>
</head>
<body>
<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">
<?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']);
$rVal = $_GET['r'];
session_start();
$sql = "SELECT * FROM thumbs WHERE id = $q";
$result = $conn->query($sql) or die($conn->error);
$rows = mysqli_fetch_assoc($result);
$author = $rows['author'];
// $sqlAuth = "SELECT author, auth_detail FROM user_data WHERE author = '$author'";
$sqlAuth = "SELECT author, auth_detail FROM user_data WHERE author = ?";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sqlAuth)) {
// echo "sqlAuth error";
} else {
mysqli_stmt_bind_param($stmt, "s", $author);
mysqli_stmt_execute($stmt);
$resultAuth = mysqli_stmt_get_result($stmt);
}
// $resultAuth = $conn->query($sqlAuth) or die($conn->error);
$rowsAuth = mysqli_fetch_assoc($resultAuth);
$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();
$zinTitle = $rowZinNow['title'];
?>
<div class="view_wrap">
<div class="view_wrap_line">
<div class = 'view_img'>
<img src = '<?php echo $rows['img_dir']?>'>
</div>
<div class = 'view_category'><?php echo $rows['category']?></div>
<div class = 'view_author front_point_color'>
<?php echo $rows['author']?>
<div class = 'cs_box_front'>
<button class="view_btn1" onclick="location.href='./admin_create_cont.php'">게시물 작성</button>
<button class="view_btn1" name="<?=$q?>" onclick="catModi(this.name)">연재물 수정</button>
</div>
</div>
<ul class = 'view_contList'>
<?php
//모든 매거진 콘텐츠
$thisCat = $rows['category'];
// $sqlCont = "SELECT * FROM contents WHERE display = 'on' AND category = '$thisCat' OR (display = 'ok' AND category = '$thisCat') ORDER BY sess*1 DESC";
$sqlCont = "SELECT * FROM contents WHERE display = 'on' AND category = ? OR (display = 'ok' AND category = ?) ORDER BY sess*1 DESC";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sqlCont)) {
// echo "sqlCont error";
} else {
mysqli_stmt_bind_param($stmt, "ss", $thisCat, $thisCat);
mysqli_stmt_execute($stmt);
$resultCont = mysqli_stmt_get_result($stmt);
}
// $resultCont = $conn->query($sqlCont) or die($conn->error);
if($resultCont->num_rows >0){
while($rowCont = $resultCont->fetch_assoc()) {
$created_dateTime = $rowCont['created'];
$created_date = explode(" ", $created_dateTime)[0];
echo "
<li class='cont_li ";
//new indicator//
// $latestCatNowCont = $rowCatNowCont['created'];
$twoWeeksAgo = date("Y-m-d h:i:s", strtotime('-2 week'));
// echo $latestCatNowCont." ";
// echo $twoWeeksAgo." ";
if($created_dateTime > $twoWeeksAgo) {
echo "new";
}
//new indicator end//
echo "'>
<a class = 'frontCont' id = '";
echo $rowCont['id'];
echo "' name = '";
echo $rVal;
// echo $rows['id'];
echo "' onclick = 'adminAllContShow(this.id, this.name)'>
<div class='cont_li_title'>
<span class='li_number'>
<p>";
echo $rowCont['sess'];
echo '회</p>
</span>
<p>[';
echo $rowCont['zin'];
echo "] ";
echo $rowCont['title'];
echo '</p>
</div>
<div class="li_created">
<span>';
// echo $rowCont['created'];
echo $created_date;
echo '</span>
</div>
</a>
</li>';
}
}
?>
</ul>
<div class = 'view_detail'>
<?php
echo "<div class = 'view_auth_detail front_point_color'>";
if($rowsAuth['auth_detail']) {
echo "글쓴이 | ".$rowsAuth['auth_detail'];
}
echo "</div>";
?>
<?php
echo "<div class = 'view_cat_detail'>";
if($rows['cat_detail']) {
echo "코너 소개 | ".$rows['cat_detail'];
}
echo "</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.querySelector(".view_wrap").style.boxShadow = "0 4px 8px 0 rgba(0, 0, 0, 0.2)";
frontListColor("<?php echo $zin_color; ?>", "<?php echo $title_color; ?>", "<?php echo $point_color; ?>", "<?php echo $nav_color; ?>");
</script>
</body>
</html>