Initial commit

This commit is contained in:
Porawit Dongwang
2026-09-16 23:20:08 +07:00
commit 0041668dbb
32577 changed files with 3687927 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
<?php
require_once '../init.php';
requireLogin();
header('Content-Type: application/json');
$action = $_GET['action'] ?? '';
try {
if ($action === 'add') {
$mockData = [
['กระทรวงสาธารณสุข', 'https://www.moph.go.th/', 1, 'normal', ''],
['กรมควบคุมโรค', 'https://ddc.moph.go.th/', 2, 'normal', ''],
['กรมอนามัย', 'https://anamai.moph.go.th/', 3, 'normal', ''],
['กรมการแพทย์', 'https://www.dms.go.th/', 4, 'maintenance', ''],
['สำนักงานคณะกรรมการอาหารและยา', 'https://www.fda.moph.go.th/', 5, 'normal', ''],
['สถาบันวัคซีนแห่งชาติ', 'https://nvi.go.th/', 6, 'normal', ''],
['องค์การเภสัชกรรม', 'https://www.gpo.or.th/', 7, 'normal', ''],
['กรมสุขภาพจิต', 'https://dmh.go.th/', 8, 'normal', ''],
['สำนักงานหลักประกันสุขภาพแห่งชาติ', 'https://www.nhso.go.th/', 9, 'normal', ''],
['แพทยสภา (ทดสอบยกเลิก)', 'https://tmc.or.th/', 10, 'cancelled', ''],
['กระทรวงศึกษาธิการ', 'https://www.moe.go.th/', 11, 'normal', ''],
['กระทรวงมหาดไทย', 'https://www.moi.go.th/', 12, 'normal', ''],
['กระทรวงการคลัง', 'https://www.mof.go.th/', 13, 'normal', ''],
['กระทรวงพาณิชย์', 'https://www.moc.go.th/', 14, 'normal', ''],
['กระทรวงเกษตรและสหกรณ์', 'https://www.moac.go.th/', 15, 'normal', ''],
['กระทรวงคมนาคม', 'https://www.mot.go.th/', 16, 'normal', ''],
['กระทรวงดิจิทัลเพื่อเศรษฐกิจและสังคม', 'https://www.mdes.go.th/', 17, 'normal', ''],
['กระทรวงแรงงาน', 'https://www.mol.go.th/', 18, 'normal', ''],
['กระทรวงอุตสาหกรรม', 'https://www.industry.go.th/', 19, 'normal', ''],
['กระทรวงการต่างประเทศ', 'https://www.mfa.go.th/', 20, 'normal', '']
];
$stmt = $pdo->prepare("INSERT INTO websites (name, url, display_order, status, logo_url, click_count, is_mock) VALUES (?, ?, ?, ?, ?, 0, 1)");
foreach ($mockData as $data) {
$stmt->execute($data);
}
logAction($pdo, 'Mock Data Add', 'Added 20 mock websites');
echo json_encode(['success' => true]);
} elseif ($action === 'clear') {
$pdo->exec("DELETE FROM websites WHERE is_mock = 1");
logAction($pdo, 'Mock Data Clear', 'Cleared all mock websites');
echo json_encode(['success' => true]);
} else {
throw new Exception("Invalid action");
}
} catch (Exception $e) {
echo json_encode(['success' => false, 'message' => $e->getMessage()]);
}