-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmento_find_list.php
254 lines (244 loc) ยท 8.03 KB
/
mento_find_list.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
254
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="./css/common.css">
<link rel="stylesheet" type="text/css" href="./css/board.css">
<link rel="stylesheet" href="css/main1.css">
<link rel="shortcut icon" href="img/favicon.png">
</head>
<body>
<header>
<?php include "header.php";?>
</header>
<section>
<div id="main_img_bar">
<img src="./img/main_img.png">
</div>
<div id="board_box">
<?php
$university = $_GET["university"];
if($university=="๊ฑด์๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="๋์ ๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="๋์ ์ ํ๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="๋ชฉ์๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="๋ฐฐ์ฌ๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="์ฐ์ก๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="์์ง๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="์ถฉ๋จ๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="์นจ๋ก์ ํ๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="ํ๊ตญ๊ณผํ๊ธฐ์ ์")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="ํ๋จ๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="ํ๋ฐญ๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="ํ๋ฐญ๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="๋๋๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="๋์ ๋ณด๊ฑด๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="์ฐ์ก์ ๋ณด๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="๋์ ๊ณผํ๊ธฐ์ ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="ํ๊ตญํด๋ฆฌํ
IV๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="๊ณผํ๊ธฐ์ ์ฐํฉ๋ํ์๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="๊ฑด์ ๋ํ์๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="๊ฑด์์ฌ์ด๋ฒ๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="ํ๊ตญ๋ฐฉ์กํต์ ๋ํ๊ต")
echo '<h3>', "$university ๋ฉํฐ ์ฐพ๊ธฐ", '</h3>';
elseif
($university=="none")
echo '<h3>', "๋ํ๊ต๋ฅผ ์ ํํ์ธ์!", '</h3>';
?>
<ul id="board_list">
<li>
<span class="col1">๋ฒํธ</span>
<span class="col2">์ ๋ชฉ</span>
<span class="col3">๊ธ์ด์ด</span>
<span class="col4">์ฒจ๋ถ</span>
<span class="col5">๋ฑ๋ก์ผ</span>
<span class="col6">์กฐํ</span>
</li>
<?php
$university = $_GET["university"];
if (isset($_GET["page"]))
$page = $_GET["page"];
else
$page = 1;
$con = mysqli_connect("localhost", "user1", "12345", "sample");
if($university=="๊ฑด์๋ํ๊ต")
$sql = "select * from mentofind order by num desc";
elseif($university=="๋์ ๋ํ๊ต")
$sql = "select * from mentofind1 order by num desc";
elseif($university=="๋์ ์ ํ๋ํ๊ต")
$sql = "select * from mentofind2 order by num desc";
elseif($university=="๋ชฉ์๋ํ๊ต")
$sql = "select * from mentofind3 order by num desc";
elseif($university=="๋ฐฐ์ฌ๋ํ๊ต")
$sql = "select * from mentofind4 order by num desc";
elseif($university=="์ฐ์ก๋ํ๊ต")
$sql = "select * from mentofind5 order by num desc";
elseif($university=="์์ง๋ํ๊ต")
$sql = "select * from mentofind6 order by num desc";
elseif($university=="์ถฉ๋จ๋ํ๊ต")
$sql = "select * from mentofind7 order by num desc";
elseif($university=="์นจ๋ก์ ํ๋ํ๊ต")
$sql = "select * from mentofind8 order by num desc";
elseif($university=="ํ๊ตญ๊ณผํ๊ธฐ์ ์")
$sql = "select * from mentofind9 order by num desc";
elseif($university=="ํ๋จ๋ํ๊ต")
$sql = "select * from mentofind10 order by num desc";
elseif($university=="ํ๋ฐญ๋ํ๊ต")
$sql = "select * from mentofind11 order by num desc";
elseif($university=="๋๋๋ํ๊ต")
$sql = "select * from mentofind12 order by num desc";
elseif($university=="๋์ ๋ณด๊ฑด๋ํ๊ต")
$sql = "select * from mentofind13 order by num desc";
elseif($university=="์ฐ์ก์ ๋ณด๋ํ๊ต")
$sql = "select * from mentofind14 order by num desc";
elseif($university=="๋์ ๊ณผํ๊ธฐ์ ํ๊ต")
$sql = "select * from mentofind15 order by num desc";
elseif($university=="ํ๊ตญํด๋ฆฌํ
IV๋ํ๊ต")
$sql = "select * from mentofind16 order by num desc";
elseif($university=="๊ณผํ๊ธฐ์ ์ฐํฉ๋ํ์๋ํ๊ต")
$sql = "select * from mentofind17 order by num desc";
elseif($university=="๊ฑด์ ๋ํ์๋ํ๊ต")
$sql = "select * from mentofind18 order by num desc";
elseif($university=="๊ฑด์์ฌ์ด๋ฒ๋ํ๊ต")
$sql = "select * from mentofind19 order by num desc";
elseif($university=="ํ๊ตญ๋ฐฉ์กํต์ ๋ํ๊ต")
$sql = "select * from mentofind1 order by num desc";
elseif($university=="none")
$sql = "select * from mentofind21 order by num desc";
$result = mysqli_query($con, $sql);
$total_record = mysqli_num_rows($result); // ์ ์ฒด ๊ธ ์
$scale = 10;
// ์ ์ฒด ํ์ด์ง ์($total_page) ๊ณ์ฐ
if ($total_record % $scale == 0)
$total_page = floor($total_record/$scale);
else
$total_page = floor($total_record/$scale) + 1;
// ํ์ํ ํ์ด์ง($page)์ ๋ฐ๋ผ $start ๊ณ์ฐ
$start = ($page - 1) * $scale;
$number = $total_record - $start;
for ($i=$start; $i<$start+$scale && $i < $total_record; $i++)
{
mysqli_data_seek($result, $i);
// ๊ฐ์ ธ์ฌ ๋ ์ฝ๋๋ก ์์น(ํฌ์ธํฐ) ์ด๋
$row = mysqli_fetch_array($result);
// ํ๋์ ๋ ์ฝ๋ ๊ฐ์ ธ์ค๊ธฐ
$num = $row["num"];
$id = $row["id"];
$name = $row["name"];
$subject = $row["subject"];
$regist_day = $row["regist_day"];
$hit = $row["hit"];
if ($row["file_name"])
$file_image = "<img src='./img/file.gif'>";
else
$file_image = " ";
?>
<li>
<span class="col1"><?=$number?></span>
<span class="col2"><a href="board_view.php?university=<?=$university?>&num=<?=$num?>&page=<?=$page?>"><?=$subject?></a></span>
<span class="col3"><?=$name?></span>
<span class="col4"><?=$file_image?></span>
<span class="col5"><?=$regist_day?></span>
<span class="col6"><?=$hit?></span>
</li>
<?php
$number--;
}
mysqli_close($con);
?>
</ul>
<ul id="page_num">
<?php
if ($total_page>=2 && $page >= 2)
{
$new_page = $page-1;
echo "<li><a href='mento_find_list.php?university=$university&page=$new_page'>โ ์ด์ </a> </li>";
}
else
echo "<li> </li>";
// ๊ฒ์ํ ๋ชฉ๋ก ํ๋จ์ ํ์ด์ง ๋งํฌ ๋ฒํธ ์ถ๋ ฅ
for ($i=1; $i<=$total_page; $i++)
{
if ($page == $i) // ํ์ฌ ํ์ด์ง ๋ฒํธ ๋งํฌ ์ํจ
{
echo "<li><b> $i </b></li>";
}
else
{
echo "<li><a href='mento_find_list.php?university=$university&page=$i'> $i </a><li>";
}
}
if ($total_page>=2 && $page != $total_page)
{
$new_page = $page+1;
echo "<li> <a href='mento_find_list.php?university=$university&page=$new_page'>๋ค์ โถ</a> </li>";
}
else
echo "<li> </li>";
?>
</ul> <!-- page -->
<ul class="buttons">
<li><button onclick="location.href='member_find.php'">๋ชฉ๋ก</button></li>
<li>
<?php
if($userid) {
?>
<button onclick="location.href='mento_board_form.php?university=<?=$university?>'">๊ธ์ฐ๊ธฐ</button>
<?php
} else {
?>
<a href="javascript:alert('๋ก๊ทธ์ธ ํ ์ด์ฉํด ์ฃผ์ธ์!')"><button>๊ธ์ฐ๊ธฐ</button></a>
<?php
}
?>
</li>
</ul>
</div> <!-- board_box -->
</section>
<footer>
<?php include "footer.php";?>
</footer>
</body>
</html>