Gestionnaire de fichiers - Editer - /home/kridsana/webapp.cm.in.th/673190902/u67319090038/P0001/index.php
Arrière
<!DOCTYPE html> <html lang="th"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>ระบบคำนวณคะแนนและเกรด</title> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 20px; background-color: #f2f2f2; color: #333; max-width: 600px; margin-left: auto; margin-right: auto; transition: background 0.5s ease-in-out; } h2 { text-align: center; color: #4CAF50; /* สีที่สดใส */ } label { display: block; margin-top: 10px; font-weight: bold; } input[type="number"] { width: 100%; padding: 10px; margin: 5px 0; box-sizing: border-box; border-radius: 5px; border: 1px solid #ccc; box-shadow: 0 2px 5px rgba(0,0,0,0.1); transition: box-shadow 0.3s ease; } input[type="number"]:focus { box-shadow: 0 0 8px rgba(0, 185, 0, 0.7); } button { background-color: #4CAF50; color: white; padding: 12px; border: none; cursor: pointer; width: 100%; margin-top: 10px; border-radius: 5px; transition: background 0.3s ease; } button:hover { background-color: #45a049; } .result { margin-top: 20px; padding: 10px; background-color: rgba(0, 0, 0, 0.1); color: #333; border-radius: 5px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2); } /* เพิ่มพื้นหลังตามเกรด */ .sky-clear { background: url('https://example.com/sunny-sky.jpg'), linear-gradient(to top, #87CEEB, #ffffff); color: #333; } .partly-cloudy { background: url('https://example.com/sunny-sky.jpg'), linear-gradient(to top, #87CEEB, #B0C4DE); color: #333; } .cloudy { background: url('https://example.com/sunny-sky.jpg'), linear-gradient(to top, #B0C4DE, #808080); color: #333; } .rainy { background: url('https://example.com/rainy-day.jpg'), linear-gradient(to top, #2F4F4F, #2F4F4F); color: #fff; /* ทำให้ตัวหนังสือขาวในฝนตก */ } .stormy { background: url('https://example.com/stormy-night.jpg'), #2F4F4F; color: #fff; /* ตัวหนังสือขาวเมื่อฝนตกหนัก */ } /* ต้นไม้สำหรับแต่ละเกรด */ .sky-clear .tree { background: url('https://example.com/full-tree.jpg') no-repeat center center; background-size: contain; height: 200px; } .partly-cloudy .tree { background: url('https://example.com/tree-with-fallen-leaves.jpg') no-repeat center center; background-size: contain; height: 200px; } .cloudy .tree { background: url('https://example.com/tree-with-fallen-leaves.jpg') no-repeat center center; background-size: contain; height: 200px; } .rainy .tree { background: url('https://example.com/dying-tree.jpg') no-repeat center center; background-size: contain; height: 200px; } .stormy .tree { background: url('https://example.com/dying-tree.jpg') no-repeat center center; background-size: contain; height: 200px; } </style> </head> <body> <h2>ระบบคำนวณคะแนนและเกรด</h2> <form method="post"> <label for="behavior">จิตพิสัย (20 คะแนน):</label> <input type="number" id="behavior" name="behavior" max="20" min="0" required> <label for="quiz">แบบทดสอบ (30 คะแนน):</label> <input type="number" id="quiz" name="quiz" max="30" min="0" required> <label for="work">งาน (20 คะแนน):</label> <input type="number" id="work" name="work" max="20" min="0" required> <label for="final">สอบปลายภาค (30 คะแนน):</label> <input type="number" id="final" name="final" max="30" min="0" required> <button type="submit" name="calculate">ประมวลผล</button> </form> <?php if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['calculate'])) { // รับข้อมูลจากฟอร์ม $behavior = $_POST['behavior']; $quiz = $_POST['quiz']; $work = $_POST['work']; $final = $_POST['final']; // คำนวณคะแนนรวม $total = $behavior + $quiz + $work + $final; // จัดเกรดตามคะแนนรวม if ($total >= 80) { $grade = "A"; $backgroundClass = "sky-clear"; } elseif ($total >= 75) { $grade = "B+"; $backgroundClass = "partly-cloudy"; } elseif ($total >= 70) { $grade = "B"; $backgroundClass = "cloudy"; } elseif ($total >= 65) { $grade = "C+"; $backgroundClass = "cloudy"; } elseif ($total >= 60) { $grade = "C"; $backgroundClass = "partly-cloudy"; } elseif ($total >= 55) { $grade = "D+"; $backgroundClass = "rainy"; } elseif ($total >= 50) { $grade = "D"; $backgroundClass = "rainy"; } else { $grade = "F"; $backgroundClass = "stormy"; } // แสดงผลลัพธ์ echo "<div class='result'>"; echo "<h3>ผลการประมวลผล</h3>"; echo "<p>คะแนนรวม: $total คะแนน</p>"; echo "<p>เกรด: $grade</p>"; echo "</div>"; // เพิ่มคลาสที่ใช้ในการเปลี่ยนพื้นหลัง echo "<script> document.body.classList.add('$backgroundClass'); </script>"; } ?> <!-- เพิ่มต้นไม้ในแต่ละเกรด --> <div class="tree"></div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Génération de la page: 0.49 |
proxy
|
phpinfo
|
Réglages