초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
This commit is contained in:
78
analysis/process_DB.php
Normal file
78
analysis/process_DB.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
session_start();
|
||||
$level= $_SESSION["level"];
|
||||
if(!isset($_SESSION["level"]) || $level>=8) {
|
||||
echo "<script> alert('관리자 승인이 필요합니다.') </script>";
|
||||
sleep(2);
|
||||
header ("Location:/login/logout.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if(isset($_REQUEST["page"]))
|
||||
$page=$_REQUEST["page"];
|
||||
else
|
||||
$page=1; // 1로 설정해야 함
|
||||
if(isset($_REQUEST["mode"])) //modify_form에서 호출할 경우
|
||||
$mode=$_REQUEST["mode"];
|
||||
else
|
||||
$mode="";
|
||||
|
||||
if(isset($_REQUEST["num"]))
|
||||
$num=$_REQUEST["num"];
|
||||
else
|
||||
$num="";
|
||||
|
||||
if(isset($_REQUEST["search"])) //수정 버튼을 클릭해서 호출했는지 체크
|
||||
$search=$_REQUEST["search"];
|
||||
else
|
||||
$search="";
|
||||
if(isset($_REQUEST["find"])) //수정 버튼을 클릭해서 호출했는지 체크
|
||||
$find=$_REQUEST["find"];
|
||||
else
|
||||
$find="";
|
||||
if(isset($_REQUEST["process"])) //수정 버튼을 클릭해서 호출했는지 체크
|
||||
$process=$_REQUEST["process"];
|
||||
else
|
||||
$process="전체";
|
||||
$fromdate=$_REQUEST["fromdate"];
|
||||
$todate=$_REQUEST["todate"];
|
||||
|
||||
// code는 접수완료, 처리완료를 표시해 준다.
|
||||
$code=$_REQUEST["code"];
|
||||
|
||||
if($code=="1")
|
||||
$regist_state="2";
|
||||
else
|
||||
$regist_state="3";
|
||||
|
||||
require_once("../lib/mydb.php");
|
||||
$pdo = db_connect();
|
||||
|
||||
try{
|
||||
$sql = "select regist_state from chandj.output 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();
|
||||
}
|
||||
|
||||
try{
|
||||
$pdo->beginTransaction();
|
||||
$sql = "update chandj.output set regist_state=? where num=? LIMIT 1";
|
||||
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, $regist_state, PDO::PARAM_STR);
|
||||
$stmh->bindValue(2, $num, PDO::PARAM_STR); //고유키값이 같나?의 의미로 ?로 num으로 맞춰야 합니다. where 구문
|
||||
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
} catch (PDOException $Exception) {
|
||||
$pdo->rollBack();
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
|
||||
header("Location:/output/view.php?num=$num&page=$page&search=$search&find=$find&process=$process&yearcheckbox=$yearcheckbox&year=$year&fromdate=$fromdate&todate=$todate&separate_date=$separate_date");
|
||||
?>
|
||||
Reference in New Issue
Block a user