Files
sam-kd/free/delete.php
hskwon 297e70ff89 fix: PHP 파일 BOM 문자 제거 (15개 파일)
- free/delete.php
- notice/insert.php, write_form.php, delete_ripple.php, insert_ripple.php, view.php, delete.php
- notice1/insert.php, write_form.php, delete_ripple.php, list.php, insert_ripple.php, view.php, delete.php
- eworks/delete_ripple.php, insert_ripple.php
2025-12-11 10:38:06 +09:00

48 lines
1.2 KiB
PHP

<?php
session_start();
$num=$_REQUEST["num"];
require_once("../lib/mydb.php");
$pdo = db_connect();
$upload_dir = 'C:\xampp\htdocs\data\\'; //물리적 저장위치
try{
$sql = "select * from chandj.free 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 chandj.free where num = ?";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1,$num,PDO::PARAM_STR);
$stmh->execute();
$pdo->commit();
header("Location:/free/list.php");
} catch (Exception $ex) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
?>