<?
@extract($_GET);
@extract($_POST);
@extract($_SERVER);
include "db_connect.php";
$query="select * from testboard where g_num=$g_num";
$result=mysql_query($query,$conn);
$row=mysql_fetch_array($result);
$item_num = $row[g_num];
$item_id = $row[g_name];
$image_name[0] = $row[file_name1]; //
$image_name[1] = $row[file_name2];
$image_name[2] = $row[file_name3];
$image_copied[0] = $row[file_copied1];
$image_copied[1] = $row[file_copied2];
$image_copied[2] = $row[file_copied3];
for($i=0; $i<3; $i++){ // 이미지
if($image_copied[$i]){
$imageinfo = GetImageSize("./data/".$image_copied[$i]);
$image_width[$i] = $imageinfo[0];
$image_height[$i] = $imageinfo[1];
$image_type[$i] = $imageinfo[2];
if ($image_width[$i] > 785)
$image_width[$i] = 785;
}else{
$image_width[$i] = "";
$image_height[$i] = "";
$image_type[$i] = "";
}
}
?>
<meta charset= "utf-8">
<style>
td, input{font-size:9pt}
A:link{font-size:9pt; color:black; text-decoration:none; } <!--링크-->
A:visited{font-size:9pt; color:black; text-decoration:none; } <!--방문시-->
A:hover{font-size:9pt; color:black; text-decoration:none; underline;}
</style>
<center>
<br />
◎ <font size=5 face="Times New Roman, Times, serif" color="#aa3366"><b> 연습용 게시판</b></font> ◎
<br /><br />
<table width=600 border=0 cellpadding=2 cellspacing=1 bgcolor=#336699>
<tr bgcolor=#f2ffff>
<td height=20 align=center colspan=4 bgcolor=#336699><font color=#f2ffff><b><?=$row[g_subject]?></b></font>
<tr bgcolor=white>
<td bgcolor=#f2ffff width=50 align=center>글쓴이
<td width=250><?=$row[g_name]?>
<td width=50 bgcolor=#f2ffff align=center>이메일
<td width=250><?=$row[g_mail]?>
<tr bgcolor=white>
<td bgcolor=#f2ffff width=50 align=center>날짜
<td width=250><?=$row[g_date]?>
<td bgcolor=#f2ffff width=50 align=center>조회수
<td width=250><?=$row[g_view]?>
<tr bgcolor=#f2ffff>
<td colspan=4 bgcolor=white><pre>
<? // 이미지
for ($i=0; $i<3; $i++){
if ($image_copied[$i])
{
$img_name = $image_copied[$i];
$img_name = "./data/".$img_name;
$img_width = $image_width[$i];
echo "<img src='$img_name' width='$img_width'>"."<br><br>";
}
}
?>
<?=$row[g_content]?></pre>
<div id="ripple">
<?
$sql = "select * from testboard_ripple where parent='$item_num'";
$ripple_result = mysql_query($sql);
while ($row_ripple = mysql_fetch_array($ripple_result))
{
$ripple_num = $row_ripple[num];
$ripple_id = $row_ripple[id];
$ripple_content = str_replace("\n", "<br>", $row_ripple[content]);
$ripple_content = str_replace(" ", " ", $ripple_content);
$ripple_date = $row_ripple[regist_day];
?>
<div id="ripple_writer_title">
<ul>
<li id="writer_title1"><?=$ripple_id?></li>
<li id="writer_title2"><?=$ripple_date?></li>
<li id="writer_title3">
<?
//if($userid=="admin" || $userid==$ripple_id) // session
echo "<a href='delete_ripple.php?num=$item_num&ripple_num=$ripple_num'>[삭제]</a>";
?>
</li>
</ul>
</div>
<div id="ripple_content"><?=$ripple_content?></div>
<?
}
?>
<form name="ripple_form" method="post" action="insert_ripple.php?num=<?=$item_num?>">
<div id="ripple_box">
<div id="ripple_box1"><textarea rows="3" cols="82" name="ripple_content"></textarea>
</div>
<div id="ripple_box2"><input type = "submit" value="덧글작성"></div>
</div>
</form>
<!--기타 메뉴 -->
<tr>
<td colspan=4 bgcolor=white>
<table width=100%>
<tr>
<td width=200 height=20>
<a href=list.php?no=<?=$no?>>리스트</a>
<a href=write.php>글작성</a>
<a href=edit.php?g_num=<?=$g_num?>>수정</a>
<a href=predel.php?g_num=<?=$g_num?>>삭제</a>
<td align=right>
<?
//다음글
$query1=mysql_query("select g_num from testboard where g_num > $g_num limit 1",$conn); // 현재 글 넘버 값보다 값이 큰 넘버값을 한개 뽑아라,
$next_num=mysql_fetch_array($query1);
if($next_num[g_num])
{
echo "<a href=read.php?g_num=$next_num[g_num]>다음 글</a>";
}else{
echo "다음 글";
}
//이전글
$query1=mysql_query("select g_num from testboard where g_num < $g_num order by g_num desc limit 1",$conn); // 현재 글 넘버 값보다 값이 작은 넘버값을 한개 뽑아라,
$prev_num=mysql_fetch_array($query1);
if($prev_num[g_num])
{
echo "<a href=read.php?g_num=$prev_num[g_num]> 이전 글</a>";
}else{
echo " 이전 글";
}
?>
</table>
</td>
</tr>
<?
//조회수
$result=mysql_query("update testboard set g_view = g_view + 1 where g_num=$g_num"); // 글번호가 같으면 조회수 1증가
//디비종료
mysql_close($conn)
?>
</table>
</center>