| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/Menu_Nurse/wd/ |
Upload File : |
<?php
session_start();
$users = array(
"admin" => array(
"password" => "122133",
"building" => "IPD1,IPD3,ER,LR"
),
"Ipd1" => array(
"password" => "Ipd1",
"building" => "IPD1"
),
"Ipd3" => array(
"password" => "Ipd3",
"building" => "IPD3"
),
"erkm10" => array(
"password" => "1234",
"building" => "ER"
),
"Rungnapha" => array(
"password" => "1625",
"building" => "LR"
),
"aroonlr" => array(
"password" => "0868232984",
"building" => "LR"
),
);
$error = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = trim($_POST['username']);
$password = trim($_POST['password']);
if ($username === 'Rungnapha' && $password === '1625' || $username === 'aroonlr' && $password === '0868232984') {
$_SESSION["username"] = 'Rungnapha' || 'aroonlr';
$_SESSION["building"] = $users[$username]["building"]; // IPD1,IPD3 เป็นต้น
header("Location: indexLR.php");
exit();
} else if ($username === 'Ipd1' && $password === 'Ipd1' || $username === 'Ipd3' && $password === 'Ipd3') {
$_SESSION["username"] = 'Ipd1' || 'Ipd3';
$_SESSION["building"] = $users[$username]["building"]; // IPD1,IPD3 เป็นต้น
header("Location: index.php");
exit();
}
else if ($username === 'erkm10' && $password === '1234' ) {
$_SESSION["username"] = 'ER';
$_SESSION["building"] = $users[$username]["building"]; // IPD1,IPD3 เป็นต้น
header("Location: index.php");
exit();
}
else if ($username === 'admin' && $password === '122133' ) {
$_SESSION["username"] = 'admin';
$_SESSION["building"] = $users[$username]["building"]; // IPD1,IPD3 เป็นต้น
header("Location: index.php");
exit();
}
else {
$error = "Invalid username or password!";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Sign In</title>
<link rel="stylesheet" href="assets/bootstrap.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
body {
font-family: Arial;
background-color: #f2f2f2;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
}
.login-box {
background-color: #fff;
padding: 30px;
padding-bottom: 80px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 400px;
text-align: center;
position: relative;
/* << สำคัญสำหรับวางปุ่มแบบ absolute */
}
.login-box .login-button {
position: absolute;
bottom: 20px;
left: 20px;
width: auto;
}
.login-box h2 {
margin-bottom: 20px;
color: #333;
}
.form-group {
margin-bottom: 15px;
text-align: left;
}
.login-box label {
color: #000000;
font-size: 14px;
}
body {
font-size: 22px;
margin: 0;
padding: 0;
height: 100vh;
background: url('img/km10pic.png') center center fixed no-repeat;
background-size: 100%;
background-color: #f0f0f0;
display: flex;
align-items: center;
justify-content: center;
}
.content {
position: relative;
z-index: 1;
padding: 50px;
text-align: center;
color: white;
background-color: rgba(221, 213, 213, 0.55);
margin: 100px auto;
width: 100%;
height: 100%;
border-radius: 10px;
}
.form-control {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
}
.alert-danger {
color: #721c24;
background-color: #f8d7da;
border-color: #f5c6cb;
padding: 10px;
margin-bottom: 15px;
border: 1px solid transparent;
border-radius: 4px;
}
</style>
</head>
<body>
<div class="background"></div>
<div class="content">
<div class="login-box">
<h2 class="text-center">ลงชื่อเข้าใช้ <i class="fas fa-pen-square"></i></h2>
<?php if ($error): ?>
<div class="alert alert-danger"><?php echo $error; ?></div>
<?php endif; ?>
<form method="POST" action="sign_in.php">
<div class="form-group mb-3">
<label>Username</label>
<input type="text" name="username" required class="form-control">
</div>
<div class="form-group mb-3">
<label>Password</label>
<input type="password" name="password" required class="form-control">
</div>
<button type="submit" class="btn btn-primary w-100 login-button">เข้าสู่ระบบ</button>
</form>
</div>
</body>
</html>