# Landing Page Generator - Project Overview ## Project Goal Create a **fully automated Landing Page Generator**. The entrepreneur fills a 5-step wizard with business information. The system then automatically: - Generates a complete, professional landing page - Stores leads in a MySQL database - Sends the lead a confirmation email with the attached Lead Magnet PDF - Allows each owner to view only their own leads via a login dashboard ## Tech Stack Used Backend,"PHP 8+ (pure PHP, no framework)","All logic (wizard, generation, AJAX, OpenAI calls)" Database,MySQL,Stores all leads (leads table) Frontend,HTML5 + Tailwind CSS (via CDN) + Vanilla JavaScript,"Modern, responsive design with no build step" Templating,Simple string replacement (str_replace),On index-template.html (not Twig) AI / LLM,OpenAI API (gpt-4o-mini),Content generation + color extraction + prompt chaining Hosting,Namecheap Shared Hosting + cPanel,Standard PHP/MySQL environment File System,Dynamic folder creation (mkdir),Each landing page gets its own folder under /lp/ Email,PHP mail() with multipart MIME,Sends confirmation email + PDF attachment Session,PHP $_SESSION,Maintains wizard data across steps The code will be hosted on Namecheap Shared Hosting. ## Folder Structure public_html/ ├── generator.php # Main 5-step wizard ├── config.php # Database + OpenAI configuration ├── process.php # Handles form submission, DB insert, email with PDF ├── templates/ │ └── index-template.html # Master template used to generate each landing page ├── lp/ # Folder where all generated landing pages are created │ └── (auto-created subfolders like "metaxyz-20260515-1432/") └── (optional) lead-magnets/ # Can be used to store PDFs if needed ## Current Features - 5-step wizard with progress bar - "Generate Suggestion" buttons using OpenAI (gpt-4o-mini) with prompt chaining - "Extract Colors" button that analyzes a reference website URL - Custom domain support (A record + CNAME instructions shown on success) - Automatic folder creation and deployment of each landing page - Lead storage + email with PDF attachment ## Database Schema (SQL) CREATE TABLE IF NOT EXISTS leads ( id INT AUTO_INCREMENT PRIMARY KEY, timestamp DATETIME DEFAULT CURRENT_TIMESTAMP, campaign VARCHAR(100) NOT NULL, name VARCHAR(255), email VARCHAR(255), interest TEXT, INDEX idx_campaign (campaign) ); ## Current Problems (as reported by user) - The wizard sometimes shows blank steps after Step 1 - "Generate Suggestion" and "Extract Colors" sometimes return HTML code instead of clean text - Some steps appear empty ## Task for Claude Please analyze the current system and provide an improved, clean, robust version of the Landing Page Generator. Focus on: - Making the wizard reliable (all steps must show their input fields correctly) - Ensuring AJAX calls for "Generate Suggestion" and "Extract Colors" always return clean text/JSON - Improving overall code structure, error handling, and maintainability - Adding any small improvements you consider valuable (security, UX, performance, etc.) The original`generator.php`, `config.php`, `process.php`, `templates/index-template.html`files are now in the folder c:/XAMPP/htdocs/generator