-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.php
More file actions
152 lines (131 loc) · 3.76 KB
/
Copy pathview.php
File metadata and controls
152 lines (131 loc) · 3.76 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
<!DOCTYPE html>
<html>
<head>
<meta charset = 'utf-8'>
</head>
<style>
.view_table {
border: 1px solid #444444;
margin-top: 30px;
}
.view_title {
height: 30px;
text-align: center;
background-color: #cccccc;
color: white;
width: 1000px;
}
.view_id {
text-align: center;
background-color: #EEEEEE;
width: 30px;
}
.view_id2 {
background-color: white;
width: 60px;
}
.view_hit {
background-color: #EEEEEE;
width: 30px;
text-align: center;
}
.view_hit2 {
background-color: white;
width: 60px;
}
.view_content {
padding-top: 20px;
border-top: 1px solid #444444;
height: 500px;
}
.view_btn {
width: 700px;
height: 200px;
text-align: center;
margin: auto;
margin-top: 50px;
}
.view_btn1 {
height: 50px;
width: 100px;
font-size: 20px;
text-align: center;
background-color: white;
border: 2px solid black;
border-radius: 10px;
}
.view_comment_input {
width: 700px;
height: 500px;
text-align: center;
margin: auto;
}
.view_text3 {
font-weight: bold;
float: left;
margin-left: 20px;
}
.view_com_id {
width: 100px;
}
.view_comment {
width: 500px;
}
</style>
<body>
<?php
$connect = mysqli_connect('localhost', 'tnwjd4623', '1q2w3e4r', 'tnwjd4623');
$number = $_GET['number'];
session_start();
/*조회수*/
$hit = "update board set hit=hit+1 where number=$number";
$connect->query($hit);
/*게시물 출력*/
$query = "select title, content, date, hit, id from board where number =$number";
$result = $connect->query($query);
$rows = mysqli_fetch_assoc($result);
?>
<table class="view_table" align=center>
<tr>
<td colspan="4" class="view_title"><?php echo $rows['title']?></td>
</tr>
<tr>
<td class="view_id">작성자</td>
<td class="view_id2"><?php echo $rows['id']?></td>
<td class="view_hit">조회수</td>
<td class="view_hit2"><?php echo $rows['hit']?></td>
</tr>
<tr>
<td colspan="4" class="view_content" valign="top">
<?php echo $rows['content']?></td>
</tr>
</table>
<!-- MODIFY & DELETE -->
<div class="view_btn">
<button class="view_btn1" onclick="location.href='./index.php'">목록으로</button>
<button class="view_btn1" onclick="location.href='./modify.php?number=<?=$number?>&id=<?=$_SESSION['userid']?>'">수정</button>
<button class="view_btn1" onclick="location.href='./delete.php?number=<?=$number?>&id=<?=$_SESSION['userid']?>'">삭제</button>
</div>
<!-- COMMENT -->
<div class="view_comment_input">
<span class="view_text3">이름</span><span class="view_text4">댓글</span><br/>
<?php if(!isset($_SESSION['userid']))
{
?> <p>로그인 후 댓글을 작성할 수 있습니다.</p>
<?php }
else {
?>
<!-- 세션이 존재한다면 댓글 폼 활성화 -->
<form method="get" action="comment_action.php">
<span class="view_com_id"><?=$_SESSION['userid']?></span>
<input type="hidden" name="id" value="<?=$_SESSION['userid']?>">
<input class="view_comment"type="text" name="comment" placeholder="댓글을 입력해주세요">
<input type="hidden" name="number" value="<?=$number?>">
<input type="hidden" name="parent" value=0>
<input type="submit" value="작성">
</form>
<?php }
?>
<p>------------------------------------------------------------------------------</p>
</body>
</html>