HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //proc/self/root/home/ezdns-hostbill-setup-v2.php
<?php
/**
 * ezDNS.support HostBill Database Setup Script V2
 * 
 * Dieses Skript konfiguriert ezdns.support direkt über die HostBill-Datenbank
 * Berücksichtigt die echte HostBill-Tabellenstruktur
 */

echo "=== ezDNS.support HostBill Database Setup V2 ===\n";
echo "Verbindung zur Datenbank wird hergestellt...\n";

try {
    // Datenbankverbindung herstellen
    $pdo = new PDO(
        "mysql:host=localhost;dbname=suppo_db;port=3306",
        'suppo_db',
        'Mat36k4WS84Su9Fw61',
        [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]
    );
    
    echo "✅ Datenbankverbindung erfolgreich!\n";
    
    // Klasse für Datenbank-Operationen
    class EzDNSDatabaseSetup {
        private $pdo;
        private $brandId = 26; // ezdns.support Brand ID
        
        public function __construct($pdo) {
            $this->pdo = $pdo;
        }
        
        /**
         * Brand erstellen oder aktualisieren
         * Tabelle: hb_brands (Fields: brand_id, name, url, active, custom)
         */
        public function setupBrand() {
            echo "\n=== Schritt 1: Brand-Konfiguration ===\n";
            
            // Prüfen ob Brand bereits existiert
            $stmt = $this->pdo->prepare("SELECT brand_id FROM hb_brands WHERE name = ?");
            $stmt->execute(['ezdns.support']);
            $existing = $stmt->fetch(PDO::FETCH_ASSOC);
            
            if ($existing) {
                echo "Brand 'ezdns.support' bereits vorhanden (ID: {$existing['brand_id']}) - aktualisiere...\n";
                $this->brandId = $existing['brand_id'];
                
                // Brand aktualisieren
                $sql = "UPDATE hb_brands SET 
                    url = ?,
                    active = 1,
                    custom = ?
                    WHERE brand_id = ?";
                
                $stmt = $this->pdo->prepare($sql);
                $stmt->execute([
                    'https://ezdns.support',
                    json_encode([
                        'theme' => 'default',
                        'language' => 'de',
                        'currency' => 'EUR',
                        'timezone' => 'Europe/Berlin',
                        'date_format' => 'dd.mm.YYYY'
                    ]),
                    $this->brandId
                ]);
                
                echo "✅ Brand aktualisiert!\n";
                return $this->brandId;
            } else {
                echo "Erstelle neues Brand...\n";
                
                // Neues Brand erstellen
                $sql = "INSERT INTO hb_brands (
                    name, url, active, custom
                ) VALUES (?, ?, 1, ?)";
                
                $stmt = $this->pdo->prepare($sql);
                $stmt->execute([
                    'ezdns.support',
                    'https://ezdns.support',
                    json_encode([
                        'theme' => 'default',
                        'language' => 'de',
                        'currency' => 'EUR',
                        'timezone' => 'Europe/Berlin',
                        'date_format' => 'dd.mm.YYYY'
                    ])
                ]);
                
                $this->brandId = $this->pdo->lastInsertId();
                echo "✅ Brand erstellt mit ID: {$this->brandId}\n";
                return $this->brandId;
            }
        }
        
        /**
         * DNS Services Kategorie erstellen
         * Tabelle: hb_categories
         */
        public function setupDNSCategory() {
            echo "\n=== Schritt 2: DNS Services Kategorie ===\n";
            
            // Prüfen ob Kategorie bereits existiert
            $stmt = $this->pdo->prepare("SELECT id FROM hb_categories WHERE name = ? AND contains = 'categories'");
            $stmt->execute(['DNS Services']);
            $existing = $stmt->fetch(PDO::FETCH_ASSOC);
            
            if ($existing) {
                echo "Kategorie 'DNS Services' bereits vorhanden (ID: {$existing['id']})\n";
                return $existing['id'];
            }
            
            // Kategorie erstellen
            $sql = "INSERT INTO hb_categories (
                parent_id, contains, module, name, description, visible, sort_order, ctype
            ) VALUES (0, 'categories', 0, ?, ?, 1, 1, 'services')";
            
            $stmt = $this->pdo->prepare($sql);
            $stmt->execute([
                'DNS Services',
                'DNS-Prüfungen und Monitoring-Services'
            ]);
            
            $catId = $this->pdo->lastInsertId();
            echo "✅ DNS Services Kategorie erstellt (ID: {$catId})\n";
            return $catId;
        }
        
        /**
         * Produkte erstellen
         * Tabelle: hb_products
         */
        public function setupProducts($catId) {
            echo "\n=== Schritt 3: Produkte ===\n";
            
            $products = [
                [
                    'name' => 'DNS Check Free',
                    'code' => 'dns-free',
                    'type' => 2, // Hosting type
                    'category_id' => $catId,
                    'description' => 'Grundlegender DNS-Check für eine Domain mit basis Analytik. Beinhaltet: 1x Scan pro Monat, Delegation Check, DNSSEC Check. Keine Export-Funktion.',
                    'metadata' => json_encode([
                        'scans_per_month' => 1,
                        'delegation_check' => true,
                        'dnssec_check' => true,
                        'mail_security_check' => false,
                        'performance_check' => false,
                        'pdf_export' => false,
                        'csv_export' => false,
                        'email_notifications' => false,
                        'historical_data' => false,
                        'api_access' => false
                    ]),
                    'visible' => 1,
                    'sort_order' => 1,
                    'brand_id' => $this->brandId
                ],
                [
                    'name' => 'DNS Check Pro',
                    'code' => 'dns-pro',
                    'type' => 2, // Hosting type
                    'category_id' => $catId,
                    'description' => 'Umfassender DNS-Check mit Reports und Benachrichtigungen. Beinhaltet: Unbegrenzte Scans, alle DNS-Checks, Performance-Analyse, PDF/CSV-Export, E-Mail-Benachrichtigungen, Historische Daten, API-Zugang.',
                    'metadata' => json_encode([
                        'scans_per_month' => -1, // Unlimited
                        'delegation_check' => true,
                        'dnssec_check' => true,
                        'mail_security_check' => true,
                        'performance_check' => true,
                        'pdf_export' => true,
                        'csv_export' => true,
                        'email_notifications' => true,
                        'historical_data' => true,
                        'api_access' => true
                    ]),
                    'visible' => 1,
                    'sort_order' => 2,
                    'brand_id' => $this->brandId
                ],
                [
                    'name' => 'DNS Check Business',
                    'code' => 'dns-business',
                    'type' => 2, // Hosting type
                    'category_id' => $catId,
                    'description' => 'Multi-Domain DNS-Monitoring mit erweiterten Features. Beinhaltet: Bis zu 10 Domains, alle Pro-Features, White-Label Reports, Priority-Support, Team-Zugang (5 User), Webhook-Benachrichtigungen, Erweiterte API-Limits.',
                    'metadata' => json_encode([
                        'scans_per_month' => -1,
                        'max_domains' => 10,
                        'delegation_check' => true,
                        'dnssec_check' => true,
                        'mail_security_check' => true,
                        'performance_check' => true,
                        'pdf_export' => true,
                        'csv_export' => true,
                        'email_notifications' => true,
                        'historical_data' => true,
                        'api_access' => true,
                        'white_label_reports' => true,
                        'priority_support' => true,
                        'team_users' => 5,
                        'webhook_notifications' => true,
                        'extended_api_limits' => true
                    ]),
                    'visible' => 1,
                    'sort_order' => 3,
                    'brand_id' => $this->brandId
                ],
                [
                    'name' => 'DNS Check Agency',
                    'code' => 'dns-agency',
                    'type' => 2, // Hosting type
                    'category_id' => $catId,
                    'description' => 'Reseller-Programm für DNS-Services mit vollem Support. Beinhaltet: Unbegrenzte Domains, alle Business-Features, Reseller-Preise, Custom-Branding, API-High-Limits, Dedicated Account Manager, 24/7 Support, Affiliate-Programm-Zugang.',
                    'metadata' => json_encode([
                        'scans_per_month' => -1,
                        'max_domains' => -1, // Unlimited
                        'delegation_check' => true,
                        'dnssec_check' => true,
                        'mail_security_check' => true,
                        'performance_check' => true,
                        'pdf_export' => true,
                        'csv_export' => true,
                        'email_notifications' => true,
                        'historical_data' => true,
                        'api_access' => true,
                        'white_label_reports' => true,
                        'priority_support' => true,
                        'team_users' => -1, // Unlimited
                        'webhook_notifications' => true,
                        'extended_api_limits' => true,
                        'custom_branding' => true,
                        'reseller_pricing' => true,
                        'dedicated_account_manager' => true,
                        'support_24_7' => true,
                        'affiliate_access' => true
                    ]),
                    'visible' => 1,
                    'sort_order' => 4,
                    'brand_id' => $this->brandId
                ]
            ];
            
            foreach ($products as $product) {
                // Prüfen ob Produkt bereits existiert
                $stmt = $this->pdo->prepare("SELECT id FROM hb_products WHERE code = ? AND brand_id = ?");
                $stmt->execute([$product['code'], $this->brandId]);
                $existing = $stmt->fetch(PDO::FETCH_ASSOC);
                
                if ($existing) {
                    echo "Produkt '{$product['name']}' bereits vorhanden (ID: {$existing['id']}) - aktualisiere...\n";
                    
                    // Produkt aktualisieren
                    $sql = "UPDATE hb_products SET 
                        name = ?, 
                        category_id = ?, 
                        description = ?, 
                        metadata = ?, 
                        visible = ?, 
                        sort_order = ?,
                        updated_at = NOW()
                        WHERE id = ?";
                    
                    $stmt = $this->pdo->prepare($sql);
                    $stmt->execute([
                        $product['name'],
                        $product['category_id'],
                        $product['description'],
                        $product['metadata'],
                        $product['visible'],
                        $product['sort_order'],
                        $existing['id']
                    ]);
                    
                    echo "✅ Produkt '{$product['name']}' aktualisiert\n";
                } else {
                    echo "Erstelle Produkt '{$product['name']}'...\n";
                    
                    // Produkt erstellen
                    $sql = "INSERT INTO hb_products (
                        type, code, category_id, name, description, metadata, 
                        visible, sort_order, brand_id, created_at, updated_at
                    ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, NOW(), NOW())";
                    
                    $stmt = $this->pdo->prepare($sql);
                    $stmt->execute([
                        $product['type'],
                        $product['code'],
                        $product['category_id'],
                        $product['name'],
                        $product['description'],
                        $product['metadata'],
                        $product['visible'],
                        $product['sort_order'],
                        $this->brandId
                    ]);
                    
                    $productId = $this->pdo->lastInsertId();
                    echo "✅ Produkt '{$product['name']}' erstellt (ID: {$productId})\n";
                }
            }
        }
        
        /**
         * Pricing für Produkte einrichten
         * Tabelle: hb_products_pricing
         */
        public function setupPricing() {
            echo "\n=== Schritt 4: Pricing-Konfiguration ===\n";
            
            $pricing = [
                ['code' => 'dns-free', 'billing_cycle' => 'free', 'price' => 0.00, 'setup' => 0.00],
                ['code' => 'dns-pro', 'billing_cycle' => 'm', 'price' => 9.00, 'setup' => 0.00],
                ['code' => 'dns-business', 'billing_cycle' => 'm', 'price' => 29.00, 'setup' => 0.00],
                ['code' => 'dns-agency', 'billing_cycle' => 'm', 'price' => 99.00, 'setup' => 0.00]
            ];
            
            foreach ($pricing as $price) {
                // Produkt ID holen
                $stmt = $this->pdo->prepare("SELECT id FROM hb_products WHERE code = ? AND brand_id = ?");
                $stmt->execute([$price['code'], $this->brandId]);
                $product = $stmt->fetch(PDO::FETCH_ASSOC);
                
                if (!$product) {
                    echo "Produkt '{$price['code']}' nicht gefunden - überspringe Pricing\n";
                    continue;
                }
                
                // Prüfen ob Pricing bereits existiert
                $stmt = $this->pdo->prepare("SELECT id FROM hb_products_pricing WHERE product_id = ? AND billing_cycle = ?");
                $stmt->execute([$product['id'], $price['billing_cycle']]);
                $existing = $stmt->fetch(PDO::FETCH_ASSOC);
                
                if ($existing) {
                    echo "Pricing für '{$price['code']}' ({$price['billing_cycle']}) bereits vorhanden (ID: {$existing['id']}) - aktualisiere...\n";
                    
                    // Pricing aktualisieren
                    $sql = "UPDATE hb_products_pricing SET 
                        price = ?, 
                        setup = ?, 
                        updated_at = NOW()
                        WHERE id = ?";
                    
                    $stmt = $this->pdo->prepare($sql);
                    $stmt->execute([
                        $price['price'],
                        $price['setup'],
                        $existing['id']
                    ]);
                    
                    echo "✅ Pricing aktualisiert\n";
                } else {
                    echo "Erstelle Pricing für '{$price['code']}' ({$price['billing_cycle']})...\n";
                    
                    // Pricing erstellen
                    $sql = "INSERT INTO hb_products_pricing (
                        product_id, billing_cycle, price, setup, created_at, updated_at
                    ) VALUES (?, ?, ?, ?, NOW(), NOW())";
                    
                    $stmt = $this->pdo->prepare($sql);
                    $stmt->execute([
                        $product['id'],
                        $price['billing_cycle'],
                        $price['price'],
                        $price['setup']
                    ]);
                    
                    $pricingId = $this->pdo->lastInsertId();
                    echo "✅ Pricing erstellt (ID: {$pricingId}) - €{$price['price']}/{$price['billing_cycle']}\n";
                }
            }
        }
        
        /**
         * Setup ausführen
         */
        public function executeSetup() {
            echo "Beginne Setup...\n";
            
            try {
                $this->setupBrand();
                $catId = $this->setupDNSCategory();
                $this->setupProducts($catId);
                $this->setupPricing();
                
                echo "\n=== SETUP ERFOLGREICH ABGESCHLOSSEN ===\n";
                echo "\n📋 Zusammenfassung:\n";
                echo "✅ Brand: ezdns.support (ID: {$this->brandId})\n";
                echo "✅ Kategorie: DNS Services (ID: {$catId})\n";
                echo "✅ Produkte: 4 Produkte erstellt/aktualisiert\n";
                echo "✅ Pricing: Pricing für alle Produkte konfiguriert\n";
                
                echo "\n🚀 Nächste Schritte:\n";
                echo "1. Prüfen Sie die Produkte im HostBill Admin: https://support.panomity.com/padm/?cmd=products\n";
                echo "2. Konfigurieren Sie Payment Gateways (Stripe, PayPal)\n";
                echo "3. Erstellen Sie Support Departments\n";
                echo "4. Generieren Sie API Keys für ezdns.support\n";
                echo "5. Starten Sie die Frontend-Integration\n";
                echo "6. Erstellen Sie Test-Services und DNS-Scans\n";
                
                return [
                    'success' => true,
                    'brand_id' => $this->brandId,
                    'category_id' => $catId
                ];
                
            } catch (Exception $e) {
                echo "\n❌ SETUP-FEHLER: " . $e->getMessage() . "\n";
                echo "Stack Trace:\n" . $e->getTraceAsString() . "\n";
                return [
                    'success' => false,
                    'error' => $e->getMessage()
                ];
            }
        }
    }
    
    // Setup ausführen
    $setup = new EzDNSDatabaseSetup($pdo);
    $result = $setup->executeSetup();
    
    if ($result['success']) {
        echo "\n✅ Alles erfolgreich konfiguriert!\n";
        
        // Zusammenfassungs-Datei erstellen
        $summary = "=== ezDNS.support Setup-Zusammenfassung ===\n" .
                     "Datum: " . date('d.m.Y H:i:s') . "\n" .
                     "\n" .
                     "Konfigurierte Elemente:\n" .
                     "- Brand ID: {$result['brand_id']}\n" .
                     "- Kategorie ID: {$result['category_id']}\n" .
                     "- Produkte: 4 (Free, Pro, Business, Agency)\n" .
                     "- Pricing: Konfiguriert für alle Produkte\n" .
                     "\n" .
                     "Produkt-Details:\n" .
                     "\n" .
                     "1. DNS Check Free\n" .
                     "   - Preis: €0.00\n" .
                     "   - Features: 1x Scan/Monat, Delegation Check, DNSSEC Check\n" .
                     "\n" .
                     "2. DNS Check Pro\n" .
                     "   - Preis: €9.00/Monat\n" .
                     "   - Features: Unbegrenzte Scans, alle Checks, PDF/CSV Export\n" .
                     "\n" .
                     "3. DNS Check Business\n" .
                     "   - Preis: €29.00/Monat\n" .
                     "   - Features: Bis zu 10 Domains, White-Label, Priority-Support\n" .
                     "\n" .
                     "4. DNS Check Agency\n" .
                     "   - Preis: €99.00/Monat\n" .
                     "   - Features: Unbegrenzte Domains, Reseller-Optionen, Custom-Branding\n" .
                     "\n" .
                     "Nächste Schritte:\n" .
                     "1. Payment Gateways einrichten\n" .
                     "2. Support Department erstellen\n" .
                     "3. API Keys generieren\n" .
                     "4. Frontend integrieren\n";
        
        file_put_contents('/home/ezdns-setup-summary.txt', $summary);
        echo "\n📋 Zusammenfassung gespeichert: /home/ezdns-setup-summary.txt\n";
    } else {
        echo "\n❌ Setup fehlgeschlagen: " . $result['error'] . "\n";
        exit(1);
    }

} catch (PDOException $e) {
    echo "\n❌ Datenbank-Fehler: " . $e->getMessage() . "\n";
    echo "\nPrüfen Sie:\n";
    echo "- HostBill-Konfiguration: /home/support.panomity.com/public_html/includes/config.php\n";
    echo "- Datenbank-Zugangsdaten\n";
    echo "- MySQL-Verbindung\n";
    exit(1);
} catch (Exception $e) {
    echo "\n❌ Allgemeiner Fehler: " . $e->getMessage() . "\n";
    exit(1);
}

echo "\n=== Setup beendet ===\n";
?>