Files
edu/skin/login.php
T

190 lines
5.0 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/../bbs/auth.php';
require_once __DIR__ . '/../bbs/db_conn.php';
edu_start_session();
if (edu_is_logged_in()) {
header('Location: /skin/index.php');
exit;
}
$redirect = trim((string) ($_GET['redirect'] ?? '/skin/index.php'));
if ($redirect === '' || strpos($redirect, '/') !== 0) {
$redirect = '/skin/index.php';
}
$errorMessage = trim((string) ($_GET['error'] ?? ''));
$memberIdInput = trim((string) ($_GET['member_id'] ?? ''));
$sysCompCode = trim((string) ($_GET['sys_comp_code'] ?? ''));
// 법인 목록 조회 (CO100)
$corp_list = [];
try {
$pdo = db_conn();
$stmt_corp = $pdo->query("CALL proc_get_code2_list('CO100')");
$corp_list = $stmt_corp->fetchAll(PDO::FETCH_ASSOC);
while ($stmt_corp->nextRowset()) {}
unset($stmt_corp, $pdo);
} catch (Exception $e) {
$corp_list = [];
}
?>
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>배움터 로그인</title>
<style>
:root {
--bg-1: #082a26;
--bg-2: #0b4d45;
--panel: #f2efe5;
--text: #1d2522;
--accent: #0e6b5f;
--accent-dark: #0a4f46;
--error: #b93737;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
min-height: 100vh;
font-family: 'Noto Sans KR', sans-serif;
color: var(--text);
background:
radial-gradient(1200px 600px at 80% -20%, rgba(255, 255, 255, 0.16), transparent 60%),
linear-gradient(140deg, var(--bg-1), var(--bg-2));
display: grid;
place-items: center;
padding: 24px;
}
.login-wrap {
width: min(420px, 100%);
background: var(--panel);
border-radius: 20px;
padding: 32px 28px;
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.26);
border: 1px solid rgba(0, 0, 0, 0.08);
}
.brand {
margin: 0 0 6px;
font-size: 28px;
line-height: 1.2;
font-weight: 800;
color: #0a4f46;
}
.sub {
margin: 0 0 24px;
font-size: 14px;
color: #4c5755;
}
.field {
margin-bottom: 12px;
}
.field input,
.field select {
width: 100%;
height: 50px;
padding: 0 14px;
border-radius: 10px;
border: 1px solid #c9d0cd;
font-size: 15px;
outline: none;
background: #fff;
appearance: none;
-webkit-appearance: none;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234c5755' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 14px center;
cursor: pointer;
}
.field input {
background-image: none;
cursor: text;
}
.field input:focus,
.field select:focus {
border-color: #1a8f80;
box-shadow: 0 0 0 3px rgba(26, 143, 128, 0.18);
}
.btn-login {
width: 100%;
height: 52px;
margin-top: 8px;
border: 0;
border-radius: 12px;
background: linear-gradient(180deg, #17a08f, var(--accent));
color: #fff;
font-size: 16px;
font-weight: 700;
cursor: pointer;
}
.btn-login:hover {
background: linear-gradient(180deg, #159182, var(--accent-dark));
}
.error {
margin: 0 0 14px;
padding: 10px 12px;
border-radius: 8px;
background: #fbe8e8;
color: var(--error);
font-size: 13px;
border: 1px solid #f2caca;
}
</style>
</head>
<body>
<div class="login-wrap">
<h1 class="brand">배움터</h1>
<p class="sub">사내 계정으로 로그인하세요.</p>
<?php if ($errorMessage !== ''): ?>
<p class="error"><?= htmlspecialchars($errorMessage, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') ?></p>
<?php endif; ?>
<form method="post" action="/bbs/login.php" autocomplete="off">
<input type="hidden" name="redirect"
value="<?= htmlspecialchars($redirect, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') ?>" />
<div class="field">
<select name="sys_comp_code" required>
<option value="">회사코드 선택</option>
<?php foreach ($corp_list as $corp): ?>
<option value="<?= htmlspecialchars($corp['code'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') ?>"
<?= $sysCompCode === $corp['code'] ? 'selected' : '' ?>>
<?= htmlspecialchars($corp['name'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') ?>
</option>
<?php endforeach; ?>
</select>
</div>
<div class="field">
<input type="text" name="member_id" placeholder="ID"
value="<?= htmlspecialchars($memberIdInput, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') ?>" required />
</div>
<div class="field">
<input type="password" name="intra_pw" placeholder="PW" required />
</div>
<button class="btn-login" type="submit">로그인</button>
</form>
</div>
</body>
</html>