초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
This commit is contained in:
48
filedata/delete.php
Normal file
48
filedata/delete.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
session_start();
|
||||
$num=$_REQUEST["num"];
|
||||
|
||||
require_once("../lib/MYDB.php");
|
||||
$pdo = db_connect();
|
||||
|
||||
$upload_dir = 'C:\xampp\htdocs\data\\'; //물리적 저장위치
|
||||
|
||||
try{
|
||||
$sql = "select * from phptest1.concert where num = ? ";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1,$num,PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$count = $stmh->rowCount();
|
||||
|
||||
$row = $stmh->fetch(PDO::FETCH_ASSOC);
|
||||
$copied_name[0] = $row[file_copied_0];
|
||||
$copied_name[1] = $row[file_copied_1];
|
||||
$copied_name[2] = $row[file_copied_2];
|
||||
|
||||
for ($i=0; $i<3; $i++)
|
||||
{
|
||||
if ($copied_name[$i])
|
||||
{
|
||||
$image_name = $upload_dir.$copied_name[$i];
|
||||
unlink($image_name);
|
||||
}
|
||||
}
|
||||
}catch (PDOException $Exception) {
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
|
||||
try{
|
||||
$pdo->beginTransaction();
|
||||
$sql = "delete from phptest1.concert where num = ?";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1,$num,PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
|
||||
header("Location:http://localhost/concert/list.php");
|
||||
|
||||
} catch (Exception $ex) {
|
||||
$pdo->rollBack();
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
?>
|
||||
200
filedata/insert.php
Normal file
200
filedata/insert.php
Normal file
@@ -0,0 +1,200 @@
|
||||
<?php session_start(); ?>
|
||||
<meta charset="utf-8">
|
||||
<?php
|
||||
if(!isset($_SESSION["userid"])) {
|
||||
?>
|
||||
<script>
|
||||
alert('로그인 후 이용해 주세요.');
|
||||
history.back();
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
if(isset($_REQUEST["mode"])) //modify_form에서 호출할 경우
|
||||
$mode=$_REQUEST["mode"];
|
||||
else
|
||||
$mode="";
|
||||
|
||||
if(isset($_REQUEST["num"]))
|
||||
$num=$_REQUEST["num"];
|
||||
else
|
||||
$num="";
|
||||
|
||||
if(isset($_REQUEST["html_ok"])) //checkbox는 체크해야 변수명 전달됨.
|
||||
$html_ok=$_REQUEST["html_ok"];
|
||||
else
|
||||
$html_ok="";
|
||||
|
||||
$subject=$_REQUEST["subject"];
|
||||
$content=$_REQUEST["content"];
|
||||
|
||||
$files = $_FILES["upfile"]; //첨부파일
|
||||
$count = count($files["name"]);
|
||||
$upload_dir = 'C:\xampp\htdocs\data\\'; //물리적 저장위치
|
||||
|
||||
for ($i=0; $i<$count; $i++)
|
||||
{
|
||||
$upfile_name[$i] = $files["name"][$i]; //교재 190페이지 참조
|
||||
$upfile_tmp_name[$i] = $files["tmp_name"][$i];
|
||||
$upfile_type[$i] = $files["type"][$i];
|
||||
$upfile_size[$i] = $files["size"][$i];
|
||||
$upfile_error[$i] = $files["error"][$i];
|
||||
$file = explode(".", $upfile_name[$i]);
|
||||
$file_name = $file[0];
|
||||
$file_ext = $file[1];
|
||||
|
||||
if (!$upfile_error[$i])
|
||||
{
|
||||
$new_file_name = date("Y_m_d_H_i_s");
|
||||
$new_file_name = $new_file_name."_".$i;
|
||||
$copied_file_name[$i] = $new_file_name.".".$file_ext;
|
||||
$uploaded_file[$i] = $upload_dir.$copied_file_name[$i];
|
||||
|
||||
if( $upfile_size[$i] > 5000000 ) {
|
||||
|
||||
print("
|
||||
<script>
|
||||
alert('업로드 파일 크기가 지정된 용량(5MB)을 초과합니다!<br>파일 크기를 체크해주세요! ');
|
||||
history.back();
|
||||
</script>
|
||||
");
|
||||
exit;
|
||||
}
|
||||
if ( ($upfile_type[$i] != "image/gif") && ($upfile_type[$i] != "image/jpeg"))
|
||||
{
|
||||
print(" <script>
|
||||
alert('JPG와 GIF 이미지 파일만 업로드 가능합니다!');
|
||||
history.back();
|
||||
</script>");
|
||||
exit;
|
||||
}
|
||||
if (!move_uploaded_file($upfile_tmp_name[$i], $uploaded_file[$i]) )
|
||||
{
|
||||
print("<script>
|
||||
alert('파일을 지정한 디렉토리에 복사하는데 실패했습니다.');
|
||||
history.back();
|
||||
</script>");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require_once("../lib/MYDB.php");
|
||||
$pdo = db_connect();
|
||||
|
||||
if ($mode=="modify"){
|
||||
$num_checked = count($_REQUEST['del_file']);
|
||||
$position = $_REQUEST['del_file'];
|
||||
|
||||
for($i=0; $i<$num_checked; $i++) // delete checked item
|
||||
{
|
||||
$index = $position[$i];
|
||||
$del_ok[$index] = "y";
|
||||
}
|
||||
|
||||
try{
|
||||
$sql = "select * from phptest1.concert where num=?"; // get target record
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1,$num,PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$row = $stmh->fetch(PDO::FETCH_ASSOC);
|
||||
} catch (PDOException $Exception) {
|
||||
$pdo->rollBack();
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
|
||||
for ($i=0; $i<$count; $i++)
|
||||
{
|
||||
$field_org_name = "file_name_".$i;
|
||||
$field_real_name = "file_copied_".$i;
|
||||
$org_name_value = $upfile_name[$i];
|
||||
$org_real_value = $copied_file_name[$i];
|
||||
if ($del_ok[$i] == "y")
|
||||
{
|
||||
$delete_field = "file_copied_".$i;
|
||||
$delete_name = $row[$delete_field];
|
||||
|
||||
$delete_path = $upload_dir . $delete_name;
|
||||
unlink($delete_path);
|
||||
|
||||
try{
|
||||
$pdo->beginTransaction();
|
||||
$sql = "update phptest1.concert set $field_org_name = ?, $field_real_name = ? where num=?";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, $org_name_value, PDO::PARAM_STR);
|
||||
$stmh->bindValue(2, $org_real_value, PDO::PARAM_STR);
|
||||
$stmh->bindValue(3, $num, PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
} catch (PDOException $Exception) {
|
||||
$pdo->rollBack();
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
} else {
|
||||
if (!$upfile_error[$i])
|
||||
{
|
||||
try{
|
||||
$pdo->beginTransaction();
|
||||
$sql = "update phptest1.concert set $field_org_name = ?, $field_real_name = ? where num=?";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, $org_name_value, PDO::PARAM_STR);
|
||||
$stmh->bindValue(2, $org_real_value, PDO::PARAM_STR);
|
||||
$stmh->bindValue(3, $num, PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
} catch (PDOException $Exception) {
|
||||
$pdo->rollBack();
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try{
|
||||
$pdo->beginTransaction();
|
||||
$sql = "update phptest1.concert set subject=?, content=?, is_html=? where num=?";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, $subject, PDO::PARAM_STR);
|
||||
$stmh->bindValue(2, $content, PDO::PARAM_STR);
|
||||
$stmh->bindValue(3, $html_ok, PDO::PARAM_STR);
|
||||
$stmh->bindValue(4, $num, PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
} catch (PDOException $Exception) {
|
||||
$pdo->rollBack();
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
|
||||
} else {
|
||||
if ($html_ok =="y"){
|
||||
$is_html = "y";
|
||||
}else {
|
||||
$is_html = "";
|
||||
$content = htmlspecialchars($content);
|
||||
}
|
||||
try{
|
||||
$pdo->beginTransaction();
|
||||
$sql = "insert into phptest1.concert(id, name, nick, subject, content, regist_day, hit, is_html, ";
|
||||
$sql .= " file_name_0, file_name_1, file_name_2, file_copied_0, file_copied_1, file_copied_2) ";
|
||||
$sql .= "values(?, ?, ?, ?, ?, now(), 0, ?, ?, ?, ?, ?, ?, ?)";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, $_SESSION["userid"], PDO::PARAM_STR);
|
||||
$stmh->bindValue(2, $_SESSION["name"], PDO::PARAM_STR);
|
||||
$stmh->bindValue(3, $_SESSION["nick"], PDO::PARAM_STR);
|
||||
$stmh->bindValue(4, $subject, PDO::PARAM_STR);
|
||||
$stmh->bindValue(5, $content, PDO::PARAM_STR);
|
||||
$stmh->bindValue(6, $is_html, PDO::PARAM_STR);
|
||||
$stmh->bindValue(7, $upfile_name[0], PDO::PARAM_STR);
|
||||
$stmh->bindValue(8, $upfile_name[1], PDO::PARAM_STR);
|
||||
$stmh->bindValue(9, $upfile_name[2], PDO::PARAM_STR);
|
||||
$stmh->bindValue(10, $copied_file_name[0], PDO::PARAM_STR);
|
||||
$stmh->bindValue(11, $copied_file_name[1], PDO::PARAM_STR);
|
||||
$stmh->bindValue(12, $copied_file_name[2], PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
} catch (PDOException $Exception) {
|
||||
$pdo->rollBack();
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
}
|
||||
header("Location:http://localhost/concert/list.php");
|
||||
?>
|
||||
|
||||
134
filedata/list.php
Normal file
134
filedata/list.php
Normal file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
session_start();
|
||||
?>
|
||||
<!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/concert.css">
|
||||
</head>
|
||||
|
||||
<?php
|
||||
|
||||
require_once("../lib/MYDB.php");
|
||||
$pdo = db_connect();
|
||||
|
||||
if(isset($_REQUEST["mode"]))
|
||||
$mode=$_REQUEST["mode"];
|
||||
else
|
||||
$mode="";
|
||||
|
||||
if(isset($_REQUEST["search"])) // search 쿼리스트링 값 할당 체크
|
||||
$search=$_REQUEST["search"];
|
||||
else
|
||||
$search="";
|
||||
|
||||
if(isset($_REQUEST["find"])) //목록표에 제목,이름 등 나오는 부분
|
||||
$find=$_REQUEST["find"];
|
||||
else
|
||||
$find="";
|
||||
|
||||
if($mode=="search"){
|
||||
if(!$search){
|
||||
?>
|
||||
<script>
|
||||
alert('검색할 단어를 입력해 주세요!');
|
||||
history.back();
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
$sql="select * from phptest1.concert where $find like '%$search%' order by num desc";
|
||||
} else {
|
||||
$sql="select * from phptest1.concert order by num desc";
|
||||
}
|
||||
try{
|
||||
$stmh = $pdo->query($sql);
|
||||
$count=$stmh->rowCount();
|
||||
?>
|
||||
<body>
|
||||
<div id="wrap">
|
||||
<div id="header">
|
||||
<?php include "../lib/top_login2.php"; ?>
|
||||
</div>
|
||||
<div id="menu">
|
||||
<?php include "../lib/top_menu2.php"; ?>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div id="col1">
|
||||
<div id="left_menu">
|
||||
<?php include "../lib/left_menu.php"; ?>
|
||||
</div>
|
||||
</div> <!-- end of col1 -->
|
||||
<div id="col2">
|
||||
<div id="title"><img src="../img/title_concert.gif"></div>
|
||||
<form name="board_form" method="post" action="list.php?mode=search">
|
||||
<div id="list_search">
|
||||
<div id="list_search1">▷ 총 <?= $count ?> 개의 게시물이 있습니다.</div>
|
||||
<div id="list_search2"><img src="../img/select_search.gif"></div>
|
||||
<div id="list_search3">
|
||||
<select name="find">
|
||||
<option value='subject'>제목</option>
|
||||
<option value='content'>내용</option>
|
||||
<option value='nick'>닉네임</option>
|
||||
<option value='name'>이름</option>
|
||||
</select></div> <!-- end of list_search3 -->
|
||||
<div id="list_search4"><input type="text" name="search"></div>
|
||||
<div id="list_search5"><input type="image" src="../img/list_search_button.gif"></div>
|
||||
</div> <!-- end of list_search -->
|
||||
</form>
|
||||
<div class="clear"></div>
|
||||
<div id="list_top_title">
|
||||
<ul>
|
||||
<li id="list_title1"><img src="../img/list_title1.gif"></li>
|
||||
<li id="list_title2"><img src="../img/list_title2.gif"></li>
|
||||
<li id="list_title3"><img src="../img/list_title3.gif"></li>
|
||||
<li id="list_title4"><img src="../img/list_title4.gif"></li>
|
||||
<li id="list_title5"><img src="../img/list_title5.gif"></li>
|
||||
</ul>
|
||||
</div> <!-- end of list_top_title -->
|
||||
<div id="list_content">
|
||||
<?php // 글 목록 출력
|
||||
|
||||
while($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
|
||||
$item_num=$row["num"];
|
||||
$item_id=$row["id"];
|
||||
$item_name=$row["name"];
|
||||
$item_nick=$row["nick"];
|
||||
$item_hit=$row["hit"];
|
||||
$item_date=$row["regist_day"];
|
||||
$item_date=substr($item_date, 0, 10);
|
||||
$item_subject=str_replace(" ", " ", $row["subject"]);
|
||||
?>
|
||||
<div id="list_item">
|
||||
<div id="list_item1"><?= $item_num ?></div>
|
||||
<div id="list_item2"><a href="view.php?num=<?=$item_num?>"><?= $item_subject ?></a></div>
|
||||
<div id="list_item3"><?= $item_nick ?></div>
|
||||
<div id="list_item4"><?= $item_date ?></div>
|
||||
<div id="list_item5"><?= $item_hit ?></div>
|
||||
</div> <!– end of list_item -->
|
||||
|
||||
<?php
|
||||
}
|
||||
} catch (PDOException $Exception) {
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="write_button">
|
||||
<a href="list.php"><img src="../img/list.png"></a>
|
||||
<?php
|
||||
if(isset($_SESSION["userid"]))
|
||||
{
|
||||
?>
|
||||
<a href="write_form.php"><img src="../img/write.png"></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of col2 -->
|
||||
</div> <!-- end of content -->
|
||||
</div> <!-- end of wrap -->
|
||||
</body>
|
||||
</html>
|
||||
141
filedata/view.php
Normal file
141
filedata/view.php
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
$file_dir = 'C:\xampp\htdocs\data\\';
|
||||
|
||||
$num=$_REQUEST["num"];
|
||||
|
||||
require_once("../lib/MYDB.php");
|
||||
$pdo = db_connect();
|
||||
|
||||
try{
|
||||
$sql = "select * from phptest1.concert where num=?";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, $num, PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
|
||||
$row = $stmh->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$item_num = $row["num"];
|
||||
$item_id = $row["id"];
|
||||
$item_name = $row["name"];
|
||||
$item_nick = $row["nick"];
|
||||
$item_hit = $row["hit"];
|
||||
|
||||
$image_name[0] = $row["file_name_0"];
|
||||
$image_name[1] = $row["file_name_1"];
|
||||
$image_name[2] = $row["file_name_2"];
|
||||
|
||||
$image_copied[0] = $row["file_copied_0"];
|
||||
$image_copied[1] = $row["file_copied_1"];
|
||||
$image_copied[2] = $row["file_copied_2"];
|
||||
|
||||
$item_date = $row["regist_day"];
|
||||
$item_date = substr($item_date,0,10);
|
||||
$item_subject = str_replace(" ", " ", $row["subject"]);
|
||||
$item_content = $row["content"];
|
||||
$is_html = $row["is_html"];
|
||||
|
||||
if ($is_html!="y"){
|
||||
$item_content = str_replace(" ", " ", $item_content);
|
||||
$item_content = str_replace("\n", "<br>", $item_content);
|
||||
}
|
||||
|
||||
$new_hit = $item_hit + 1;
|
||||
try{
|
||||
$pdo->beginTransaction();
|
||||
$sql = "update phptest1.concert set hit=? where num=?"; // 조회수 증가
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, $new_hit, PDO::PARAM_STR);
|
||||
$stmh->bindValue(2, $num, PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
} catch (PDOException $Exception) {
|
||||
$pdo->rollBack();
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
?>
|
||||
<!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/concert.css">
|
||||
<script>
|
||||
function del(href)
|
||||
{
|
||||
if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) {
|
||||
document.location.href = href;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrap">
|
||||
<div id="header"><?php include "../lib/top_login2.php"; ?></div>
|
||||
<div id="menu"><?php include "../lib/top_menu2.php"; ?></div>
|
||||
<div id="content">
|
||||
<div id="col1">
|
||||
<div id="left_menu"><?php include "../lib/left_menu.php"; ?></div>
|
||||
</div>
|
||||
<div id="col2">
|
||||
<div id="title"><img src="../img/title_concert.gif"></div>
|
||||
<div id="view_comment"> </div>
|
||||
<div id="view_title">
|
||||
<div id="view_title1"><?= $item_subject ?></div>
|
||||
<div id="view_title2"><?= $item_nick ?> | 조회 : <?= $item_hit ?> | <?= $item_date ?> </div>
|
||||
</div>
|
||||
<div id="view_content">
|
||||
<?php
|
||||
for ($i=0; $i<3; $i++)
|
||||
{
|
||||
if ($image_copied[$i])
|
||||
{
|
||||
$imageinfo = getimagesize($file_dir.$image_copied[$i]);
|
||||
$image_width[$i] = $imageinfo[0];
|
||||
$image_height[$i] = $imageinfo[1];
|
||||
$image_type[$i] = $imageinfo[2];
|
||||
$img_name = $image_copied[$i];
|
||||
$img_name = "../data/".$img_name;
|
||||
|
||||
if ($image_width[$i] > 785)
|
||||
$image_width[$i] = 785;
|
||||
|
||||
// image 타입 1은 gif 2는 jpg 3은 png
|
||||
if($image_type[$i]==1 || $image_type[$i]==2
|
||||
|| $image_type[$i]==3){
|
||||
print "<img src='$img_name' width='$image_width[$i]'><br><br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?= $item_content ?>
|
||||
</div>
|
||||
<div id="view_button">
|
||||
<a href="list.php"><img src="../img/list.png"></a>
|
||||
<?php
|
||||
if(isset($_SESSION["userid"])) {
|
||||
if($_SESSION["userid"]==$item_id || $_SESSION["userid"]=="admin" ||
|
||||
$_SESSION["level"]==1 )
|
||||
{
|
||||
?>
|
||||
<a href="write_form.php?mode=modify&num=<?=$num?>"><img src="../img/modify.png"></a>
|
||||
<a href="javascript:del('delete.php?num=<?=$num?>')"><img src="../img/delete.png"></a>
|
||||
<?php }
|
||||
?>
|
||||
<a href="write_form.php"><img src="../img/write.png"></a>
|
||||
<?php
|
||||
}
|
||||
} catch (PDOException $Exception) {
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div> <!-- end of col2 -->
|
||||
</div> <!-- end of content -->
|
||||
</div> <!-- end of wrap -->
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
150
filedata/write_form.php
Normal file
150
filedata/write_form.php
Normal file
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
if(isset($_REQUEST["mode"])) //수정 버튼을 클릭해서 호출했는지 체크
|
||||
$mode=$_REQUEST["mode"];
|
||||
else
|
||||
$mode="";
|
||||
|
||||
if(isset($_REQUEST["num"])) //수정 버튼을 클릭해서 호출했는지 체크
|
||||
$num=$_REQUEST["num"];
|
||||
else
|
||||
$num="";
|
||||
|
||||
require_once("../lib/MYDB.php");
|
||||
$pdo = db_connect();
|
||||
|
||||
if ($mode=="modify"){
|
||||
try{
|
||||
$sql = "select * from phptest1.concert where num = ? ";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
|
||||
$stmh->bindValue(1,$num,PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$count = $stmh->rowCount();
|
||||
if($count<1){
|
||||
print "검색결과가 없습니다.<br>";
|
||||
}else{
|
||||
$row = $stmh->fetch(PDO::FETCH_ASSOC);
|
||||
$item_subject = $row["subject"];
|
||||
$item_content = $row["content"];
|
||||
$item_file_0 = $row["file_name_0"];
|
||||
$item_file_1 = $row["file_name_1"];
|
||||
$item_file_2 = $row["file_name_2"];
|
||||
$copied_file_0 = $row["file_copied_0"];
|
||||
$copied_file_1 = $row["file_copied_1"];
|
||||
$copied_file_2 = $row["file_copied_2"];
|
||||
}
|
||||
}catch (PDOException $Exception) {
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!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/concert.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="wrap">
|
||||
<div id="header">
|
||||
<?php include "../lib/top_login2.php"; ?>
|
||||
</div>
|
||||
<div id="menu">
|
||||
<?php include "../lib/top_menu2.php"; ?>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div id="col1">
|
||||
<div id="left_menu">
|
||||
<?php include "../lib/left_menu.php";?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="col2">
|
||||
<div id="title"><img src="../img/title_concert.gif"></div>
|
||||
<div class="clear"></div>
|
||||
<div id="write_form_title">
|
||||
<img src="../img/write_form_title.gif">
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<?php
|
||||
if($mode=="modify"){
|
||||
?>
|
||||
<form name="board_form" method="post" action="insert.php?mode=modify&num=<?=$num?>" enctype="multipart/form-data">
|
||||
<?php } else {
|
||||
?>
|
||||
<form name="board_form" method="post" action="insert.php" enctype="multipart/form-data">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div id="write_form">
|
||||
<div class="write_line"></div>
|
||||
<div id="write_row1">
|
||||
<div class="col1"> 별명 </div>
|
||||
|
||||
<div class="col2"><?=$_SESSION["nick"]?></div>
|
||||
<div class="col3"><input type="checkbox" name="html_ok" value="y"> HTML 쓰기</div>
|
||||
</div>
|
||||
<div class="write_line"></div>
|
||||
<div id="write_row2">
|
||||
<div class="col1"> 제목 </div>
|
||||
<div class="col2"><input type="text" name="subject"
|
||||
<?php if($mode=="modify"){ ?>value="<?=$item_subject?>" <?php }?> required></div>
|
||||
</div>
|
||||
<div class="write_line"></div>
|
||||
<div id="write_row3">
|
||||
<div class="col1"> 내용 </div>
|
||||
<div class="col2"><textarea rows="15" cols="79" name="content"
|
||||
required><?php if($mode=="modify") print $item_content?></textarea></div>
|
||||
</div>
|
||||
<div class="write_line"></div>
|
||||
<div id="write_row4">
|
||||
<div class="col1"> 이미지파일1 </div>
|
||||
<div class="col2"><input type="file" name="upfile[]"></div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<?php if ($mode=="modify" && $item_file_0)
|
||||
{
|
||||
?>
|
||||
<div class="delete_ok">
|
||||
<?=$item_file_0?> 파일이 등록되어 있습니다.
|
||||
<input type="checkbox" name="del_file[]" value="0"> 삭제</div>
|
||||
<div class="clear"></div>
|
||||
<?php } ?>
|
||||
<div class="write_line"></div>
|
||||
<div id="write_row5"><div class="col1"> 이미지파일2 </div>
|
||||
<div class="col2"><input type="file" name="upfile[]"></div>
|
||||
</div>
|
||||
<?php if ($mode=="modify" && $item_file_1)
|
||||
{
|
||||
?>
|
||||
<div class="delete_ok"><?=$item_file_1?> 파일이 등록되어 있습니다.
|
||||
<input type="checkbox" name="del_file[]" value="1"> 삭제</div>
|
||||
<div class="clear"></div>
|
||||
<?php } ?>
|
||||
<div class="write_line"></div>
|
||||
<div class="clear"></div>
|
||||
<div id="write_row6"><div class="col1"> 이미지파일3 </div>
|
||||
<div class="col2"><input type="file" name="upfile[]"></div>
|
||||
</div>
|
||||
<?php if ($mode=="modify" && $item_file_2)
|
||||
{
|
||||
?>
|
||||
<div class="delete_ok"><?=$item_file_2?> 파일이 등록되어 있습니다.
|
||||
<input type="checkbox" name="del_file[]" value="2"> 삭제</div>
|
||||
<div class="clear"></div>
|
||||
<?php } ?>
|
||||
<div class="write_line"></div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div id="write_button"><input type="image" src="../img/ok.png">
|
||||
<a href="list.php"><img src="../img/list.png"></a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user