-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.php
More file actions
96 lines (89 loc) · 2.68 KB
/
main.php
File metadata and controls
96 lines (89 loc) · 2.68 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
<div id="springsummmer_content">
<div id="latest">
<h4>Spring & Summer</h4>
<ul>
<!-- 최근 게시 글 DB에서 불러오기 -->
<?php
$con = mysqli_connect("localhost", "user1", "12345", "sample");
$sql = "select * from springsummer order by num desc limit 6";
$result = mysqli_query($con, $sql);
if (!$result)
echo "아직 게시글이 없습니다!";
else
{
while( $row = mysqli_fetch_array($result) )
{
$regist_day = substr($row["regist_day"], 0, 10);
?>
<li class="post-item" onclick="location.href='springsummer_view.php?num=<?=$row["num"]?>'">
<span><?=$row["subject"]?></span>
<span><?=$row["name"]?></span>
<span><?=$regist_day?></span>
</li>
<?php
}
}
?>
</div>
</div>
<div id="autumnwinter_content">
<div id="autumnwinter">
<h4>Autumn & Winter</h4>
<ul>
<!-- 최근 게시 글 DB에서 불러오기 -->
<?php
$con = mysqli_connect("localhost", "user1", "12345", "sample");
$sql = "select * from autumnwinter order by num desc limit 6";
$result = mysqli_query($con, $sql);
if (!$result)
echo "아직 게시글이 없습니다!";
else
{
while( $row = mysqli_fetch_array($result) )
{
$regist_day = substr($row["regist_day"], 0, 10);
?>
<li class="post-item" onclick="location.href='autumnwinter_view.php?num=<?=$row["num"]?>'">
<span><?=$row["subject"]?></span>
<span><?=$row["name"]?></span>
<span><?=$regist_day?></span>
</li>
<?php
}
}
?>
</div>
</div>
<div id="point_content">
<div id="point_rank">
<h4>여행 매니아</h4>
<ul>
<!-- 포인트 랭킹 표시하기 -->
<?php
$rank = 1;
$sql = "SELECT * FROM members WHERE level != 1 ORDER BY point DESC LIMIT 6";
$result = mysqli_query($con, $sql);
if (!$result) {
echo "아직 가입된 회원이 없습니다!";
} else {
while ($row = mysqli_fetch_array($result)) {
$name = $row["name"];
$id = $row["id"];
$point = $row["point"];
$name = mb_substr($name, 0, 1) . " * " . mb_substr($name, 2, 1);
?>
<li>
<span><?= $rank ?></span>
<span><?= $name ?></span>
<span><?= $id ?></span>
<span><?= $point ?></span>
</li>
<?php
$rank++;
}
}
mysqli_close($con);
?>
</div>
</ul>
</div>