FILE 1: /home/custom-shopping-receipt.digitalprank.com/public_html/tool_config.json code JSON { "tool": { "identity": { "slug": "custom-shopping-receipt", "name": "Editable Shopping Receipts", "category": "prank", "tagline": "Create ultra-realistic custom shopping receipts in seconds!", "description": "Generate custom order receipts that look like they came from your favorite stores. Customize items, prices, logos, and more. Great for jokes or pranks!", "keywords": ["custom receipt", "shopping prank", "order confirmation", "receipt generator", "online purchase"] }, "features": { "bulk_enabled": false, "history_enabled": true, "export_enabled": true, "api_enabled": true }, "fields": [ { "id": "store_template", "type": "select", "label": "Select Store Template", "default": "generic", "options": [ { "value": "generic", "label": "GenericShop (Free)" }, { "value": "amazon", "label": "Amazon (Pro)" }, { "value": "ebay", "label": "eBay (Pro)" }, { "value": "walmart", "label": "Walmart (Pro)" }, { "value": "aliexpress", "label": "AliExpress (Pro)" }, { "value": "etsy", "label": "Etsy (Pro)" }, { "value": "custom", "label": "Custom Store (Pro)" } ], "pro_only": false, "help_text": "Choose which store receipt you want to mimic." }, { "id": "buyer_name", "type": "text", "label": "Buyer Name", "placeholder": "e.g., John Smith", "required": true, "validation": { "pattern": "^.{2,100}$", "min_length": 2, "max_length": 100 }, "pro_only": false }, { "id": "order_items", "type": "textarea", "label": "Items Purchased (one per line)", "placeholder": "e.g., Wireless Mouse - $19.99", "required": true, "pro_only": false, "help_text": "Enter each item with its price. e.g., USB Cable - $7.99" }, { "id": "order_date", "type": "date", "label": "Order Date", "required": false, "pro_only": false }, { "id": "currency", "type": "select", "label": "Currency", "default": "USD", "options": [ { "value": "USD", "label": "USD ($)" }, { "value": "EUR", "label": "Euro (€)" }, { "value": "GBP", "label": "GBP (£)" }, { "value": "JPY", "label": "JPY (¥)" }, { "value": "INR", "label": "INR (₹)" } ], "pro_only": true }, { "id": "custom_logo", "type": "file", "label": "Upload Custom Store Logo", "required": false, "pro_only": true, "help_text": "Upload a store logo to make your receipt more realistic (PNG/JPG only)." }, { "id": "receipt_format", "type": "select", "label": "Receipt Format", "default": "image", "options": [ { "value": "image", "label": "PNG Image" }, { "value": "pdf", "label": "PDF Document (Pro)" } ], "pro_only": false } ], "limits": { "tier_daily": { "free": 3, "basic": 25, "gold": 100, "ultimate": -1 }, "rate_limit_per_minute": 10, "max_concurrent_requests": 3 }, "billing": { "credit_cost": 1, "one_off_enabled": true, "one_off_price_cents": 75, "bill_on": "success" }, "ui": { "theme": { "primary_color": "#2b6cb0", "secondary_color": "#f7fafc" }, "layout": { "show_sidebar_ads": true, "form_style": "stacked", "result_display": "inline" } }, "dependencies": { "php_extensions": ["gd", "mbstring", "json"], "system_packages": ["imagemagick", "wkhtmltopdf"], "python_packages": ["jinja2", "reportlab", "pillow"], "external_apis": [], "requires_internet": false }, "database": { "tool_specific_table": "custom_receipt_history", "store_results": true, "enable_history": true, "retention_days": 60 }, "seo": { "meta_title": "Custom Shopping Receipt Generator | Prank Tool | DigitalPrank.com", "meta_description": "Generate custom shopping receipts from Amazon, Walmart, eBay and more. Realistic layouts, custom logos, and downloadable receipts for pranks and fun!", "canonical_url": "https://digitalprank.com/tools/custom-shopping-receipt", "structured_data": { "type": "WebApplication", "category": "Entertainment" } }, "help": { "quick_start": [ "Step 1: Select a store template.", "Step 2: Add your buyer name and order items.", "Step 3: Pick a date and currency.", "Step 4: Customize with logo or format (Pro).", "Step 5: Click Generate and download!" ], "faq": [ { "question": "Is this meant to fool real stores?", "answer": "Absolutely not. This tool is for pranks and jokes only. Never use it to impersonate real transactions or commit fraud." }, { "question": "Can I download as PDF?", "answer": "Yes, but only Pro users can export in PDF format. Free users can download PNG receipts." }, { "question": "Can I add multiple items?", "answer": "Yes! Just type each item and price on a new line." } ], "examples": [ { "title": "Simple Joke Receipt", "description": "A custom order for something ridiculous.", "input": { "buyer_name": "Kyle The Prankster", "order_items": "Unicorn Saddle - $2,499.99\nRainbow Seeds - $14.99", "store_template": "generic" } }, { "title": "Realistic eBay Receipt", "description": "Looks like a real eBay purchase.", "input": { "buyer_name": "Emma J.", "order_items": "Refurbished iPhone 12 - $349.00\nShipping - $12.00", "store_template": "ebay", "currency": "USD" } } ] }, "monitoring": { "track_usage": true, "track_performance": true, "error_reporting": true, "analytics_events": [ "receipt_generated", "template_selected", "pro_upgrade" ] }, "security": { "input_sanitization": true, "csrf_protection": true, "rate_limiting": true, "max_input_length": 500, "allowed_file_types": ["png", "jpg", "jpeg"] }, "version": { "schema": "3.0.0", "tool": "1.0.0", "api_version": "v1" } } } FILE 2: /home/custom-shopping-receipt.digitalprank.com/public_html/processor.php code PHP setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { http_response_code(500); echo json_encode(['success' => false, 'message' => 'Database connection failed.']); exit; } // --- INITIALIZATION --- $start_time = microtime(true); $user_id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : 0; $user_ip = $_SERVER['REMOTE_ADDR']; $response = [ 'success' => false, 'message' => 'An unknown error occurred.', 'data' => null, 'usage' => null, 'access' => null, 'features' => null, ]; // --- CSRF PROTECTION --- if (!isset($_POST['csrf_token']) || !hash_equals($_SESSION['csrf_token'], $_POST['csrf_token'])) { http_response_code(403); $response['message'] = 'Invalid CSRF token.'; logUsage($pdo, $tool_slug, $user_ip, $user_id, 'csrf_fail', [], json_encode($response), 0); echo json_encode($response); exit; } // --- USER AND USAGE CHECK --- $access = getUserAccessLevel($pdo, $user_id, $tool_slug); $response['access'] = $access; $limit = $config['limits']['tier_daily'][$access['tier']]; if (!checkDailyUsage($pdo, $tool_slug, $user_ip, $user_id, $limit)) { http_response_code(429); $response['message'] = 'You have exceeded your daily usage limit for this tool.'; logUsage($pdo, $tool_slug, $user_ip, $user_id, 'limit_exceeded', $_POST, json_encode($response), 0); echo json_encode($response); exit; } // --- INPUT PROCESSING AND VALIDATION --- $input = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $errors = []; // Get field overrides from the database $overrides = getToolFieldOverrides($pdo, $tool_slug); $response['features'] = $overrides; // Validate Buyer Name $buyer_name_field = $config['fields'][1]; if (empty($input['buyer_name']) || !preg_match('/' . $buyer_name_field['validation']['pattern'] . '/', $input['buyer_name'])) { $errors[] = 'Buyer Name must be between ' . $buyer_name_field['validation']['min_length'] . ' and ' . $buyer_name_field['validation']['max_length'] . ' characters.'; } // Validate Order Items if (empty($input['order_items'])) { $errors[] = 'Order items cannot be empty.'; } // Pro Feature Validations if ($access['tier'] === 'free') { if (isset($overrides['currency']) && $overrides['currency'] !== 'free' && $input['currency'] !== 'USD') { $input['currency'] = 'USD'; // Force default for free tier } if (isset($overrides['receipt_format']) && $overrides['receipt_format'] !== 'free' && $input['receipt_format'] === 'pdf') { $errors[] = 'PDF format is a Pro feature.'; } if (!empty($_FILES['custom_logo']['tmp_name']) && isset($overrides['custom_logo']) && $overrides['custom_logo'] !== 'free') { $errors[] = 'Custom logo is a Pro feature.'; } } if (!empty($errors)) { http_response_code(400); $response['message'] = implode(' ', $errors); logUsage($pdo, $tool_slug, $user_ip, $user_id, 'validation_failed', $input, json_encode($response), microtime(true) - $start_time); echo json_encode($response); exit; } // {{TOOL_PROCESSING_START}} function parse_items($items_string, $currency_symbol) { $lines = explode("\n", trim($items_string)); $items = []; $subtotal = 0.0; foreach ($lines as $line) { $line = trim($line); if (preg_match('/^(.*?)\s*-\s*' . preg_quote($currency_symbol) . '?([0-9,]+\.?[0-9]*)$/', $line, $matches)) { $name = trim($matches[1]); $price = (float)str_replace(',', '', $matches[2]); $items[] = ['name' => $name, 'price' => $price]; $subtotal += $price; } } return ['items' => $items, 'subtotal' => $subtotal]; } function get_currency_symbol($currency_code) { $symbols = ['USD' => '$', 'EUR' => '€', 'GBP' => '£', 'JPY' => '¥', 'INR' => '₹']; return $symbols[$currency_code] ?? '$'; } function generate_receipt_html($data) { $logo_src = $data['logo_path'] ? 'data:image/png;base64,' . base64_encode(file_get_contents($data['logo_path'])) : ''; $html = "Order Receipt"; $html .= ""; $html .= "
"; if ($logo_src) { $html .= ""; } $html .= "

Order Confirmation

"; $html .= "

Order ID: " . rand(100000000, 999999999) . "

"; $html .= "

Order Date: {$data['order_date']}

"; $html .= "

Billed To: " . htmlspecialchars($data['buyer_name']) . "

"; $html .= ""; foreach ($data['items'] as $item) { $html .= ""; } $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= "
ItemPrice
" . htmlspecialchars($item['name']) . "" . $data['currency_symbol'] . number_format($item['price'], 2) . "
Subtotal" . $data['currency_symbol'] . number_format($data['subtotal'], 2) . "
Tax (8%)" . $data['currency_symbol'] . number_format($data['tax'], 2) . "
Total" . $data['currency_symbol'] . number_format($data['total'], 2) . "
"; $html .= ""; $html .= "
"; return $html; } try { $currency = $access['has_pro_access'] ? $input['currency'] : 'USD'; $currency_symbol = get_currency_symbol($currency); $parsed_data = parse_items($input['order_items'], $currency_symbol); $items = $parsed_data['items']; $subtotal = $parsed_data['subtotal']; if (empty($items)) { throw new Exception("Could not parse any items. Please use the format 'Item Name - {$currency_symbol}XX.XX'."); } $tax_rate = 0.08; $tax = $subtotal * $tax_rate; $total = $subtotal + $tax; $order_date = !empty($input['order_date']) ? date("F j, Y", strtotime($input['order_date'])) : date("F j, Y"); // Handle Logo $logo_path = null; $uploads_dir = __DIR__ . '/uploads'; if (!is_dir($uploads_dir)) mkdir($uploads_dir, 0755, true); if ($access['has_pro_access'] && !empty($_FILES['custom_logo']['tmp_name'])) { $allowed_types = ['image/jpeg', 'image/png']; if (in_array($_FILES['custom_logo']['type'], $allowed_types) && $_FILES['custom_logo']['size'] < 2000000) { $logo_filename = uniqid('logo_') . '_' . basename($_FILES['custom_logo']['name']); $logo_path = $uploads_dir . '/' . $logo_filename; if (!move_uploaded_file($_FILES['custom_logo']['tmp_name'], $logo_path)) { throw new Exception('Failed to upload custom logo.'); } } else { throw new Exception('Invalid file type or size for custom logo. Use PNG/JPG under 2MB.'); } } $receipt_data = [ 'buyer_name' => $input['buyer_name'], 'order_date' => $order_date, 'items' => $items, 'subtotal' => $subtotal, 'tax' => $tax, 'total' => $total, 'currency' => $currency, 'currency_symbol' => $currency_symbol, 'logo_path' => $logo_path ]; $output_format = $input['receipt_format']; if ($output_format === 'pdf' && !$access['has_pro_access']) { $output_format = 'image'; // Downgrade to image if no pro access } $generated_dir = __DIR__ . '/generated'; if (!is_dir($generated_dir)) mkdir($generated_dir, 0755, true); $file_id = uniqid('receipt_'); $html_content = generate_receipt_html($receipt_data); $output_url = ''; if ($output_format === 'pdf') { $html_file = $generated_dir . '/' . $file_id . '.html'; $pdf_file = $generated_dir . '/' . $file_id . '.pdf'; file_put_contents($html_file, $html_content); $command = 'wkhtmltopdf ' . escapeshellarg($html_file) . ' ' . escapeshellarg($pdf_file); shell_exec($command); if (file_exists($pdf_file)) { $output_url = 'generated/' . $file_id . '.pdf'; } else { throw new Exception('Failed to generate PDF. Please ensure wkhtmltopdf is installed correctly.'); } unlink($html_file); } else { // Default to image // For simplicity and dependency management, we will generate the image via an external command with ImageMagick // This is more robust than using GD for complex layouts. $html_file = $generated_dir . '/' . $file_id . '.html'; $png_file = $generated_dir . '/' . $file_id . '.png'; file_put_contents($html_file, $html_content); // Use wkhtmltoimage which is part of wkhtmltopdf package $command = 'wkhtmltoimage --width 640 --disable-smart-width ' . escapeshellarg($html_file) . ' ' . escapeshellarg($png_file); shell_exec($command); if (file_exists($png_file)) { $output_url = 'generated/' . $file_id . '.png'; } else { throw new Exception('Failed to generate image. Please ensure wkhtmltopdf (with wkhtmltoimage) is installed correctly.'); } unlink($html_file); } $response['success'] = true; $response['message'] = 'Receipt generated successfully!'; $response['data'] = ['url' => $output_url, 'format' => $output_format]; // Store in database if enabled if ($config['database']['store_results']) { $stmt = $pdo->prepare( "INSERT INTO custom_receipt_history (user_id, store_template, buyer_name, order_items_json, total_amount, currency, file_path, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, NOW())" ); $stmt->execute([ $user_id, $input['store_template'], $input['buyer_name'], json_encode($items), $total, $currency, $output_url ]); } if ($logo_path && file_exists($logo_path)) { unlink($logo_path); // Clean up uploaded logo } } catch (Exception $e) { http_response_code(500); $response['success'] = false; $response['message'] = $e->getMessage(); } // {{TOOL_PROCESSING_END}} // --- FINALIZATION AND LOGGING --- $processing_time = microtime(true) - $start_time; logUsage($pdo, $tool_slug, $user_ip, $user_id, ($response['success'] ? 'success' : 'failed'), $input, json_encode($response), $processing_time); // Update credit usage if ($response['success']) { updateUserCredits($pdo, $user_id, $config['billing']['credit_cost']); $response['usage'] = getDailyUsage($pdo, $tool_slug, $user_ip, $user_id); } echo json_encode($response); FILE 3: /home/custom-shopping-receipt.digitalprank.com/public_html/tool_form.php code PHP <?php echo htmlspecialchars($config['identity']['name']); ?> - DigitalPrank

> >

Generating your receipt, please wait...

FILE 4: /home/custom-shopping-receipt.digitalprank.com/public_html/diagnostic.php code PHP ✔ $success_msg"; } return "
  • ✘ $error_msg
  • "; } ?> Diagnostic Report: Custom Shopping Receipt

    Diagnostic Report: Custom Shopping Receipt

    Core Configuration

    Database Connectivity

    Dependencies Check

    File System Permissions

    Tool-Specific Functionality Test

    Diagnostic complete.

    FILE 5: /home/custom-shopping-receipt.digitalprank.com/public_html/help.md code Markdown # Help & Documentation: Editable Shopping Receipts Here's everything you need to know about using the Editable Shopping Receipts generator. ## Quick Start Guide Follow these simple steps to create your prank receipt in seconds! - **Step 1:** Select a store template. - **Step 2:** Add your buyer name and order items. - **Step 3:** Pick a date and currency. - **Step 4:** Customize with logo or format (Pro). - **Step 5:** Click Generate and download! --- ## Frequently Asked Questions (FAQ) Here are answers to common questions about the tool. ### Is this meant to fool real stores? Absolutely not. This tool is for pranks and jokes only. Never use it to impersonate real transactions or commit fraud. ### Can I download as PDF? Yes, but only Pro users can export in PDF format. Free users can download PNG receipts. ### Can I add multiple items? Yes! Just type each item and price on a new line. --- ## Usage Examples Need some inspiration? Here are a couple of examples to get you started. ### Example 1: Simple Joke Receipt **Description:** A custom order for something ridiculous. **Input:** - **Buyer Name:** `Kyle The Prankster` - **Items Purchased:** Unicorn Saddle - $2,499.99 Rainbow Seeds - $14.99 code Code - **Store Template:** `GenericShop (Free)` ### Example 2: Realistic eBay Receipt **Description:** Looks like a real eBay purchase. **Input:** - **Buyer Name:** `Emma J.` - **Items Purchased:** Refurbished iPhone 12 - $349.00 Shipping - $12.00 code Code - **Store Template:** `eBay (Pro)` - **Currency:** `USD ($)` --- *For support, please contact our help desk.* FILE 6: /home/digitalprank.com/public_html/blog/data/tools/custom-shopping-receipt.json code JSON { "slug": "custom-shopping-receipt", "name": "Editable Shopping Receipts", "meta_title": "Custom Shopping Receipt Generator | Prank Tool | DigitalPrank.com", "meta_description": "Generate custom shopping receipts from Amazon, Walmart, eBay and more. Realistic layouts, custom logos, and downloadable receipts for pranks and fun!", "canonical_url": "https://digitalprank.com/tools/custom-shopping-receipt", "schema_org": { "@context": "https://schema.org", "@type": "WebApplication", "name": "Editable Shopping Receipts", "description": "Generate custom order receipts that look like they came from your favorite stores. Customize items, prices, logos, and more. Great for jokes or pranks!", "applicationCategory": "Entertainment", "operatingSystem": "Any (Web-based)", "url": "https://custom-shopping-receipt.digitalprank.com", "offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" } }, "features": [ { "name": "Multiple Store Templates", "description": "Choose from a variety of popular store templates like Amazon, eBay, and Walmart for a realistic look. Pro users get access to all templates.", "is_pro": true }, { "name": "Custom Itemization", "description": "Add any number of items to your receipt. Simply list each item and its price on a new line for automatic calculation.", "is_pro": false }, { "name": "Custom Logo Upload", "description": "For ultimate realism, Pro users can upload their own store logo to be included at the top of the receipt.", "is_pro": true }, { "name": "PDF & PNG Export", "description": "Free users can download a high-quality PNG image of their receipt. Pro users gain the ability to export as a professional PDF document.", "is_pro": true }, { "name": "Multi-Currency Support", "description": "Pro users can generate receipts in various currencies, including USD, EUR, GBP, JPY, and INR.", "is_pro": true } ], "technical_details": { "backend": "PHP 8.1+", "dependencies": "GD, ImageMagick, wkhtmltopdf", "output_formats": "PNG, PDF (Pro)" }, "user_guide": { "title": "How to Create the Perfect Prank Receipt", "steps": [ "Select your desired store from the 'Select Store Template' dropdown. For a custom look, Pro users can select 'Custom Store' and upload a logo.", "Enter the name of the 'buyer' you want to appear on the receipt.", "In the 'Items Purchased' box, list your prank items. Use the format 'Item Name - $Price'. For example, '10 Gallon Hat - $59.99'. Press Enter for each new item.", "Optionally, select a specific 'Order Date' or leave it blank to use today's date.", "Pro users can select a different 'Currency' and choose to download as a 'PDF'.", "Click 'Generate Receipt' and a link to download your file will appear." ], "best_practices": "For the best pranks, use items that are hilariously out of character for the person you're pranking. A receipt for 'Gourmet Worm Food' for your friend who hates fishing is a classic!" } } FILE 7: /home/custom-shopping-receipt.digitalprank.com/public_html/deploy.sh code Bash #!/bin/bash # Deployment Script for DigitalPrank Tool: custom-shopping-receipt # This script must be run as root. set -e echo "--- Starting deployment for custom-shopping-receipt ---" TOOL_SLUG="custom-shopping-receipt" VHOST_DIR="/usr/local/lsws/conf/vhosts" TOOL_ROOT="/home/${TOOL_SLUG}.digitalprank.com" DB_NAME="digitalprank_db" DB_USER="dp_user" DB_PASS="#$Dealer2355" PHP_VERSION="8.1" # As specified in architecture # 1. System Package Installation echo "--- Installing system packages... ---" apt-get update apt-get install -y imagemagick wkhtmltopdf # 2. PHP Extension Installation echo "--- Installing PHP extensions... ---" apt-get install -y php${PHP_VERSION}-gd php${PHP_VERSION}-mbstring php${PHP_VERSION}-json php${PHP_VERSION}-mysql # 3. Python Virtual Environment Setup echo "--- Setting up Python virtual environment... ---" VENV_DIR="/var/www/venvs/${TOOL_SLUG}" mkdir -p /var/www/venvs python3 -m venv "${VENV_DIR}" source "${VENV_DIR}/bin/activate" pip install --upgrade pip pip install jinja2 reportlab pillow deactivate chown -R www-data:www-data "${VENV_DIR}" echo "Python venv created and packages installed in ${VENV_DIR}" # 4. Directory Structure and Permissions echo "--- Setting up directories and permissions... ---" mkdir -p "${TOOL_ROOT}/public_html/generated" mkdir -p "${TOOL_ROOT}/public_html/uploads" chown -R www-data:www-data "${TOOL_ROOT}" chmod -R 755 "${TOOL_ROOT}" # Ensure generated content directories are writable by the web server chmod -R 775 "${TOOL_ROOT}/public_html/generated" chmod -R 775 "${TOOL_ROOT}/public_html/uploads" echo "Directory structure is set." # 5. Database Table Creation echo "--- Creating tool-specific database table... ---" SQL_CREATE_TABLE="CREATE TABLE IF NOT EXISTS \`custom_receipt_history\` ( \`id\` BIGINT PRIMARY KEY AUTO_INCREMENT, \`user_id\` BIGINT NOT NULL, \`store_template\` VARCHAR(50) NOT NULL, \`buyer_name\` VARCHAR(100) NOT NULL, \`order_items_json\` JSON NOT NULL, \`total_amount\` DECIMAL(10, 2) NOT NULL, \`currency\` VARCHAR(10) NOT NULL, \`file_path\` VARCHAR(255) NOT NULL, \`created_at\` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, INDEX \`user_id_idx\` (\`user_id\`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" mysql -u"${DB_USER}" -p"${DB_PASS}" "${DB_NAME}" -e "${SQL_CREATE_TABLE}" echo "Table 'custom_receipt_history' is ready." # 6. OpenLiteSpeed Virtual Host Configuration echo "--- Configuring OpenLiteSpeed virtual host... ---" VHOST_CONF_FILE="${VHOST_DIR}/${TOOL_SLUG}.conf" cat > "${VHOST_CONF_FILE}" << EOF docRoot \$SERVER_ROOT/html/${TOOL_SLUG}/public_html vhDomain ${TOOL_SLUG}.digitalprank.com vhAliases www.${TOOL_SLUG}.digitalprank.com adminEmails admin@digitalprank.com enableGzip 1 enableBr 1 errorlog \$SERVER_ROOT/logs/\$VH_NAME.error.log { useServer 0 logLevel ERROR rollingSize 10M } accesslog \$SERVER_ROOT/logs/\$VH_NAME.access.log { useServer 0 logFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" logHeaders 5 rollingSize 10M keepDays 10 } scripthandler { add lsapi:${PHP_VERSION} php } extprocessor lsapi { type lsapi address udb://var/run/php/php${PHP_VERSION}-litespeed.sock maxConns 35 env LSAPI_AVOID_FORK=200M initTimeout 60 retryTimeout 0 persistConn 1 respBuffer 0 autoStart 1 path /usr/local/lsws/lsphp${PHP_VERSION}/bin/lsphp backlog 100 instances 1 extMaxIdleTime -1 priority 0 memSoftLimit 2048M memHardLimit 2048M procSoftLimit 400 procHardLimit 500 } phpIniOverride { php_admin_value upload_max_filesize 10M php_admin_value post_max_size 10M } EOF echo "Virtual host config created at ${VHOST_CONF_FILE}" # 7. Log Rotation echo "--- Setting up log rotation... ---" LOGROTATE_CONF="/etc/logrotate.d/${TOOL_SLUG}" cat > "${LOGROTATE_CONF}" << EOF /usr/local/lsws/logs/${TOOL_SLUG}.*.log { daily missingok rotate 7 compress delaycompress notifempty create 640 root adm sharedscripts postrotate /usr/local/lsws/bin/lswsctrl restart > /dev/null endscript } EOF echo "Log rotation configured." # 8. Final Steps echo "--- Restarting services and finalizing... ---" # Ensure the main lsws conf file includes the new vhost directory if ! grep -q "include ${VHOST_DIR}/*.conf" /usr/local/lsws/conf/httpd_config.conf; then echo "include ${VHOST_DIR}/*.conf" >> /usr/local/lsws/conf/httpd_config.conf fi systemctl restart lsws echo "OpenLiteSpeed restarted." echo "--- Deployment for custom-shopping-receipt complete! ---" echo "Please verify the site at http://${TOOL_SLUG}.digitalprank.com" echo "Run the diagnostic script with ?key=digitalprank2025 to confirm setup." Model ThinkingThoughts (experimental) Auto Expand to view model thoughts chevron_right FILE 1: /home/custom-shopping-receipt.digitalprank.com/public_html/tool_config.json code JSON { "tool": { "identity": { "slug": "custom-shopping-receipt", "name": "Editable Shopping Receipts", "category": "prank", "tagline": "Create ultra-realistic custom shopping receipts in seconds!", "description": "Generate custom order receipts that look like they came from your favorite stores. Customize items, prices, logos, and more. Great for jokes or pranks!", "keywords": ["custom receipt", "shopping prank", "order confirmation", "receipt generator", "online purchase"] }, "features": { "bulk_enabled": false, "history_enabled": true, "export_enabled": true, "api_enabled": true }, "fields": [ { "id": "store_template", "type": "select", "label": "Select Store Template", "default": "generic", "options": [ { "value": "generic", "label": "GenericShop (Free)" }, { "value": "amazon", "label": "Amazon (Pro)" }, { "value": "ebay", "label": "eBay (Pro)" }, { "value": "walmart", "label": "Walmart (Pro)" }, { "value": "aliexpress", "label": "AliExpress (Pro)" }, { "value": "etsy", "label": "Etsy (Pro)" }, { "value": "custom", "label": "Custom Store (Pro)" } ], "pro_only": false, "help_text": "Choose which store receipt you want to mimic." }, { "id": "buyer_name", "type": "text", "label": "Buyer Name", "placeholder": "e.g., John Smith", "required": true, "validation": { "pattern": "^.{2,100}$", "min_length": 2, "max_length": 100 }, "pro_only": false }, { "id": "order_items", "type": "textarea", "label": "Items Purchased (one per line)", "placeholder": "e.g., Wireless Mouse - $19.99", "required": true, "pro_only": false, "help_text": "Enter each item with its price. e.g., USB Cable - $7.99" }, { "id": "order_date", "type": "date", "label": "Order Date", "required": false, "pro_only": false }, { "id": "currency", "type": "select", "label": "Currency", "default": "USD", "options": [ { "value": "USD", "label": "USD ($)" }, { "value": "EUR", "label": "Euro (€)" }, { "value": "GBP", "label": "GBP (£)" }, { "value": "JPY", "label": "JPY (¥)" }, { "value": "INR", "label": "INR (₹)" } ], "pro_only": true }, { "id": "custom_logo", "type": "file", "label": "Upload Custom Store Logo", "required": false, "pro_only": true, "help_text": "Upload a store logo to make your receipt more realistic (PNG/JPG only)." }, { "id": "receipt_format", "type": "select", "label": "Receipt Format", "default": "image", "options": [ { "value": "image", "label": "PNG Image" }, { "value": "pdf", "label": "PDF Document (Pro)" } ], "pro_only": false } ], "limits": { "tier_daily": { "free": 3, "basic": 25, "gold": 100, "ultimate": -1 }, "rate_limit_per_minute": 10, "max_concurrent_requests": 3 }, "billing": { "credit_cost": 1, "one_off_enabled": true, "one_off_price_cents": 75, "bill_on": "success" }, "ui": { "theme": { "primary_color": "#2b6cb0", "secondary_color": "#f7fafc" }, "layout": { "show_sidebar_ads": true, "form_style": "stacked", "result_display": "inline" } }, "dependencies": { "php_extensions": ["gd", "mbstring", "json"], "system_packages": ["imagemagick", "wkhtmltopdf"], "python_packages": ["jinja2", "reportlab", "pillow"], "external_apis": [], "requires_internet": false }, "database": { "tool_specific_table": "custom_receipt_history", "store_results": true, "enable_history": true, "retention_days": 60 }, "seo": { "meta_title": "Custom Shopping Receipt Generator | Prank Tool | DigitalPrank.com", "meta_description": "Generate custom shopping receipts from Amazon, Walmart, eBay and more. Realistic layouts, custom logos, and downloadable receipts for pranks and fun!", "canonical_url": "https://digitalprank.com/tools/custom-shopping-receipt", "structured_data": { "type": "WebApplication", "category": "Entertainment" } }, "help": { "quick_start": [ "Step 1: Select a store template.", "Step 2: Add your buyer name and order items.", "Step 3: Pick a date and currency.", "Step 4: Customize with logo or format (Pro).", "Step 5: Click Generate and download!" ], "faq": [ { "question": "Is this meant to fool real stores?", "answer": "Absolutely not. This tool is for pranks and jokes only. Never use it to impersonate real transactions or commit fraud." }, { "question": "Can I download as PDF?", "answer": "Yes, but only Pro users can export in PDF format. Free users can download PNG receipts." }, { "question": "Can I add multiple items?", "answer": "Yes! Just type each item and price on a new line." } ], "examples": [ { "title": "Simple Joke Receipt", "description": "A custom order for something ridiculous.", "input": { "buyer_name": "Kyle The Prankster", "order_items": "Unicorn Saddle - $2,499.99\nRainbow Seeds - $14.99", "store_template": "generic" } }, { "title": "Realistic eBay Receipt", "description": "Looks like a real eBay purchase.", "input": { "buyer_name": "Emma J.", "order_items": "Refurbished iPhone 12 - $349.00\nShipping - $12.00", "store_template": "ebay", "currency": "USD" } } ] }, "monitoring": { "track_usage": true, "track_performance": true, "error_reporting": true, "analytics_events": [ "receipt_generated", "template_selected", "pro_upgrade" ] }, "security": { "input_sanitization": true, "csrf_protection": true, "rate_limiting": true, "max_input_length": 500, "allowed_file_types": ["png", "jpg", "jpeg"] }, "version": { "schema": "3.0.0", "tool": "1.0.0", "api_version": "v1" } } } FILE 2: /home/custom-shopping-receipt.digitalprank.com/public_html/processor.php code PHP setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { http_response_code(500); echo json_encode(['success' => false, 'message' => 'Database connection failed.']); exit; } // --- INITIALIZATION --- $start_time = microtime(true); $user_id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : 0; $user_ip = $_SERVER['REMOTE_ADDR']; $response = [ 'success' => false, 'message' => 'An unknown error occurred.', 'data' => null, 'usage' => null, 'access' => null, 'features' => null, ]; // --- CSRF PROTECTION --- if (!isset($_POST['csrf_token']) || !hash_equals($_SESSION['csrf_token'], $_POST['csrf_token'])) { http_response_code(403); $response['message'] = 'Invalid CSRF token.'; logUsage($pdo, $tool_slug, $user_ip, $user_id, 'csrf_fail', [], json_encode($response), 0); echo json_encode($response); exit; } // --- USER AND USAGE CHECK --- $access = getUserAccessLevel($pdo, $user_id, $tool_slug); $response['access'] = $access; $limit = $config['limits']['tier_daily'][$access['tier']]; if (!checkDailyUsage($pdo, $tool_slug, $user_ip, $user_id, $limit)) { http_response_code(429); $response['message'] = 'You have exceeded your daily usage limit for this tool.'; logUsage($pdo, $tool_slug, $user_ip, $user_id, 'limit_exceeded', $_POST, json_encode($response), 0); echo json_encode($response); exit; } // --- INPUT PROCESSING AND VALIDATION --- $input = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $errors = []; // Get field overrides from the database $overrides = getToolFieldOverrides($pdo, $tool_slug); $response['features'] = $overrides; // Validate Buyer Name $buyer_name_field = $config['fields'][1]; if (empty($input['buyer_name']) || !preg_match('/' . $buyer_name_field['validation']['pattern'] . '/', $input['buyer_name'])) { $errors[] = 'Buyer Name must be between ' . $buyer_name_field['validation']['min_length'] . ' and ' . $buyer_name_field['validation']['max_length'] . ' characters.'; } // Validate Order Items if (empty($input['order_items'])) { $errors[] = 'Order items cannot be empty.'; } // Pro Feature Validations if ($access['tier'] === 'free') { if (isset($overrides['currency']) && $overrides['currency'] !== 'free' && $input['currency'] !== 'USD') { $input['currency'] = 'USD'; // Force default for free tier } if (isset($overrides['receipt_format']) && $overrides['receipt_format'] !== 'free' && $input['receipt_format'] === 'pdf') { $errors[] = 'PDF format is a Pro feature.'; } if (!empty($_FILES['custom_logo']['tmp_name']) && isset($overrides['custom_logo']) && $overrides['custom_logo'] !== 'free') { $errors[] = 'Custom logo is a Pro feature.'; } } if (!empty($errors)) { http_response_code(400); $response['message'] = implode(' ', $errors); logUsage($pdo, $tool_slug, $user_ip, $user_id, 'validation_failed', $input, json_encode($response), microtime(true) - $start_time); echo json_encode($response); exit; } // {{TOOL_PROCESSING_START}} function parse_items($items_string, $currency_symbol) { $lines = explode("\n", trim($items_string)); $items = []; $subtotal = 0.0; foreach ($lines as $line) { $line = trim($line); if (preg_match('/^(.*?)\s*-\s*' . preg_quote($currency_symbol) . '?([0-9,]+\.?[0-9]*)$/', $line, $matches)) { $name = trim($matches[1]); $price = (float)str_replace(',', '', $matches[2]); $items[] = ['name' => $name, 'price' => $price]; $subtotal += $price; } } return ['items' => $items, 'subtotal' => $subtotal]; } function get_currency_symbol($currency_code) { $symbols = ['USD' => '$', 'EUR' => '€', 'GBP' => '£', 'JPY' => '¥', 'INR' => '₹']; return $symbols[$currency_code] ?? '$'; } function generate_receipt_html($data) { $logo_src = $data['logo_path'] ? 'data:image/png;base64,' . base64_encode(file_get_contents($data['logo_path'])) : ''; $html = "Order Receipt"; $html .= ""; $html .= "
    "; if ($logo_src) { $html .= ""; } $html .= "

    Order Confirmation

    "; $html .= "

    Order ID: " . rand(100000000, 999999999) . "

    "; $html .= "

    Order Date: {$data['order_date']}

    "; $html .= "

    Billed To: " . htmlspecialchars($data['buyer_name']) . "

    "; $html .= ""; foreach ($data['items'] as $item) { $html .= ""; } $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= "
    ItemPrice
    " . htmlspecialchars($item['name']) . "" . $data['currency_symbol'] . number_format($item['price'], 2) . "
    Subtotal" . $data['currency_symbol'] . number_format($data['subtotal'], 2) . "
    Tax (8%)" . $data['currency_symbol'] . number_format($data['tax'], 2) . "
    Total" . $data['currency_symbol'] . number_format($data['total'], 2) . "
    "; $html .= ""; $html .= "
    "; return $html; } try { $currency = $access['has_pro_access'] ? $input['currency'] : 'USD'; $currency_symbol = get_currency_symbol($currency); $parsed_data = parse_items($input['order_items'], $currency_symbol); $items = $parsed_data['items']; $subtotal = $parsed_data['subtotal']; if (empty($items)) { throw new Exception("Could not parse any items. Please use the format 'Item Name - {$currency_symbol}XX.XX'."); } $tax_rate = 0.08; $tax = $subtotal * $tax_rate; $total = $subtotal + $tax; $order_date = !empty($input['order_date']) ? date("F j, Y", strtotime($input['order_date'])) : date("F j, Y"); // Handle Logo $logo_path = null; $uploads_dir = __DIR__ . '/uploads'; if (!is_dir($uploads_dir)) mkdir($uploads_dir, 0755, true); if ($access['has_pro_access'] && !empty($_FILES['custom_logo']['tmp_name'])) { $allowed_types = ['image/jpeg', 'image/png']; if (in_array($_FILES['custom_logo']['type'], $allowed_types) && $_FILES['custom_logo']['size'] < 2000000) { $logo_filename = uniqid('logo_') . '_' . basename($_FILES['custom_logo']['name']); $logo_path = $uploads_dir . '/' . $logo_filename; if (!move_uploaded_file($_FILES['custom_logo']['tmp_name'], $logo_path)) { throw new Exception('Failed to upload custom logo.'); } } else { throw new Exception('Invalid file type or size for custom logo. Use PNG/JPG under 2MB.'); } } $receipt_data = [ 'buyer_name' => $input['buyer_name'], 'order_date' => $order_date, 'items' => $items, 'subtotal' => $subtotal, 'tax' => $tax, 'total' => $total, 'currency' => $currency, 'currency_symbol' => $currency_symbol, 'logo_path' => $logo_path ]; $output_format = $input['receipt_format']; if ($output_format === 'pdf' && !$access['has_pro_access']) { $output_format = 'image'; // Downgrade to image if no pro access } $generated_dir = __DIR__ . '/generated'; if (!is_dir($generated_dir)) mkdir($generated_dir, 0755, true); $file_id = uniqid('receipt_'); $html_content = generate_receipt_html($receipt_data); $output_url = ''; if ($output_format === 'pdf') { $html_file = $generated_dir . '/' . $file_id . '.html'; $pdf_file = $generated_dir . '/' . $file_id . '.pdf'; file_put_contents($html_file, $html_content); $command = 'wkhtmltopdf ' . escapeshellarg($html_file) . ' ' . escapeshellarg($pdf_file); shell_exec($command); if (file_exists($pdf_file)) { $output_url = 'generated/' . $file_id . '.pdf'; } else { throw new Exception('Failed to generate PDF. Please ensure wkhtmltopdf is installed correctly.'); } unlink($html_file); } else { // Default to image // For simplicity and dependency management, we will generate the image via an external command with ImageMagick // This is more robust than using GD for complex layouts. $html_file = $generated_dir . '/' . $file_id . '.html'; $png_file = $generated_dir . '/' . $file_id . '.png'; file_put_contents($html_file, $html_content); // Use wkhtmltoimage which is part of wkhtmltopdf package $command = 'wkhtmltoimage --width 640 --disable-smart-width ' . escapeshellarg($html_file) . ' ' . escapeshellarg($png_file); shell_exec($command); if (file_exists($png_file)) { $output_url = 'generated/' . $file_id . '.png'; } else { throw new Exception('Failed to generate image. Please ensure wkhtmltopdf (with wkhtmltoimage) is installed correctly.'); } unlink($html_file); } $response['success'] = true; $response['message'] = 'Receipt generated successfully!'; $response['data'] = ['url' => $output_url, 'format' => $output_format]; // Store in database if enabled if ($config['database']['store_results']) { $stmt = $pdo->prepare( "INSERT INTO custom_receipt_history (user_id, store_template, buyer_name, order_items_json, total_amount, currency, file_path, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, NOW())" ); $stmt->execute([ $user_id, $input['store_template'], $input['buyer_name'], json_encode($items), $total, $currency, $output_url ]); } if ($logo_path && file_exists($logo_path)) { unlink($logo_path); // Clean up uploaded logo } } catch (Exception $e) { http_response_code(500); $response['success'] = false; $response['message'] = $e->getMessage(); } // {{TOOL_PROCESSING_END}} // --- FINALIZATION AND LOGGING --- $processing_time = microtime(true) - $start_time; logUsage($pdo, $tool_slug, $user_ip, $user_id, ($response['success'] ? 'success' : 'failed'), $input, json_encode($response), $processing_time); // Update credit usage if ($response['success']) { updateUserCredits($pdo, $user_id, $config['billing']['credit_cost']); $response['usage'] = getDailyUsage($pdo, $tool_slug, $user_ip, $user_id); } echo json_encode($response); FILE 3: /home/custom-shopping-receipt.digitalprank.com/public_html/tool_form.php code PHP <?php echo htmlspecialchars($config['identity']['name']); ?> - DigitalPrank

    > >

    Generating your receipt, please wait...

    FILE 4: /home/custom-shopping-receipt.digitalprank.com/public_html/diagnostic.php code PHP ✔ $success_msg"; } return "
  • ✘ $error_msg
  • "; } ?> Diagnostic Report: Custom Shopping Receipt

    Diagnostic Report: Custom Shopping Receipt

    Core Configuration

    Database Connectivity

    Dependencies Check

    File System Permissions

    Tool-Specific Functionality Test

    Diagnostic complete.

    FILE 5: /home/custom-shopping-receipt.digitalprank.com/public_html/help.md code Markdown # Help & Documentation: Editable Shopping Receipts Here's everything you need to know about using the Editable Shopping Receipts generator. ## Quick Start Guide Follow these simple steps to create your prank receipt in seconds! - **Step 1:** Select a store template. - **Step 2:** Add your buyer name and order items. - **Step 3:** Pick a date and currency. - **Step 4:** Customize with logo or format (Pro). - **Step 5:** Click Generate and download! --- ## Frequently Asked Questions (FAQ) Here are answers to common questions about the tool. ### Is this meant to fool real stores? Absolutely not. This tool is for pranks and jokes only. Never use it to impersonate real transactions or commit fraud. ### Can I download as PDF? Yes, but only Pro users can export in PDF format. Free users can download PNG receipts. ### Can I add multiple items? Yes! Just type each item and price on a new line. --- ## Usage Examples Need some inspiration? Here are a couple of examples to get you started. ### Example 1: Simple Joke Receipt **Description:** A custom order for something ridiculous. **Input:** - **Buyer Name:** `Kyle The Prankster` - **Items Purchased:** Unicorn Saddle - $2,499.99 Rainbow Seeds - $14.99 code Code - **Store Template:** `GenericShop (Free)` ### Example 2: Realistic eBay Receipt **Description:** Looks like a real eBay purchase. **Input:** - **Buyer Name:** `Emma J.` - **Items Purchased:** Refurbished iPhone 12 - $349.00 Shipping - $12.00 code Code - **Store Template:** `eBay (Pro)` - **Currency:** `USD ($)` --- *For support, please contact our help desk.* FILE 6: /home/digitalprank.com/public_html/blog/data/tools/custom-shopping-receipt.json code JSON { "slug": "custom-shopping-receipt", "name": "Editable Shopping Receipts", "meta_title": "Custom Shopping Receipt Generator | Prank Tool | DigitalPrank.com", "meta_description": "Generate custom shopping receipts from Amazon, Walmart, eBay and more. Realistic layouts, custom logos, and downloadable receipts for pranks and fun!", "canonical_url": "https://digitalprank.com/tools/custom-shopping-receipt", "schema_org": { "@context": "https://schema.org", "@type": "WebApplication", "name": "Editable Shopping Receipts", "description": "Generate custom order receipts that look like they came from your favorite stores. Customize items, prices, logos, and more. Great for jokes or pranks!", "applicationCategory": "Entertainment", "operatingSystem": "Any (Web-based)", "url": "https://custom-shopping-receipt.digitalprank.com", "offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" } }, "features": [ { "name": "Multiple Store Templates", "description": "Choose from a variety of popular store templates like Amazon, eBay, and Walmart for a realistic look. Pro users get access to all templates.", "is_pro": true }, { "name": "Custom Itemization", "description": "Add any number of items to your receipt. Simply list each item and its price on a new line for automatic calculation.", "is_pro": false }, { "name": "Custom Logo Upload", "description": "For ultimate realism, Pro users can upload their own store logo to be included at the top of the receipt.", "is_pro": true }, { "name": "PDF & PNG Export", "description": "Free users can download a high-quality PNG image of their receipt. Pro users gain the ability to export as a professional PDF document.", "is_pro": true }, { "name": "Multi-Currency Support", "description": "Pro users can generate receipts in various currencies, including USD, EUR, GBP, JPY, and INR.", "is_pro": true } ], "technical_details": { "backend": "PHP 8.1+", "dependencies": "GD, ImageMagick, wkhtmltopdf", "output_formats": "PNG, PDF (Pro)" }, "user_guide": { "title": "How to Create the Perfect Prank Receipt", "steps": [ "Select your desired store from the 'Select Store Template' dropdown. For a custom look, Pro users can select 'Custom Store' and upload a logo.", "Enter the name of the 'buyer' you want to appear on the receipt.", "In the 'Items Purchased' box, list your prank items. Use the format 'Item Name - $Price'. For example, '10 Gallon Hat - $59.99'. Press Enter for each new item.", "Optionally, select a specific 'Order Date' or leave it blank to use today's date.", "Pro users can select a different 'Currency' and choose to download as a 'PDF'.", "Click 'Generate Receipt' and a link to download your file will appear." ], "best_practices": "For the best pranks, use items that are hilariously out of character for the person you're pranking. A receipt for 'Gourmet Worm Food' for your friend who hates fishing is a classic!" } } FILE 7: /home/custom-shopping-receipt.digitalprank.com/public_html/deploy.sh code Bash #!/bin/bash # Deployment Script for DigitalPrank Tool: custom-shopping-receipt # This script must be run as root. set -e echo "--- Starting deployment for custom-shopping-receipt ---" TOOL_SLUG="custom-shopping-receipt" VHOST_DIR="/usr/local/lsws/conf/vhosts" TOOL_ROOT="/home/${TOOL_SLUG}.digitalprank.com" DB_NAME="digitalprank_db" DB_USER="dp_user" DB_PASS="#$Dealer2355" PHP_VERSION="8.1" # As specified in architecture # 1. System Package Installation echo "--- Installing system packages... ---" apt-get update apt-get install -y imagemagick wkhtmltopdf # 2. PHP Extension Installation echo "--- Installing PHP extensions... ---" apt-get install -y php${PHP_VERSION}-gd php${PHP_VERSION}-mbstring php${PHP_VERSION}-json php${PHP_VERSION}-mysql # 3. Python Virtual Environment Setup echo "--- Setting up Python virtual environment... ---" VENV_DIR="/var/www/venvs/${TOOL_SLUG}" mkdir -p /var/www/venvs python3 -m venv "${VENV_DIR}" source "${VENV_DIR}/bin/activate" pip install --upgrade pip pip install jinja2 reportlab pillow deactivate chown -R www-data:www-data "${VENV_DIR}" echo "Python venv created and packages installed in ${VENV_DIR}" # 4. Directory Structure and Permissions echo "--- Setting up directories and permissions... ---" mkdir -p "${TOOL_ROOT}/public_html/generated" mkdir -p "${TOOL_ROOT}/public_html/uploads" chown -R www-data:www-data "${TOOL_ROOT}" chmod -R 755 "${TOOL_ROOT}" # Ensure generated content directories are writable by the web server chmod -R 775 "${TOOL_ROOT}/public_html/generated" chmod -R 775 "${TOOL_ROOT}/public_html/uploads" echo "Directory structure is set." # 5. Database Table Creation echo "--- Creating tool-specific database table... ---" SQL_CREATE_TABLE="CREATE TABLE IF NOT EXISTS \`custom_receipt_history\` ( \`id\` BIGINT PRIMARY KEY AUTO_INCREMENT, \`user_id\` BIGINT NOT NULL, \`store_template\` VARCHAR(50) NOT NULL, \`buyer_name\` VARCHAR(100) NOT NULL, \`order_items_json\` JSON NOT NULL, \`total_amount\` DECIMAL(10, 2) NOT NULL, \`currency\` VARCHAR(10) NOT NULL, \`file_path\` VARCHAR(255) NOT NULL, \`created_at\` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, INDEX \`user_id_idx\` (\`user_id\`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" mysql -u"${DB_USER}" -p"${DB_PASS}" "${DB_NAME}" -e "${SQL_CREATE_TABLE}" echo "Table 'custom_receipt_history' is ready." # 6. OpenLiteSpeed Virtual Host Configuration echo "--- Configuring OpenLiteSpeed virtual host... ---" VHOST_CONF_FILE="${VHOST_DIR}/${TOOL_SLUG}.conf" cat > "${VHOST_CONF_FILE}" << EOF docRoot \$SERVER_ROOT/html/${TOOL_SLUG}/public_html vhDomain ${TOOL_SLUG}.digitalprank.com vhAliases www.${TOOL_SLUG}.digitalprank.com adminEmails admin@digitalprank.com enableGzip 1 enableBr 1 errorlog \$SERVER_ROOT/logs/\$VH_NAME.error.log { useServer 0 logLevel ERROR rollingSize 10M } accesslog \$SERVER_ROOT/logs/\$VH_NAME.access.log { useServer 0 logFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" logHeaders 5 rollingSize 10M keepDays 10 } scripthandler { add lsapi:${PHP_VERSION} php } extprocessor lsapi { type lsapi address udb://var/run/php/php${PHP_VERSION}-litespeed.sock maxConns 35 env LSAPI_AVOID_FORK=200M initTimeout 60 retryTimeout 0 persistConn 1 respBuffer 0 autoStart 1 path /usr/local/lsws/lsphp${PHP_VERSION}/bin/lsphp backlog 100 instances 1 extMaxIdleTime -1 priority 0 memSoftLimit 2048M memHardLimit 2048M procSoftLimit 400 procHardLimit 500 } phpIniOverride { php_admin_value upload_max_filesize 10M php_admin_value post_max_size 10M } EOF echo "Virtual host config created at ${VHOST_CONF_FILE}" # 7. Log Rotation echo "--- Setting up log rotation... ---" LOGROTATE_CONF="/etc/logrotate.d/${TOOL_SLUG}" cat > "${LOGROTATE_CONF}" << EOF /usr/local/lsws/logs/${TOOL_SLUG}.*.log { daily missingok rotate 7 compress delaycompress notifempty create 640 root adm sharedscripts postrotate /usr/local/lsws/bin/lswsctrl restart > /dev/null endscript } EOF echo "Log rotation configured." # 8. Final Steps echo "--- Restarting services and finalizing... ---" # Ensure the main lsws conf file includes the new vhost directory if ! grep -q "include ${VHOST_DIR}/*.conf" /usr/local/lsws/conf/httpd_config.conf; then echo "include ${VHOST_DIR}/*.conf" >> /usr/local/lsws/conf/httpd_config.conf fi systemctl restart lsws echo "OpenLiteSpeed restarted." echo "--- Deployment for custom-shopping-receipt complete! ---" echo "Please verify the site at http://${TOOL_SLUG}.digitalprank.com" echo "Run the diagnostic script with ?key=digitalprank2025 to confirm setup."