fix: 세션 중복 호출 오류 수정 및 코드 정리
- session.php: isset($_SESSION) → session_status() 방식으로 변경 - notice/list.php: BOM 문자 제거 - login/login_result.php: 코드 포맷팅 정리
This commit is contained in:
@@ -1,98 +1,98 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
||||
|
||||
$id=$_REQUEST["uid"];
|
||||
$pw=$_REQUEST["upw"];
|
||||
$id = $_REQUEST["uid"];
|
||||
$pw = $_REQUEST["upw"];
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
||||
$pdo = db_connect();
|
||||
try{
|
||||
$sql="select * from $DB.member where id=?";
|
||||
$stmh=$pdo->prepare($sql);
|
||||
$stmh->bindValue(1,$id,PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$count=$stmh->rowCount();
|
||||
} catch (PDOException $Exception) {
|
||||
print "오류: ".$Exception->getMessage();
|
||||
try {
|
||||
$sql = "select * from $DB.member where id=?";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, $id, PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$count = $stmh->rowCount();
|
||||
} catch (PDOException $Exception) {
|
||||
print "오류: " . $Exception->getMessage();
|
||||
}
|
||||
|
||||
$row=$stmh->fetch(PDO::FETCH_ASSOC);
|
||||
$row = $stmh->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if($count<1) {
|
||||
if ($count < 1) {
|
||||
?>
|
||||
<script>
|
||||
alert("아이디가 틀립니다!");
|
||||
history.back();
|
||||
</script>
|
||||
<script>
|
||||
alert("아이디가 틀립니다!");
|
||||
history.back();
|
||||
</script>
|
||||
|
||||
<?php
|
||||
} elseif($pw!=$row["pass"]) {
|
||||
<?php
|
||||
} elseif ($pw != $row["pass"]) {
|
||||
?>
|
||||
<script>
|
||||
alert ("비밀번호가 틀립니다.!");
|
||||
history.back();
|
||||
</script>
|
||||
<?php
|
||||
<script>
|
||||
alert("비밀번호가 틀립니다.!");
|
||||
history.back();
|
||||
</script>
|
||||
<?php
|
||||
} else {
|
||||
|
||||
|
||||
$quitDate = $row["quitDate"] ?? '';
|
||||
if($quitDate != '' && $quitDate != null && $quitDate != '0000-00-00') {
|
||||
?>
|
||||
<script>
|
||||
alert("퇴사하셔서 로그인할 수 없습니다.");
|
||||
history.back();
|
||||
</script>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
$quitDate = $row["quitDate"] ?? '';
|
||||
if ($quitDate != '' && $quitDate != null && $quitDate != '0000-00-00') {
|
||||
?>
|
||||
<script>
|
||||
alert("퇴사하셔서 로그인할 수 없습니다.");
|
||||
history.back();
|
||||
</script>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
|
||||
$_SESSION["DB"]=$DB ;
|
||||
|
||||
$_SESSION["userid"] = $row["id"] ?? '';
|
||||
$_SESSION["name"] = $row["name"] ?? '';
|
||||
$_SESSION["nick"] = $row["nick"] ?? '';
|
||||
$_SESSION["level"] = $row["lv"] ?? '';
|
||||
$_SESSION["authority"] = $row["authority"] ?? '';
|
||||
$_SESSION["DB"] = $DB;
|
||||
|
||||
$_SESSION["ecountID"] = $row["ecountID"] ?? '';
|
||||
$_SESSION["division"] = $row["division"] ?? '';
|
||||
$_SESSION["mycompany"] = $row["division"] ?? '';
|
||||
$_SESSION["mypart"] = $row["part"] ?? '';
|
||||
$_SESSION["eworks_level"] = $row["eworks_lv"] ?? '';
|
||||
$_SESSION["eworks_lv"] = $row["eworks_lv"] ?? '';
|
||||
$_SESSION["position"] = $row["position"] ?? '';
|
||||
$_SESSION["hp"] = $row["hp"] ?? '';
|
||||
$_SESSION["authority"] = $row["authority"] ?? '';
|
||||
|
||||
$_SESSION["first_approval_id"]= $row["first_approval_id"] ?? '';
|
||||
$_SESSION["first_approval_name"]= $row["first_approval_name"] ?? '';
|
||||
|
||||
// log 기록
|
||||
$data=date("Y-m-d H:i:s") . " - " . $_SESSION["userid"] . " - " . $_SESSION["name"] ;
|
||||
$pdo->beginTransaction();
|
||||
$sql = "insert into chandj.logdata(data) values(?) " ;
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, $data, PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
$_SESSION["userid"] = $row["id"] ?? '';
|
||||
$_SESSION["name"] = $row["name"] ?? '';
|
||||
$_SESSION["nick"] = $row["nick"] ?? '';
|
||||
$_SESSION["level"] = $row["lv"] ?? '';
|
||||
$_SESSION["authority"] = $row["authority"] ?? '';
|
||||
|
||||
$_SESSION["ecountID"] = $row["ecountID"] ?? '';
|
||||
$_SESSION["division"] = $row["division"] ?? '';
|
||||
$_SESSION["mycompany"] = $row["division"] ?? '';
|
||||
$_SESSION["mypart"] = $row["part"] ?? '';
|
||||
$_SESSION["eworks_level"] = $row["eworks_lv"] ?? '';
|
||||
$_SESSION["eworks_lv"] = $row["eworks_lv"] ?? '';
|
||||
$_SESSION["position"] = $row["position"] ?? '';
|
||||
$_SESSION["hp"] = $row["hp"] ?? '';
|
||||
$_SESSION["authority"] = $row["authority"] ?? '';
|
||||
|
||||
$_SESSION["first_approval_id"] = $row["first_approval_id"] ?? '';
|
||||
$_SESSION["first_approval_name"] = $row["first_approval_name"] ?? '';
|
||||
|
||||
// log 기록
|
||||
$data = date("Y-m-d H:i:s") . " - " . $_SESSION["userid"] . " - " . $_SESSION["name"];
|
||||
$pdo->beginTransaction();
|
||||
$sql = "insert into chandj.logdata(data) values(?) ";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, $data, PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
|
||||
// 로그인 성공 시 쿠키 설정
|
||||
setcookie("showTodoView", "show", time() + 86400, "/"); // 1일 동안 유효
|
||||
setcookie("showBoardView", "show", time() + 86400, "/"); // 1일 동안 유효
|
||||
setcookie("showTodoView", "show", time() + 86400, "/"); // 1일 동안 유효
|
||||
setcookie("showBoardView", "show", time() + 86400, "/"); // 1일 동안 유효
|
||||
|
||||
// 세무사열림 아이디는 별도처리 (회계부분 메뉴만 보이게)
|
||||
// 회계사무실 수정
|
||||
// if($_SESSION["userid"] == '0266771300') {
|
||||
if($_SESSION["userid"] == '0266771300') {
|
||||
header ("Location:/index_accountant.php");
|
||||
exit;
|
||||
}
|
||||
if ($_SESSION["userid"] == '0266771300') {
|
||||
header("Location:/index_accountant.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION["division"] == '경동')
|
||||
header ("Location:/index.php");
|
||||
else
|
||||
header ("Location:/index1.php");
|
||||
if ($_SESSION["division"] == '경동')
|
||||
header("Location:/index.php");
|
||||
else
|
||||
header("Location:/index1.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
||||
// 첫 화면 표시 문구
|
||||
$title_message = '공지사항';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
if(!isset($_SESSION))
|
||||
session_start();
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
// .env 파일 로드
|
||||
$envFile = __DIR__ . '/.env';
|
||||
|
||||
Reference in New Issue
Block a user