Files
sam-kd/screen/insert.php
hskwon aca1767eb9 초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경
- DB 연결 하드코딩 → .env 기반으로 변경
- MySQL strict mode DATE 오류 수정
2025-12-10 20:14:31 +09:00

44 lines
1.2 KiB
PHP

<?php session_start(); ?>
<meta charset="utf-8">
<?php
$text1=$_REQUEST["callname"]; // 전달인수가 변수명과 겹치면 오류가 발생해서 받아들이지 않는다.
$text2=$_REQUEST["text2"];
$cutwidth=$_REQUEST["cutwidth"];
$cutheight=$_REQUEST["cutheight"];
$text3="";
$text4="";
$text5="";
require_once("../lib/mydb.php");
$pdo = db_connect();
// 데이터 신규 등록하는 구간
try{
$pdo->beginTransaction();
$sql = "insert into chandj.screencut(text1, text2, text3, text4, text5) ";
$sql .= "values(?, ?, ?, ?, ? )"; //
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $text1, PDO::PARAM_STR);
$stmh->bindValue(2, $text2, PDO::PARAM_STR);
$stmh->bindValue(3, $text3, PDO::PARAM_STR);
$stmh->bindValue(4, $text4, PDO::PARAM_STR);
$stmh->bindValue(5, $text5, PDO::PARAM_STR);
$stmh->execute();
$pdo->commit();
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
header("Location:/screen/list.php?callname=$text1&cutwidth=$cutwidth&cutheight=$cutheight"); // 신규가입일때는 리스트로 이동
?>