235 lines
13 KiB
PHP
235 lines
13 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
// Fetch settings
|
|
$stmt = db()->prepare("SELECT setting_key, setting_value FROM settings");
|
|
$stmt->execute();
|
|
$settings = $stmt->fetchAll(PDO::FETCH_KEY_PAIR);
|
|
|
|
$valentineImage = $settings['valentine_image'] ?: 'assets/pasted-20260206-164030-456a591e.jpg';
|
|
$isLocked = ($settings['is_locked'] ?? '0') === '1';
|
|
$bgColor = $settings['bg_color'] ?? '#ffe4e6';
|
|
$bgImage = $settings['bg_image'] ?? '';
|
|
$popupColor = $settings['popup_color'] ?? '#ffccd5';
|
|
|
|
// New settings
|
|
$p1TitleColor = $settings['p1_title_color'] ?? '#e63946';
|
|
$p1TitleSize = $settings['p1_title_size'] ?? '1.75rem';
|
|
$p1TitleFont = $settings['p1_title_font'] ?? 'Inter';
|
|
$p1TitleText = $settings['p1_title_text'] ?? 'Gvantsa, would you be my valentine?';
|
|
|
|
$p2TextColor = $settings['p2_text_color'] ?? '#e63946';
|
|
$p2TextSize = $settings['p2_text_size'] ?? '1.25rem';
|
|
$p2TextFont = $settings['p2_text_font'] ?? 'Inter';
|
|
$p2Line1Text = $settings['p2_line1_text'] ?? "Congratulations, you are now Sam's Valentine! ❤️";
|
|
$p2Line2Text = $settings['p2_line2_text'] ?? 'He is so incredibly lucky to have someone in his life who would click yes.';
|
|
|
|
$p2HintColor = $settings['p2_hint_color'] ?? '#636e72';
|
|
$p2HintSize = $settings['p2_hint_size'] ?? '0.85rem';
|
|
$p2HintFont = $settings['p2_hint_font'] ?? 'Inter';
|
|
$p2HintText = $settings['p2_hint_text'] ?? 'Redirecting you to a special surprise in 15 seconds...';
|
|
|
|
$imageRadius = $settings['image_radius'] ?? '12px';
|
|
|
|
$fonts = ['Inter', 'Arial', 'Verdana', 'Times New Roman', 'Georgia', 'Courier New', 'Brush Script MT', 'Comic Sans MS'];
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title><?= htmlspecialchars($p1TitleText) ?></title>
|
|
<?php
|
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'A special valentine proposal.';
|
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ($valentineImage ?: '');
|
|
?>
|
|
<meta name="description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<?php if ($projectImageUrl): ?>
|
|
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
<?php endif; ?>
|
|
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
<style>
|
|
:root {
|
|
--bg-color: <?= htmlspecialchars($bgColor) ?>;
|
|
--popup-bg: <?= htmlspecialchars($popupColor) ?>;
|
|
--bg-image: <?= $bgImage ? "url('" . htmlspecialchars($bgImage) . "')" : 'none' ?>;
|
|
|
|
--p1-title-color: <?= htmlspecialchars($p1TitleColor) ?>;
|
|
--p1-title-size: <?= htmlspecialchars($p1TitleSize) ?>;
|
|
--p1-title-font: <?= htmlspecialchars($p1TitleFont) ?>;
|
|
|
|
--p2-text-color: <?= htmlspecialchars($p2TextColor) ?>;
|
|
--p2-text-size: <?= htmlspecialchars($p2TextSize) ?>;
|
|
--p2-text-font: <?= htmlspecialchars($p2TextFont) ?>;
|
|
|
|
--p2-hint-color: <?= htmlspecialchars($p2HintColor) ?>;
|
|
--p2-hint-size: <?= htmlspecialchars($p2HintSize) ?>;
|
|
--p2-hint-font: <?= htmlspecialchars($p2HintFont) ?>;
|
|
|
|
--image-radius: <?= htmlspecialchars($imageRadius) ?>;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="<?= $isLocked ? 'state-locked' : '' ?>">
|
|
|
|
<div class="admin-controls">
|
|
<div class="control-buttons">
|
|
<button id="settings-toggle" title="Settings" style="<?= $isLocked ? 'display:none' : '' ?>">
|
|
<svg viewBox="0 0 24 24" width="20" height="20" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33 1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82 1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>
|
|
</button>
|
|
<button id="lock-btn" title="<?= $isLocked ? 'Unlock' : 'Lock' ?> changes">
|
|
<?php if ($isLocked): ?>
|
|
<svg viewBox="0 0 24 24" width="20" height="20" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>
|
|
<?php else: ?>
|
|
<svg viewBox="0 0 24 24" width="20" height="20" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 9.9-1"></path></svg>
|
|
<?php endif; ?>
|
|
</button>
|
|
<button id="reset-btn" title="Reset Experience">
|
|
<svg viewBox="0 0 24 24" width="20" height="20" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"></polyline><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"></path></svg>
|
|
</button>
|
|
</div>
|
|
|
|
<div id="settings-panel" class="settings-panel" style="display: none;">
|
|
<div class="settings-tabs">
|
|
<button class="tab-btn active" data-tab="general">General</button>
|
|
<button class="tab-btn" data-tab="page1">Page 1</button>
|
|
<button class="tab-btn" data-tab="page2">Page 2</button>
|
|
</div>
|
|
|
|
<div id="tab-general" class="tab-content active">
|
|
<div class="settings-group">
|
|
<label>Background Color</label>
|
|
<input type="color" id="bg-color-picker" value="<?= htmlspecialchars($bgColor) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Pop-up Color</label>
|
|
<input type="color" id="popup-color-picker" value="<?= htmlspecialchars($popupColor) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Background Image</label>
|
|
<button class="btn-small" onclick="document.getElementById('bg-image-input').click()">Upload</button>
|
|
<?php if ($bgImage): ?>
|
|
<button class="btn-small" id="remove-bg-btn" style="margin-top:2px">Remove</button>
|
|
<?php endif; ?>
|
|
<input type="file" id="bg-image-input" accept="image/*">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Image Rounding (px)</label>
|
|
<input type="range" id="image-radius-picker" min="0" max="100" value="<?= (int)str_replace('px', '', $imageRadius) ?>">
|
|
</div>
|
|
</div>
|
|
|
|
<div id="tab-page1" class="tab-content">
|
|
<div class="settings-group">
|
|
<label>Title Text</label>
|
|
<input type="text" class="setting-input" data-key="p1_title_text" value="<?= htmlspecialchars($p1TitleText) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Title Color</label>
|
|
<input type="color" class="setting-input" data-key="p1_title_color" value="<?= htmlspecialchars($p1TitleColor) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Title Size (rem)</label>
|
|
<input type="range" class="setting-input" data-key="p1_title_size" min="1" max="5" step="0.1" value="<?= (float)str_replace('rem', '', $p1TitleSize) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Title Font</label>
|
|
<select class="setting-input" data-key="p1_title_font">
|
|
<?php foreach ($fonts as $font): ?>
|
|
<option value="<?= $font ?>" <?= $p1TitleFont === $font ? 'selected' : '' ?>><?= $font ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="tab-page2" class="tab-content">
|
|
<div class="settings-group">
|
|
<label style="display: flex; align-items: center; gap: 5px;">
|
|
<input type="checkbox" id="preview-page2-toggle"> Preview Page 2
|
|
</label>
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Line 1 Text</label>
|
|
<input type="text" class="setting-input" data-key="p2_line1_text" value="<?= htmlspecialchars($p2Line1Text) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Line 2 Text</label>
|
|
<input type="text" class="setting-input" data-key="p2_line2_text" value="<?= htmlspecialchars($p2Line2Text) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Text Color</label>
|
|
<input type="color" class="setting-input" data-key="p2_text_color" value="<?= htmlspecialchars($p2TextColor) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Text Size (rem)</label>
|
|
<input type="range" class="setting-input" data-key="p2_text_size" min="1" max="3" step="0.1" value="<?= (float)str_replace('rem', '', $p2TextSize) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Text Font</label>
|
|
<select class="setting-input" data-key="p2_text_font">
|
|
<?php foreach ($fonts as $font): ?>
|
|
<option value="<?= $font ?>" <?= $p2TextFont === $font ? 'selected' : '' ?>><?= $font ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<hr>
|
|
<div class="settings-group">
|
|
<label>Hint Text</label>
|
|
<input type="text" class="setting-input" data-key="p2_hint_text" value="<?= htmlspecialchars($p2HintText) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Hint Color</label>
|
|
<input type="color" class="setting-input" data-key="p2_hint_color" value="<?= htmlspecialchars($p2HintColor) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Hint Size (rem)</label>
|
|
<input type="range" class="setting-input" data-key="p2_hint_size" min="0.5" max="2" step="0.05" value="<?= (float)str_replace('rem', '', $p2HintSize) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Hint Font</label>
|
|
<select class="setting-input" data-key="p2_hint_font">
|
|
<?php foreach ($fonts as $font): ?>
|
|
<option value="<?= $font ?>" <?= $p2HintFont === $font ? 'selected' : '' ?>><?= $font ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<div id="proposal-box">
|
|
<h1 class="p1-title"><?= htmlspecialchars($p1TitleText) ?></h1>
|
|
|
|
<div class="image-preview-container has-image">
|
|
<img id="preview-img" src="<?= htmlspecialchars($valentineImage) ?>" alt="Valentine Image">
|
|
</div>
|
|
|
|
<div class="button-group">
|
|
<button id="yes-btn" class="btn btn-yes">Yes</button>
|
|
<button id="no-btn" class="btn btn-no">No</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="success-message">
|
|
<p class="success-text p2-line1"><?= htmlspecialchars($p2Line1Text) ?></p>
|
|
<p class="success-text p2-line2"><?= htmlspecialchars($p2Line2Text) ?></p>
|
|
<div class="redirect-hint"><?= htmlspecialchars($p2HintText) ?></div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.6.0/dist/confetti.browser.min.js"></script>
|
|
<script>
|
|
const IS_LOCKED = <?= $isLocked ? 'true' : 'false' ?>;
|
|
</script>
|
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
</body>
|
|
</html>
|