(24 * 60 * 60)) { session_destroy(); header('Location: auth.php'); exit; } // Get page ID from URL $page_id = $_GET['id'] ?? null; $format = $_GET['format'] ?? 'view'; $mode = $_GET['mode'] ?? 'preview'; // preview or edit if (!$page_id) { die('Page ID is required.'); } // Handle save request if ($_SERVER['REQUEST_METHOD'] === 'POST' && $format === 'save') { $updated_content = json_decode(file_get_contents('php://input'), true); if ($updated_content) { $_SESSION['generated_pages'][$page_id]['generated_content'] = array_merge( $_SESSION['generated_pages'][$page_id]['generated_content'], $updated_content['content'] ?? [] ); if (isset($updated_content['settings'])) { $_SESSION['generated_pages'][$page_id]['settings'] = $updated_content['settings']; } header('Content-Type: application/json'); echo json_encode(['success' => true]); exit; } } // Get stored content $complete_data = $_SESSION['generated_pages'][$page_id] ?? null; if (!$complete_data) { die('Landing page not found. Please generate a new landing page.'); } $form_data = $complete_data['form_data']; $content = $complete_data['generated_content']; $settings = $complete_data['settings'] ?? []; // Handle different format requests if ($format === 'download') { // Generate standalone HTML file for download $html_content = generatePremiumLandingPage($content, $form_data, $settings, true, false); // Set headers for file download $filename = 'landing-page-' . date('Y-m-d-H-i-s') . '.html'; header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $filename . '"'); header('Content-Length: ' . strlen($html_content)); echo $html_content; exit; } if ($format === 'raw') { // Return raw HTML for copying header('Content-Type: text/plain'); echo generatePremiumLandingPage($content, $form_data, $settings, true, false); exit; } // Generate the premium landing page HTML function generatePremiumLandingPage($content, $form_data, $settings, $standalone = false, $editMode = false) { $tracking_code = $form_data['tracking_code'] ?? ''; $affiliate_link = $form_data['affiliate_link'] ?? '#'; // Default settings $primaryColor = $settings['primaryColor'] ?? '#667eea'; $secondaryColor = $settings['secondaryColor'] ?? '#764ba2'; $ctaColor = $settings['ctaColor'] ?? '#4facfe'; $fontFamily = $settings['fontFamily'] ?? 'Inter'; // Ensure content has values with enhanced defaults $headline = $content['headline'] ?? 'Transform Your Digital Presence Today'; $subheadline = $content['subheadline'] ?? 'Join thousands who have revolutionized their success'; $hero_content = $content['hero_content'] ?? 'Discover the game-changing platform that industry leaders use to accelerate their growth and achieve unprecedented results.'; $problem_agitation = $content['problem_agitation'] ?? 'Struggling with outdated methods that drain your time and energy? You\'re not alone in feeling overwhelmed by ineffective solutions.'; $solution_intro = $content['solution_intro'] ?? 'Our revolutionary approach eliminates the guesswork and delivers results that speak for themselves.'; $benefits_list = $content['benefits_list'] ?? "• Accelerate your growth with proven strategies\n• Access exclusive tools and resources\n• Get results in record time\n• Join a community of achievers\n• Risk-free guarantee included"; $social_proof = $content['social_proof'] ?? 'Join over 50,000 successful professionals who have transformed their results.'; $urgency_section = $content['urgency_section'] ?? 'Limited spots available. Secure your access today before this opportunity closes.'; $risk_reversal = $content['risk_reversal'] ?? 'Try risk-free with our 60-day money-back guarantee. Your success is our commitment.'; $final_cta = $content['final_cta'] ?? 'Start Today'; $editClass = $editMode ? 'edit-mode' : ''; $editAttr = $editMode ? 'contenteditable="true"' : ''; $html = ' ' . htmlspecialchars($headline) . ' '; if ($editMode) { $html .= ' '; } $html .= ' ' . $tracking_code . '
Changes saved successfully!
'; // Add admin bar only for preview mode if (!$standalone) { $isEditMode = $mode === 'edit'; $html .= '

🔧 Landing Page ' . ($isEditMode ? 'Editor' : 'Preview') . '

Generated: ' . date('M j, Y g:i A') . '
'; if ($isEditMode) { $html .= ' Preview Mode '; } else { $html .= ' Edit Mode '; } $html .= ' Download HTML View Code Back
'; } // Add editor toolbar if in edit mode if ($editMode && !$standalone) { $html .= '
Page Editor
Color Scheme
Typography
Quick Actions
Edit Tips

• Click any text to edit it directly
• Hover over elements to see edit hints
• Changes are saved automatically
• Use Ctrl+B for bold, Ctrl+I for italic

'; } $html .= '

Wait! Don\'t Leave Yet!

Get an exclusive 25% discount if you act now!

This offer expires when you leave this page
Claim Your Discount
127 people viewing this page now

' . htmlspecialchars($headline) . '

' . htmlspecialchars($subheadline) . '

SSL Secured Money Back Guarantee 24/7 Support
0
Active Users
0
Success Rate
24/7
Support

The Opportunity You\'ve Been Waiting For

' . nl2br(htmlspecialchars($hero_content)) . '

Why Choose Us?

Experience the difference that sets us apart

Lightning Fast Results

See immediate improvements from day one with our proven system.

Lifetime Access

Get unlimited access to all features and future updates forever.

Premium Support

Our expert team is available 24/7 to ensure your success.

Sound Familiar?

You\'re not alone in facing these challenges

' . nl2br(htmlspecialchars($problem_agitation)) . '

The Solution Is Here

Everything changes when you have the right system

' . nl2br(htmlspecialchars($solution_intro)) . '

What You\'ll Achieve

Transform your results with these powerful benefits

    '; // Process benefits with enhanced descriptions $benefits = explode("\n", $benefits_list); $benefit_icons = ['fa-rocket', 'fa-trophy', 'fa-star', 'fa-chart-line', 'fa-shield-alt', 'fa-users', 'fa-clock', 'fa-gem']; $benefit_descriptions = [ 'Start seeing results immediately with our proven framework', 'Join the ranks of successful achievers in your field', 'Stand out from the competition with unique advantages', 'Track and measure your exponential growth', 'Protected by our comprehensive guarantee', 'Connect with like-minded individuals on the same journey', 'Save countless hours with our streamlined approach', 'Access premium features that deliver exceptional value' ]; $icon_index = 0; foreach ($benefits as $benefit) { $benefit = trim($benefit); if (!empty($benefit)) { $benefit = ltrim($benefit, '•-* '); if (!empty($benefit)) { $icon = $benefit_icons[$icon_index % count($benefit_icons)]; $description = $benefit_descriptions[$icon_index % count($benefit_descriptions)]; $html .= '
  • ' . htmlspecialchars($benefit) . '

    ' . $description . '

  • '; $icon_index++; } } } $html .= '

Success Stories

Join thousands who have transformed their lives

"This completely transformed my approach. The results were beyond what I ever imagined possible."
SM
Sarah Miller

Digital Entrepreneur

"I was skeptical at first, but the results speak for themselves. This is the real deal."
MJ
Michael Johnson

Business Owner

"Best investment I\'ve made this year. The support and results exceeded all expectations."
JL
Jennifer Liu

Success Story

Limited Time Opportunity

23
Hours
59
Minutes
45
Seconds

' . nl2br(htmlspecialchars($urgency_section)) . '

Only 7 spots remaining at this price
' . htmlspecialchars($final_cta) . '

100% Risk-Free Guarantee

' . nl2br(htmlspecialchars($risk_reversal)) . '

Money Back
Instant Access
24/7 Support

Ready to Transform Your Success?

Join thousands of people who have already discovered this life-changing opportunity.

' . htmlspecialchars($final_cta) . '

🔒 Secure checkout • ✅ Instant access • 💰 Money-back guarantee


SSL Secured

Protected

Trusted

Proven
'; if (!$standalone) { $html .= '
'; } $html .= ' '; if ($editMode) { $html .= ' '; } $html .= ' '; return $html; } // Default: Show the landing page with admin controls $editMode = $mode === 'edit'; echo generatePremiumLandingPage($content, $form_data, $settings, false, $editMode); ?>