diff --git a/api/save_settings.php b/api/save_settings.php index f852eae..06ca8d4 100644 --- a/api/save_settings.php +++ b/api/save_settings.php @@ -5,31 +5,26 @@ header('Content-Type: application/json'); $action = $_POST['action'] ?? ''; -// Check if locked for all modifying actions except toggle_lock -if ($action !== 'toggle_lock' && $action !== '') { - $stmt = db()->prepare("SELECT setting_value FROM settings WHERE setting_key = 'is_locked'"); - $stmt->execute(); - $isLocked = $stmt->fetchColumn(); - - if ($isLocked === '1') { - echo json_encode(['success' => false, 'error' => 'Settings are locked.']); - exit; - } -} - -if ($action === 'upload_bg_image') { +if ($action === 'upload_image') { if (isset($_FILES['image']) && $_FILES['image']['error'] === UPLOAD_ERR_OK) { - $uploadDir = __DIR__ . '/../assets/images/uploads/'; - if (!is_dir($uploadDir)) { - mkdir($uploadDir, 0775, true); + // Check if locked + $stmt = db()->prepare("SELECT setting_value FROM settings WHERE setting_key = 'is_locked'"); + $stmt->execute(); + $isLocked = $stmt->fetchColumn(); + + if ($isLocked === '1') { + echo json_encode(['success' => false, 'error' => 'Settings are locked.']); + exit; } - $fileName = 'bg_' . time() . '_' . basename($_FILES['image']['name']); + + $uploadDir = __DIR__ . '/../assets/images/uploads/'; + $fileName = 'valentine_' . time() . '_' . basename($_FILES['image']['name']); $targetPath = $uploadDir . $fileName; if (move_uploaded_file($_FILES['image']['tmp_name'], $targetPath)) { $webPath = 'assets/images/uploads/' . $fileName; - $stmt = db()->prepare("UPDATE settings SET setting_value = ? WHERE setting_key = 'bg_image'"); + $stmt = db()->prepare("UPDATE settings SET setting_value = ? WHERE setting_key = 'valentine_image'"); $stmt->execute([$webPath]); echo json_encode(['success' => true, 'path' => $webPath]); @@ -39,53 +34,22 @@ if ($action === 'upload_bg_image') { } else { echo json_encode(['success' => false, 'error' => 'No file uploaded or upload error.']); } -} elseif ($action === 'update_bg_color') { - $color = $_POST['color'] ?? ''; - if (preg_match('/^#[a-f0-9]{6}$/i', $color)) { - $stmt = db()->prepare("UPDATE settings SET setting_value = ? WHERE setting_key = 'bg_color'"); - $stmt->execute([$color]); - echo json_encode(['success' => true]); - } else { - echo json_encode(['success' => false, 'error' => 'Invalid color format.']); - } -} elseif ($action === 'update_popup_color') { - $color = $_POST['color'] ?? ''; - if (preg_match('/^#[a-f0-9]{6}$/i', $color)) { - $stmt = db()->prepare("UPDATE settings SET setting_value = ? WHERE setting_key = 'popup_color'"); - $stmt->execute([$color]); - echo json_encode(['success' => true]); - } else { - echo json_encode(['success' => false, 'error' => 'Invalid color format.']); - } -} elseif ($action === 'update_setting') { - $key = $_POST['key'] ?? ''; - $value = $_POST['value'] ?? ''; - $allowedKeys = [ - 'p1_title_color', 'p1_title_size', 'p1_title_font', 'p1_title_text', - 'p2_text_color', 'p2_text_size', 'p2_text_font', 'p2_line1_text', 'p2_line2_text', - 'p2_hint_color', 'p2_hint_size', 'p2_hint_font', 'p2_hint_text', - 'image_radius', 'yes_btn_color', 'no_btn_color' - ]; - if (in_array($key, $allowedKeys)) { - $stmt = db()->prepare("UPDATE settings SET setting_value = ? WHERE setting_key = ?"); - $stmt->execute([$value, $key]); - echo json_encode(['success' => true]); - } else { - echo json_encode(['success' => false, 'error' => 'Invalid setting key.']); - } -} elseif ($action === 'remove_bg_image') { - $stmt = db()->prepare("UPDATE settings SET setting_value = '' WHERE setting_key = 'bg_image'"); - $stmt->execute(); - echo json_encode(['success' => true]); } elseif ($action === 'toggle_lock') { $lockValue = $_POST['lock'] === 'true' ? '1' : '0'; $stmt = db()->prepare("UPDATE settings SET setting_value = ? WHERE setting_key = 'is_locked'"); $stmt->execute([$lockValue]); echo json_encode(['success' => true, 'locked' => $lockValue === '1']); } elseif ($action === 'reset') { - // Reset button positions and sizes is handled by reloading the page in the frontend. - // We no longer reset colors or text content here. + // We don't necessarily reset the image here unless specified, + // but the user said "reset the experience". + // Maybe it just clears the locked state and image? + // Usually "reset experience" for the user means restart the proposal. + // However, if they want to reset the setup, we can clear the image. + $stmt = db()->prepare("UPDATE settings SET setting_value = '' WHERE setting_key = 'valentine_image'"); + $stmt->execute(); + $stmt = db()->prepare("UPDATE settings SET setting_value = '0' WHERE setting_key = 'is_locked'"); + $stmt->execute(); echo json_encode(['success' => true]); } else { echo json_encode(['success' => false, 'error' => 'Invalid action.']); -} \ No newline at end of file +} diff --git a/assets/css/custom.css b/assets/css/custom.css index 033b807..87fbc6d 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -1,36 +1,15 @@ :root { --primary-color: #e63946; - --bg-color: #ffe4e6; /* Default Light Pink */ - --popup-bg: #ffccd5; /* Default Light Red */ - --bg-image: none; + --bg-color: #ffe4e6; /* Light Pink */ + --popup-bg: #ffccd5; /* Light Red */ --text-color: #2d3436; --secondary-text: #636e72; --border-color: rgba(0,0,0,0.05); --font-family: 'Inter', system-ui, -apple-system, sans-serif; - - --p1-title-color: #e63946; - --p1-title-size: 1.75rem; - --p1-title-font: 'Inter'; - - --p2-text-color: #e63946; - --p2-text-size: 1.25rem; - --p2-text-font: 'Inter'; - - --p2-hint-color: #636e72; - --p2-hint-size: 0.85rem; - --p2-hint-font: 'Inter'; - - --image-radius: 12px; - --yes-btn-color: #e63946; - --no-btn-color: #ffffff; } body { background-color: var(--bg-color); - background-image: var(--bg-image); - background-size: cover; - background-position: center; - background-attachment: fixed; color: var(--text-color); font-family: var(--font-family); margin: 0; @@ -46,15 +25,8 @@ body { top: 1rem; right: 1rem; display: flex; - flex-direction: column; gap: 0.5rem; z-index: 100; - align-items: flex-end; -} - -.control-buttons { - display: flex; - gap: 0.5rem; } .admin-controls button { @@ -78,96 +50,6 @@ body { transform: scale(1.1); } -.settings-panel { - background: white; - padding: 1rem; - border-radius: 12px; - box-shadow: 0 4px 15px rgba(0,0,0,0.1); - margin-top: 0.5rem; - display: flex; - flex-direction: column; - gap: 0.75rem; - width: 250px; - max-height: 80vh; - overflow-y: auto; - animation: slideDown 0.3s ease; -} - -.settings-tabs { - display: flex; - border-bottom: 1px solid #eee; - margin-bottom: 0.5rem; -} - -.tab-btn { - background: none !important; - border: none !important; - border-bottom: 2px solid transparent !important; - border-radius: 0 !important; - padding: 0.5rem !important; - width: auto !important; - height: auto !important; - font-size: 0.8rem !important; - font-weight: 600; - cursor: pointer; - color: var(--secondary-text) !important; - box-shadow: none !important; -} - -.tab-btn.active { - border-bottom-color: var(--primary-color) !important; - color: var(--primary-color) !important; -} - -.tab-content { - display: none; - flex-direction: column; - gap: 0.75rem; -} - -.tab-content.active { - display: flex; -} - -@keyframes slideDown { - from { opacity: 0; transform: translateY(-10px); } - to { opacity: 1; transform: translateY(0); } -} - -.settings-group { - display: flex; - flex-direction: column; - gap: 0.25rem; -} - -.settings-group label { - font-size: 0.75rem; - font-weight: 600; - color: var(--secondary-text); -} - -.settings-group input[type="color"], -.settings-group select { - width: 100%; - height: 30px; - border: 1px solid var(--border-color); - border-radius: 4px; - cursor: pointer; -} - -.settings-group input[type="range"] { - width: 100%; -} - -.settings-group .btn-small { - padding: 4px 8px; - font-size: 0.7rem; - background: #f1f2f6; - border: 1px solid #dfe4ea; - border-radius: 4px; - cursor: pointer; -} - .container { max-width: 500px; width: 90%; @@ -180,82 +62,87 @@ body { position: relative; } -h1.p1-title { - font-size: var(--p1-title-size); - font-family: var(--p1-title-font), var(--font-family); - color: var(--p1-title-color); +h1 { + font-size: 1.75rem; font-weight: 700; margin-bottom: 1.5rem; letter-spacing: -0.5px; + color: var(--primary-color); } .image-preview-container { width: 100%; - height: auto; min-height: 200px; max-height: 400px; + height: 250px; background-color: rgba(255, 255, 255, 0.5); - border: 2px solid rgba(0,0,0,0.05); - border-radius: var(--image-radius); + border: 2px dashed rgba(0,0,0,0.1); + border-radius: 12px; margin-bottom: 1.5rem; display: flex; justify-content: center; align-items: center; overflow: hidden; position: relative; + cursor: pointer; + transition: all 0.2s ease; +} + +.state-locked .image-preview-container { + cursor: default; + border-style: solid; } .image-preview-container img { width: 100%; height: 100%; - object-fit: contain; max-height: 400px; + object-fit: cover; + display: none; +} + +.image-preview-container .placeholder-text { + color: var(--secondary-text); + font-size: 0.9rem; + padding: 1rem; } .button-group { - display: grid; - grid-template-columns: 1fr 1fr; - justify-items: center; + display: flex; + justify-content: center; align-items: center; + gap: 1rem; margin-top: 2rem; position: relative; - min-height: 80px; + min-height: 60px; } .btn { - padding: 1.125rem 2.625rem; - font-size: 1.5rem; + padding: 0.75rem 1.75rem; + font-size: 1rem; font-weight: 600; - border-radius: 12px; + border-radius: 10px; border: none; cursor: pointer; transition: transform 0.1s ease, font-size 0.2s ease, background-color 0.2s ease; white-space: nowrap; } -.btn:active { - transform: scale(0.9) !important; -} - .btn-yes { - background-color: var(--yes-btn-color); + background-color: var(--primary-color); color: white; z-index: 10; box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3); } .btn-yes:hover { - filter: brightness(0.9); + background-color: #d62839; } .btn-no { - background-color: var(--no-btn-color); + background-color: #fff; color: var(--text-color); position: relative; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); } -.btn-no:hover { - filter: brightness(0.95); -} - #success-message { display: none; animation: fadeIn 0.8s ease forwards; @@ -267,28 +154,20 @@ h1.p1-title { } .success-text { - font-size: var(--p2-text-size); - font-family: var(--p2-text-font), var(--font-family); - color: var(--p2-text-color); + font-size: 1.25rem; line-height: 1.6; + color: var(--primary-color); font-weight: 700; margin-bottom: 0.5rem; } .redirect-hint { margin-top: 2rem; - font-size: var(--p2-hint-size); - font-family: var(--p2-hint-font), var(--font-family); - color: var(--p2-hint-color); + font-size: 0.85rem; + color: var(--secondary-text); font-style: italic; } -#image-input, #bg-image-input { +#image-input { display: none; } - -hr { - border: none; - border-top: 1px solid #eee; - margin: 0.5rem 0; -} \ No newline at end of file diff --git a/assets/js/main.js b/assets/js/main.js index 0b2f900..9a9aeac 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1,215 +1,51 @@ document.addEventListener('DOMContentLoaded', () => { const noBtn = document.getElementById('no-btn'); const yesBtn = document.getElementById('yes-btn'); + const imageInput = document.getElementById('image-input'); + const imagePreview = document.getElementById('preview-img'); + const placeholderText = document.querySelector('.placeholder-text'); const proposalBox = document.getElementById('proposal-box'); const successBox = document.getElementById('success-message'); const lockBtn = document.getElementById('lock-btn'); const resetBtn = document.getElementById('reset-btn'); - const settingsToggle = document.getElementById('settings-toggle'); - const settingsPanel = document.getElementById('settings-panel'); - const bgColorPicker = document.getElementById('bg-color-picker'); - const popupColorPicker = document.getElementById('popup-color-picker'); - const bgImageInput = document.getElementById('bg-image-input'); - const removeBgBtn = document.getElementById('remove-bg-btn'); - const imageRadiusPicker = document.getElementById('image-radius-picker'); - const previewPage2Toggle = document.getElementById('preview-page2-toggle'); let yesScale = 1; let isLocked = typeof IS_LOCKED !== 'undefined' ? IS_LOCKED : false; - // Audio Context for sounds - const AudioCtx = window.AudioContext || window.webkitAudioContext; - let audioCtx = null; - - function playSound(type) { - if (!audioCtx) audioCtx = new AudioCtx(); - const osc = audioCtx.createOscillator(); - const gain = audioCtx.createGain(); - - osc.connect(gain); - gain.connect(audioCtx.destination); - - const now = audioCtx.currentTime; - - if (type === 'happy') { - // Happy sound: Arpeggio - osc.type = 'sine'; - osc.frequency.setValueAtTime(523.25, now); // C5 - osc.frequency.exponentialRampToValueAtTime(880, now + 0.1); // A5 - gain.gain.setValueAtTime(0.3, now); - gain.gain.exponentialRampToValueAtTime(0.01, now + 0.3); - osc.start(now); - osc.stop(now + 0.3); - } else { - // Less happy sound: Low thud - osc.type = 'triangle'; - osc.frequency.setValueAtTime(150, now); - osc.frequency.exponentialRampToValueAtTime(40, now + 0.2); - gain.gain.setValueAtTime(0.3, now); - gain.gain.exponentialRampToValueAtTime(0.01, now + 0.2); - osc.start(now); - osc.stop(now + 0.2); - } - } - - // Settings Toggle - if (settingsToggle) { - settingsToggle.addEventListener('click', () => { - settingsPanel.style.display = settingsPanel.style.display === 'none' ? 'flex' : 'none'; - }); - } - - // Tabs logic - const tabBtns = document.querySelectorAll('.tab-btn'); - const tabContents = document.querySelectorAll('.tab-content'); - tabBtns.forEach(btn => { - btn.addEventListener('click', () => { - const tab = btn.dataset.tab; - tabBtns.forEach(b => b.classList.remove('active')); - tabContents.forEach(c => c.classList.remove('active')); - btn.classList.add('active'); - document.getElementById(`tab-${tab}`).classList.add('active'); - }); + // Image Upload Logic + document.querySelector('.image-preview-container').addEventListener('click', () => { + if (isLocked) return; + imageInput.click(); }); - // Preview Page 2 Toggle - if (previewPage2Toggle) { - previewPage2Toggle.addEventListener('change', (e) => { - if (e.target.checked) { - proposalBox.style.display = 'none'; - successBox.style.display = 'block'; - } else { - proposalBox.style.display = 'block'; - successBox.style.display = 'none'; - } - }); - } - - // Image Radius - if (imageRadiusPicker) { - imageRadiusPicker.addEventListener('input', (e) => { - document.documentElement.style.setProperty('--image-radius', `${e.target.value}px`); - }); - imageRadiusPicker.addEventListener('change', (e) => { - saveSetting('image_radius', `${e.target.value}px`); - }); - } - - // Generic Setting Inputs - const settingInputs = document.querySelectorAll('.setting-input'); - settingInputs.forEach(input => { - const key = input.dataset.key; - - input.addEventListener('input', (e) => { - let value = e.target.value; - - // Handle Text Updates - if (key === 'p1_title_text') { - document.querySelector('.p1-title').textContent = value; - } else if (key === 'p2_line1_text') { - document.querySelector('.p2-line1').textContent = value; - } else if (key === 'p2_line2_text') { - document.querySelector('.p2-line2').textContent = value; - } else if (key === 'p2_hint_text') { - document.querySelector('.redirect-hint').textContent = value; - } - - // Handle CSS Variable Updates - let cssKey = key.replace(/_/g, '-'); - if (input.type === 'range') { - if (key.includes('size')) value += 'rem'; - else if (key.includes('radius')) value += 'px'; - } - document.documentElement.style.setProperty(`--${cssKey}`, value); - }); - - input.addEventListener('change', (e) => { - let value = e.target.value; - if (input.type === 'range') { - if (key.includes('size')) value += 'rem'; - else if (key.includes('radius')) value += 'px'; - } - saveSetting(key, value); - }); - }); - - function saveSetting(key, value) { - const formData = new FormData(); - formData.append('action', 'update_setting'); - formData.append('key', key); - formData.append('value', value); - return fetch('api/save_settings.php', { method: 'POST', body: formData }); - } - - // Color Pickers - if (bgColorPicker) { - bgColorPicker.addEventListener('input', (e) => { - document.documentElement.style.setProperty('--bg-color', e.target.value); - }); - bgColorPicker.addEventListener('change', (e) => { + imageInput.addEventListener('change', function() { + const file = this.files[0]; + if (file) { const formData = new FormData(); - formData.append('action', 'update_bg_color'); - formData.append('color', e.target.value); - fetch('api/save_settings.php', { method: 'POST', body: formData }); - }); - } + formData.append('action', 'upload_image'); + formData.append('image', file); - if (popupColorPicker) { - popupColorPicker.addEventListener('input', (e) => { - document.documentElement.style.setProperty('--popup-bg', e.target.value); - }); - popupColorPicker.addEventListener('change', (e) => { - const formData = new FormData(); - formData.append('action', 'update_popup_color'); - formData.append('color', e.target.value); - fetch('api/save_settings.php', { method: 'POST', body: formData }); - }); - } - - // Background Image Upload - if (bgImageInput) { - bgImageInput.addEventListener('change', function() { - const file = this.files[0]; - if (file) { - const formData = new FormData(); - formData.append('action', 'upload_bg_image'); - formData.append('image', file); - - fetch('api/save_settings.php', { - method: 'POST', - body: formData - }) - .then(response => response.json()) - .then(data => { - if (data.success) { - document.documentElement.style.setProperty('--bg-image', `url('${data.path}?t=${new Date().getTime()}')`); - location.reload(); // Reload to update the "Remove" button visibility - } else { - alert(data.error || 'Failed to upload background image'); - } - }) - .catch(error => { - console.error('Error:', error); - alert('An error occurred during upload.'); - }); - } - }); - } - - if (removeBgBtn) { - removeBgBtn.addEventListener('click', () => { - const formData = new FormData(); - formData.append('action', 'remove_bg_image'); - fetch('api/save_settings.php', { method: 'POST', body: formData }) + fetch('api/save_settings.php', { + method: 'POST', + body: formData + }) .then(response => response.json()) .then(data => { if (data.success) { - document.documentElement.style.setProperty('--bg-image', 'none'); - location.reload(); + imagePreview.src = data.path + '?t=' + new Date().getTime(); + imagePreview.style.display = 'block'; + placeholderText.style.display = 'none'; + document.querySelector('.image-preview-container').classList.add('has-image'); + } else { + alert(data.error || 'Failed to upload image'); } + }) + .catch(error => { + console.error('Error:', error); + alert('An error occurred during upload.'); }); - }); - } + } + }); // Lock/Unlock Toggle lockBtn.addEventListener('click', () => { @@ -225,6 +61,9 @@ document.addEventListener('DOMContentLoaded', () => { .then(response => response.json()) .then(data => { if (data.success) { + isLocked = data.locked; + document.body.classList.toggle('state-locked', isLocked); + // Update icon (re-fetch or just refresh page is easier, but let's just refresh) location.reload(); } }); @@ -232,7 +71,7 @@ document.addEventListener('DOMContentLoaded', () => { // Reset Experience resetBtn.addEventListener('click', () => { - if (confirm('Reset experience to page 1? (Positions and sizes will be reset)')) { + if (confirm('Reset everything? This will clear the image and unlock changes.')) { const formData = new FormData(); formData.append('action', 'reset'); @@ -253,7 +92,7 @@ document.addEventListener('DOMContentLoaded', () => { const dodgeThreshold = 100; // pixels document.addEventListener('mousemove', (e) => { - if (!noBtn || (successBox && successBox.style.display === 'block') || (previewPage2Toggle && previewPage2Toggle.checked)) return; + if (successBox.style.display === 'block') return; const rect = noBtn.getBoundingClientRect(); const btnCenterX = rect.left + rect.width / 2; @@ -281,50 +120,46 @@ document.addEventListener('DOMContentLoaded', () => { }); // "No" Click Logic - if (noBtn) { - noBtn.addEventListener('click', (e) => { - e.preventDefault(); - playSound('sad'); - yesScale += 0.15; - yesBtn.style.transform = `scale(${yesScale})`; - }); - } + noBtn.addEventListener('click', (e) => { + e.preventDefault(); + yesScale += 0.15; + yesBtn.style.transform = `scale(${yesScale})`; + // We don't change font-size via style attribute directly to avoid layout jumps if possible, + // but it's what was requested ("yes button gets slightly bigger") + }); // "Yes" Click Logic - if (yesBtn) { - yesBtn.addEventListener('click', () => { - playSound('happy'); - proposalBox.style.display = 'none'; - successBox.style.display = 'block'; - - // Hide controls during celebration - document.querySelector('.admin-controls').style.display = 'none'; + yesBtn.addEventListener('click', () => { + proposalBox.style.display = 'none'; + successBox.style.display = 'block'; + + // Hide controls during celebration + document.querySelector('.admin-controls').style.display = 'none'; - // Confetti effect - const duration = 15 * 1000; - const animationEnd = Date.now() + duration; - const defaults = { startVelocity: 30, spread: 360, ticks: 60, zIndex: 0 }; + // Confetti effect + const duration = 15 * 1000; + const animationEnd = Date.now() + duration; + const defaults = { startVelocity: 30, spread: 360, ticks: 60, zIndex: 0 }; - function randomInRange(min, max) { - return Math.random() * (max - min) + min; + function randomInRange(min, max) { + return Math.random() * (max - min) + min; + } + + const interval = setInterval(function() { + const timeLeft = animationEnd - Date.now(); + + if (timeLeft <= 0) { + return clearInterval(interval); } - const interval = setInterval(function() { - const timeLeft = animationEnd - Date.now(); + const particleCount = 50 * (timeLeft / duration); + confetti(Object.assign({}, defaults, { particleCount, origin: { x: randomInRange(0.1, 0.3), y: Math.random() - 0.2 } })); + confetti(Object.assign({}, defaults, { particleCount, origin: { x: randomInRange(0.7, 0.9), y: Math.random() - 0.2 } })); + }, 250); - if (timeLeft <= 0) { - return clearInterval(interval); - } - - const particleCount = 50 * (timeLeft / duration); - confetti(Object.assign({}, defaults, { particleCount, origin: { x: randomInRange(0.1, 0.3), y: Math.random() - 0.2 } })); - confetti(Object.assign({}, defaults, { particleCount, origin: { x: randomInRange(0.7, 0.9), y: Math.random() - 0.2 } })); - }, 250); - - // Redirect after 15s - setTimeout(() => { - window.location.href = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"; - }, 15000); - }); - } + // Redirect after 15s + setTimeout(() => { + window.location.href = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"; + }, 15000); + }); }); \ No newline at end of file diff --git a/assets/pasted-20260206-164030-456a591e.jpg b/assets/pasted-20260206-164030-456a591e.jpg deleted file mode 100644 index ffa1e7b..0000000 Binary files a/assets/pasted-20260206-164030-456a591e.jpg and /dev/null differ diff --git a/db/migrations/002_add_background_settings.sql b/db/migrations/002_add_background_settings.sql deleted file mode 100644 index c13c2d8..0000000 --- a/db/migrations/002_add_background_settings.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT IGNORE INTO settings (setting_key, setting_value) VALUES ('bg_color', '#ffe4e6'), ('bg_image', ''), ('popup_color', '#ffccd5'); -UPDATE settings SET setting_value = 'assets/pasted-20260206-164030-456a591e.jpg' WHERE setting_key = 'valentine_image'; diff --git a/db/migrations/003_add_text_and_image_settings.sql b/db/migrations/003_add_text_and_image_settings.sql deleted file mode 100644 index 5bdc85b..0000000 --- a/db/migrations/003_add_text_and_image_settings.sql +++ /dev/null @@ -1,12 +0,0 @@ -INSERT INTO settings (setting_key, setting_value) VALUES -('p1_title_color', '#e63946'), -('p1_title_size', '1.75rem'), -('p1_title_font', 'Inter'), -('p2_text_color', '#e63946'), -('p2_text_size', '1.25rem'), -('p2_text_font', 'Inter'), -('p2_hint_color', '#636e72'), -('p2_hint_size', '0.85rem'), -('p2_hint_font', 'Inter'), -('image_radius', '12px') -ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value); diff --git a/db/migrations/004_add_text_content_settings.sql b/db/migrations/004_add_text_content_settings.sql deleted file mode 100644 index a4c89aa..0000000 --- a/db/migrations/004_add_text_content_settings.sql +++ /dev/null @@ -1,6 +0,0 @@ --- Add text content settings -INSERT IGNORE INTO settings (setting_key, setting_value) VALUES -('p1_title_text', 'Gvantsa, would you be my valentine?'), -('p2_line1_text', 'Congratulations, you are now Sam\'s Valentine! ❤️'), -('p2_line2_text', 'He is so incredibly lucky to have someone in his life who would click yes.'), -('p2_hint_text', 'Redirecting you to a special surprise in 15 seconds...'); diff --git a/db/migrations/005_add_button_color_settings.sql b/db/migrations/005_add_button_color_settings.sql deleted file mode 100644 index b6e9f1f..0000000 --- a/db/migrations/005_add_button_color_settings.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO settings (setting_key, setting_value) VALUES ('yes_btn_color', '#e63946') ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value); -INSERT INTO settings (setting_key, setting_value) VALUES ('no_btn_color', '#ffffff') ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value); diff --git a/index.php b/index.php index 3031c0f..48dc4ae 100644 --- a/index.php +++ b/index.php @@ -7,43 +7,17 @@ $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'; +$valentineImage = $settings['valentine_image'] ?? ''; $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'; -$yesBtnColor = $settings['yes_btn_color'] ?? '#e63946'; -$noBtnColor = $settings['no_btn_color'] ?? '#ffffff'; - -$fonts = ['Inter', 'Arial', 'Verdana', 'Times New Roman', 'Georgia', 'Courier New', 'Brush Script MT', 'Comic Sans MS']; ?>
-= htmlspecialchars($p2Line1Text) ?>
-= htmlspecialchars($p2Line2Text) ?>
-Congratulations, you are now Sam's Valentine! ❤️
+He is so incredibly lucky to have someone in his life who would click yes.
+