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
@@ -0,0 +1,44 @@
<?php
// config/config.php
session_start();
// Define base URL for the application
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$host = $_SERVER['HTTP_HOST'];
// Assuming the project is in a folder named after the project in htdocs, we dynamically get the path
$script_path = dirname($_SERVER['SCRIPT_NAME']);
$base_url = $protocol . $host . $script_path . '/';
define('BASE_URL', $base_url);
// Notification API Tokens (Replace with real tokens when deploying)
define('LINE_BOT_TOKEN', 'YOUR_LINE_ACCESS_TOKEN');
define('LINE_GROUP_ID', 'YOUR_GROUP_ID');
define('TELEGRAM_BOT_TOKEN', 'YOUR_TELEGRAM_BOT_TOKEN');
define('TELEGRAM_CHAT_ID', 'YOUR_CHAT_ID');
// Security helpers
function escape($html) {
return htmlspecialchars($html, ENT_QUOTES | ENT_SUBSTITUTE, "UTF-8");
}
function generateCSRFToken() {
if (empty($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
}
return $_SESSION['csrf_token'];
}
function checkCSRFToken($token) {
if (empty($_SESSION['csrf_token']) || $token !== $_SESSION['csrf_token']) {
die("CSRF Token validation failed.");
}
return true;
}
// Redirect helper
function redirect($url) {
header("Location: " . BASE_URL . $url);
exit;
}