초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
This commit is contained in:
48
as/delete.php
Normal file
48
as/delete.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
session_start();
|
||||
$num=$_REQUEST["num"];
|
||||
|
||||
require_once("../lib/mydb.php");
|
||||
$pdo = db_connect();
|
||||
|
||||
$upload_dir = '../uplaods/'; //물리적 저장위치
|
||||
|
||||
try{
|
||||
$sql = "select * from chandj.work 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.work where num = ?";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1,$num,PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
|
||||
header("Location:/as/list.php");
|
||||
|
||||
} catch (Exception $ex) {
|
||||
$pdo->rollBack();
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user