403Webshell
Server IP : 172.67.187.206  /  Your IP : 172.71.28.156
Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30
System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586
User : SYSTEM ( 0)
PHP Version : 5.6.30
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Inetpub/www/training/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Inetpub/www/training/login.php
<?php
session_start();
include("db.php");

// ตรวจสอบถ้าอยู่ในระบบแล้ว
if (isset($_SESSION['user_id'])) {
    // เปลี่ยนเส้นทางตามบทบาทผู้ใช้
    if ($_SESSION['role'] == 'admin') {
        header("Location: admin/dashboard.php");
    } elseif ($_SESSION['role'] == 'group') {
        header("Location: group/dashboard.php");
    } else {
        header("Location: user/dashboard.php");
    }
    exit;
}

$error = "";

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

    $sql = "SELECT * FROM users WHERE username = '$username' AND password = '$password'";
    $result = mysqli_query($conn, $sql);

    if (mysqli_num_rows($result) == 1) {
        $row = mysqli_fetch_assoc($result);
        
        $_SESSION['user_id'] = $row['id'];
        $_SESSION['username'] = $row['username'];
        $_SESSION['role'] = $row['role'];
        $_SESSION['u_name'] = $row['u_name'];
        
        // เปลี่ยนเส้นทางตามบทบาทผู้ใช้
        if ($row['role'] == 'admin') {
            header("Location: admin/dashboard.php");
        } elseif ($row['role'] == 'group') {
            header("Location: group/dashboard.php");
        } else {
            header("Location: user/dashboard.php");
        }
        exit;
    } else {
        $error = "ชื่อผู้ใช้หรือรหัสผ่านไม่ถูกต้อง";
    }
}
?>

<!DOCTYPE html>
<html lang="th">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>เข้าสู่ระบบ - ระบบอบรมออนไลน์</title>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
</head>
<body class="bg-gray-100 font-sans">
    <!-- Navigation -->
    <nav class="bg-blue-600 p-4">
        <div class="container mx-auto flex justify-between items-center">
        <h1 class="text-white text-2xl font-bold">ระบบอบรมออนไลน์ สพม.ราชบุรี</h1>
        <div>
                <a href="index.php" class="bg-white text-blue-600 px-4 py-2 rounded mr-2 hover:bg-gray-200">หน้าแรก</a>
                <a href="register.php" class="bg-white text-blue-600 px-4 py-2 rounded hover:bg-gray-200">สมัครสมาชิก</a>
            </div>
        </div>
    </nav>

    <!-- Login Section -->
    <section class="py-16">
        <div class="container mx-auto max-w-md">
            <div class="bg-white p-8 rounded-lg shadow-md">
                <h2 class="text-2xl font-bold text-center mb-6">เข้าสู่ระบบ</h2>
                
                <?php if ($error): ?>
                    <div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-6">
                        <?php echo $error; ?>
                    </div>
                <?php endif; ?>
                
                <form method="post" action="">
                    <div class="mb-4">
                        <label class="block text-gray-700 font-semibold mb-2" for="username">Email</label>
                        <input type="text" name="username" id="username" class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500" required>
                    </div>
                    <div class="mb-6">
                        <label class="block text-gray-700 font-semibold mb-2" for="password">เบอร์โทรศัพท์</label>
                        <input type="text" name="password" id="password" class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500" required>
                    </div>
                    <button type="submit" class="w-full bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700">เข้าสู่ระบบ</button>
                </form>
                <p class="text-center mt-4">
                    ยังไม่มีบัญชี? <a href="register.php" class="text-blue-600 hover:underline">สมัครสมาชิก</a>
                </p>
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-blue-600 text-white py-8">
        <div class="container mx-auto text-center">
        <p>&copy; 2568 ระบบอบรมออนไลน์ สพม.ราชบุรี</p>
            <p>จัดทำระบบโดย นายชาคริต ราชนิธยากร นักวิชาการคอมพิวเตอร์ชำนาญการ</p>
        </div>
    </footer>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit