28 lines
645 B
PHP
28 lines
645 B
PHP
<?php
|
|
// PHP Core Config
|
|
session_start();
|
|
|
|
// Include the existing database configuration
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
// Helper: Check if user is logged in
|
|
function check_auth() {
|
|
if (!isset($_SESSION['user_id'])) {
|
|
header("Location: login.php");
|
|
exit;
|
|
}
|
|
}
|
|
|
|
// Helper: Get user account
|
|
function get_account($user_id) {
|
|
$stmt = db()->prepare("SELECT * FROM accounts WHERE user_id = ?");
|
|
$stmt->execute([$user_id]);
|
|
return $stmt->fetch();
|
|
}
|
|
|
|
// Helper: Get site settings
|
|
function get_site_settings() {
|
|
$stmt = db()->query("SELECT * FROM site_settings LIMIT 1");
|
|
return $stmt->fetch();
|
|
}
|
|
?>
|