-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.php
69 lines (62 loc) · 1.82 KB
/
main.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
<div id="main_img_bar" >
<?php require('slide.php'); ?>
</div>
<div id="main_content">
<div id="latest">
<h4>최근 게시글</h4>
<ul>
<?php
$con = mysqli_connect("localhost", "Steve", "Vrick2956!@", "Term");
$sql = "select * from board order by num desc limit 5";
$result = mysqli_query($con, $sql);
if (!$result)
echo "게시판 DB 테이블(board)이 생성 전이거나 아직 게시글이 없습니다!";
else
{
while( $row = mysqli_fetch_array($result) )
{
$regist_day = substr($row["regist_day"], 0, 10);
?>
<li>
<span><a href="board_view.php?num=<?=$row["num"]?>"><?=$row["subject"]?></a></span>
<span><?=$row["name"]?></span>
<span><?=$regist_day?></span>
</li>
<?php
}
}
?>
</div>
<div id="point_rank">
<h4>포인트 랭킹</h4>
<ul>
<?php
$rank = 1;
$sql = "select * from members order by point desc limit 5";
$result = mysqli_query($con, $sql);
if (!$result)
echo "회원 DB 테이블(members)이 생성 전이거나 아직 가입된 회원이 없습니다!";
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);
?>
</ul>
</div>
</div>