198 lines
12 KiB
PHP
198 lines
12 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';
|
|
$fontFamily = $settings['font_family'] ?? "'Inter', sans-serif";
|
|
$secondPageTextColor = $settings['second_page_text_color'] ?? '#e63946';
|
|
$secondPageBoxPosY = $settings['second_page_box_pos_y'] ?? '0';
|
|
$imageBorderRadius = $settings['image_border_radius'] ?? '12';
|
|
|
|
// New settings
|
|
$proposalText = $settings['proposal_text'] ?? 'Gvantsa, would you be my valentine?';
|
|
$successText1 = $settings['success_text_1'] ?? "Congratulations, you are now Sam's Valentine! ❤️";
|
|
$successText2 = $settings['success_text_2'] ?? "He is so incredibly lucky to have someone in his life who would click yes.";
|
|
$proposalTextColor = $settings['proposal_text_color'] ?? '#e63946';
|
|
$proposalTextSize = $settings['proposal_text_size'] ?? '2';
|
|
$successText1Size = $settings['success_text_1_size'] ?? '1.5';
|
|
$successText2Size = $settings['success_text_2_size'] ?? '0.9';
|
|
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title><?= htmlspecialchars($proposalText) ?></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&family=Dancing+Script:wght@400;700&family=Pacifico&family=Quicksand:wght@400;700&family=Caveat:wght@400;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' ?>;
|
|
--font-family: <?= $fontFamily ?>;
|
|
--second-page-text-color: <?= htmlspecialchars($secondPageTextColor) ?>;
|
|
--second-page-box-pos-y: <?= htmlspecialchars($secondPageBoxPosY) ?>px;
|
|
--image-border-radius: <?= htmlspecialchars($imageBorderRadius) ?>px;
|
|
|
|
--proposal-text-color: <?= htmlspecialchars($proposalTextColor) ?>;
|
|
--proposal-text-size: <?= htmlspecialchars($proposalTextSize) ?>rem;
|
|
--success-text-1-size: <?= htmlspecialchars($successText1Size) ?>rem;
|
|
--success-text-2-size: <?= htmlspecialchars($successText2Size) ?>rem;
|
|
}
|
|
</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-scroll-area">
|
|
<div class="settings-group">
|
|
<label style="display: flex; align-items: center; cursor: pointer; color: #e63946; font-weight: bold;">
|
|
<input type="checkbox" id="preview-success-toggle" style="margin-right: 8px; width: auto;">
|
|
Preview Success Page
|
|
</label>
|
|
</div>
|
|
|
|
<div class="settings-group">
|
|
<label>Proposal Text</label>
|
|
<textarea id="proposal-text-input" rows="2" style="width:100%; padding:6px; border:1px solid #e2e8f0; border-radius:6px;"><?= htmlspecialchars($proposalText) ?></textarea>
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Success Text Line 1</label>
|
|
<textarea id="success-text-1-input" rows="2" style="width:100%; padding:6px; border:1px solid #e2e8f0; border-radius:6px;"><?= htmlspecialchars($successText1) ?></textarea>
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Success Text Line 2</label>
|
|
<textarea id="success-text-2-input" rows="2" style="width:100%; padding:6px; border:1px solid #e2e8f0; border-radius:6px;"><?= htmlspecialchars($successText2) ?></textarea>
|
|
</div>
|
|
|
|
<div class="settings-group">
|
|
<label>Font Family</label>
|
|
<select id="font-family-select">
|
|
<option value="'Inter', sans-serif" <?= $fontFamily === "'Inter', sans-serif" ? 'selected' : '' ?>>Inter</option>
|
|
<option value="'Dancing Script', cursive" <?= $fontFamily === "'Dancing Script', cursive" ? 'selected' : '' ?>>Dancing Script</option>
|
|
<option value="'Pacifico', cursive" <?= $fontFamily === "'Pacifico', cursive" ? 'selected' : '' ?>>Pacifico</option>
|
|
<option value="'Quicksand', sans-serif" <?= $fontFamily === "'Quicksand', sans-serif" ? 'selected' : '' ?>>Quicksand</option>
|
|
<option value="'Caveat', cursive" <?= $fontFamily === "'Caveat', cursive" ? 'selected' : '' ?>>Caveat</option>
|
|
</select>
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Proposal Text Color</label>
|
|
<input type="color" id="proposal-text-color-picker" value="<?= htmlspecialchars($proposalTextColor) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Success Page Text Color</label>
|
|
<input type="color" id="second-page-text-color-picker" value="<?= htmlspecialchars($secondPageTextColor) ?>">
|
|
</div>
|
|
|
|
<div class="settings-group">
|
|
<label>Proposal Text Size (rem)</label>
|
|
<input type="number" id="proposal-text-size-input" step="0.1" value="<?= htmlspecialchars($proposalTextSize) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Success Text 1 Size (rem)</label>
|
|
<input type="number" id="success-text-1-size-input" step="0.1" value="<?= htmlspecialchars($successText1Size) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Success Text 2 Size (rem)</label>
|
|
<input type="number" id="success-text-2-size-input" step="0.1" value="<?= htmlspecialchars($successText2Size) ?>">
|
|
</div>
|
|
|
|
<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>Success Box Y Offset (px)</label>
|
|
<input type="number" id="second-page-box-pos-y-input" value="<?= htmlspecialchars($secondPageBoxPosY) ?>">
|
|
</div>
|
|
<div class="settings-group">
|
|
<label>Image Border Radius (px)</label>
|
|
<input type="number" id="image-border-radius-input" value="<?= htmlspecialchars($imageBorderRadius) ?>">
|
|
</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>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container" id="main-container">
|
|
<div id="proposal-box">
|
|
<h1 id="proposal-text-display"><?= htmlspecialchars($proposalText) ?></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" id="success-text-1-display"><?= htmlspecialchars($successText1) ?></p>
|
|
<p class="success-text success-text-small" id="success-text-2-display"><?= htmlspecialchars($successText2) ?></p>
|
|
<div class="redirect-hint">Redirecting you to a special surprise in 15 seconds...</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>
|