🔐 Diciwall Hibrit Lisans Sistemi

Gelişmiş Offline/Online Lisans Doğrulama - Entegrasyon Kılavuzu

🎯 Sistem Genel Bakış

Diciwall Hibrit Lisans Sistemi, hem online API hem de offline private key ile lisans doğrulama imkanı sunan gelişmiş bir lisanslama çözümüdür.

🌐 Online Doğrulama

İnternet bağlantısı olan durumlarda API üzerinden gerçek zamanlı lisans kontrolü

🔒 Offline Doğrulama

İnternet bağlantısı olmayan durumlarda private key ile yerel doğrulama

🛡️ Hibrit Güvenlik

RSA-2048 şifreleme ve çoklu güvenlik katmanı ile maksimum koruma

⚡ Otomatik Geçiş

Sistem durumuna göre otomatik olarak online/offline mod arasında geçiş

✨ Sistem Özellikleri

🔄 Hibrit Doğrulama Mantığı

  1. Öncelik Offline: Private key varsa önce offline kontrol
  2. Fallback Online: Offline başarısızsa API'ye başvuru
  3. Cache Sistemi: Sonuçları 5 dakika cache'leme
  4. Akıllı Geçiş: Ağ durumuna göre otomatik mod seçimi

🔐 Güvenlik Özellikleri

  • RSA-2048 Digital signature ile imzalama
  • SHA-256 Hash algoritması
  • IP Kontrolü İzinli IP adresleri
  • Domain Kontrolü İzinli domain'ler
  • Tarih Kontrolü Lisans süresi doğrulama
  • Key Doğrulama Sahte key dosyası koruması

🔒 Güvenlik Kontrolleri

⚠️ Kritik Güvenlik: Sistem 7 katmanlı güvenlik kontrolü ile sahte lisansları engeller!

🛡️ Key Dokümanı Doğrulama Katmanları

Katman Kontrol Açıklama
1 Zorunlu Alanlar license_code, product_id, client bilgileri
2 Key Yaşı 1 yıldan eski key'ler reddedilir
3 Format Kontrolü Lisans kodu: XXXX-XXXX-XXXX-XXXX
4 Domain Eşleşmesi Key'deki client ile mevcut domain
5 Product ID 8 karakter alphanumeric format
6 Şüpheli İçerik test, demo, fake, cracked, nulled kontrolü
7 Online Doğrulama Sunucu ile key authenticity kontrolü

📦 Kurulum

📁 1. Dosyaları İndirin

Aşağıdaki dosyaları projenizin uygun dizinine kopyalayın:

  • hybrid_license_helper.php - Ana helper dosyası
  • private_key.pem - Lisansınıza özel private key

🔧 2. PHP Gereksinimleri

// Gerekli PHP extensionları - PHP 7.4+ - OpenSSL extension - cURL extension (online doğrulama için) - JSON extension

⚙️ 3. Konfigürasyon

<?php // config.php - Bu değerleri kendi bilgilerinizle değiştirin define('DICIWALL_API_KEY', 'YOUR_API_KEY_HERE'); // Admin panelinden alın define('DICIWALL_DOMAIN', 'your-domain.com'); // Lisanslı domain'iniz define('DICIWALL_SERVER_IP', 'YOUR_SERVER_IP'); // Sunucu IP'niz define('DICIWALL_PRODUCT_ID', 'YOUR_PRODUCT_ID'); // Ürün ID'niz define('DICIWALL_LICENSE_CODE', 'XXXX-XXXX-XXXX-XXXX'); // Lisans kodunuz // Debug modu (geliştirme için true, production'da false) define('DICIWALL_DEBUG', false); ?>
⚠️ Önemli: Bu config dosyasını güvenli bir dizinde tutun ve web erişimine kapatın.

🔧 Web Server Konfigürasyonu

Apache için (.htaccess):

RewriteEngine On RewriteRule ^api/server/license/hybrid$ /api/server/license/hybrid.php [L]

Nginx için:

location /api/server/license/hybrid { try_files $uri /api/server/license/hybrid.php; }

🚀 Kullanım

🎯 Basit Kullanım

<?php require_once 'hybrid_license_helper.php'; // Private key dosyasının yolu $private_key_path = '/secure/path/your_license.pem'; // Mevcut IP ve domain bilgilerini al $client_ip = $_SERVER['REMOTE_ADDR'] ?? '127.0.0.1'; $client_domain = $_SERVER['HTTP_HOST'] ?? 'localhost'; // Hibrit lisans doğrulama $result = verify_hybrid_license($private_key_path, $client_ip, $client_domain); if ($result['status']) { echo "✅ Lisans geçerli! Uygulamaya devam edebilirsiniz."; // Uygulamanızın ana kodları buraya } else { echo "❌ Lisans hatası: " . $result['error']; // Hata durumu - uygulamayı durdur exit(1); } ?>

🔄 Gelişmiş Hibrit Kullanım

<?php class MyAppLicenseManager { private $license_code; private $private_key_path; private $cache_duration = 300; // 5 dakika public function __construct($license_code) { $this->license_code = $license_code; $this->private_key_path = $this->findPrivateKey(); } public function verify() { // Cache kontrolü $cache_key = 'license_' . md5($this->license_code); $cached = $this->getCache($cache_key); if ($cached !== false) { return $cached; } // Hibrit doğrulama $result = $this->performHybridVerification(); // Başarılı sonuçları cache'le if ($result['status']) { $this->setCache($cache_key, $result, $this->cache_duration); } return $result; } private function performHybridVerification() { $client_ip = $_SERVER['REMOTE_ADDR'] ?? '127.0.0.1'; $client_domain = $_SERVER['HTTP_HOST'] ?? 'localhost'; // 1. Offline doğrulama dene if ($this->private_key_path && file_exists($this->private_key_path)) { $offline_result = verify_hybrid_license( $this->private_key_path, $client_ip, $client_domain ); if ($offline_result['status']) { return array_merge($offline_result, ['method' => 'offline']); } } // 2. Online API doğrulama dene $online_result = $this->verifyOnline(); if ($online_result['status']) { return array_merge($online_result, ['method' => 'online']); } // 3. Her iki yöntem de başarısız return [ 'status' => false, 'error' => 'License verification failed (both offline and online)', 'method' => 'none' ]; } private function verifyOnline() { // Online API doğrulama kodu... // (Önceki örneklerdeki gibi) } } // Kullanım $license_manager = new MyAppLicenseManager('4102-B9F8-889A-9B70'); $result = $license_manager->verify(); if ($result['status']) { echo "✅ Lisans doğrulandı ({$result['method']} method)"; } else { echo "❌ Lisans hatası: " . $result['error']; } ?>

💡 Kod Örnekleri

🔍 Lisans Bilgilerini Alma

<?php // Lisans detaylarını al $license_info = get_license_info('/path/to/private_key.pem'); if ($license_info['status']) { $license = $license_info['license_info']; echo "Lisans Kodu: " . $license['license_code'] . "\n"; echo "Müşteri: " . $license['client'] . "\n"; echo "Ürün ID: " . $license['product_id'] . "\n"; echo "Son Kullanma: " . ($license['expiry_date'] ?? 'Sınırsız') . "\n"; if (isset($license['licensed_ips'])) { echo "İzinli IP'ler: " . $license['licensed_ips'] . "\n"; } if (isset($license['licensed_domains'])) { echo "İzinli Domain'ler: " . $license['licensed_domains'] . "\n"; } } ?>

📅 Lisans Süresi Kontrolü

<?php // Lisans süresini kontrol et $expiry_check = check_license_expiry('/path/to/private_key.pem'); if ($expiry_check['status']) { if ($expiry_check['expires']) { $days = $expiry_check['days_remaining']; if ($days > 30) { echo "✅ Lisans aktif ({$days} gün kaldı)"; } elseif ($days > 0) { echo "⚠️ Lisans yakında sona erecek ({$days} gün kaldı)"; } else { echo "❌ Lisans süresi dolmuş (" . abs($days) . " gün önce)"; } } else { echo "♾️ Lisans süresi sınırsız"; } } ?>

🔄 Otomatik Yenileme Sistemi

<?php class AutoRenewLicenseManager { private $license_code; private $check_interval = 3600; // 1 saat public function startAutoCheck() { while (true) { $result = $this->checkLicense(); if (!$result['status']) { $this->handleLicenseFailure($result); break; } // Lisans süresi kontrolü if ($this->isExpiringSoon()) { $this->notifyExpiration(); } sleep($this->check_interval); } } private function isExpiringSoon() { $expiry_check = check_license_expiry($this->private_key_path); return $expiry_check['status'] && $expiry_check['expires'] && $expiry_check['days_remaining'] <= 7; } private function notifyExpiration() { // E-posta veya log ile bildirim error_log("⚠️ License expiring soon for: " . $this->license_code); } } ?>

🌐 API Referansı

📋 Ana Fonksiyonlar

🔐 verify_hybrid_license()

Açıklama: Ana hibrit lisans doğrulama fonksiyonu

verify_hybrid_license($private_key_path, $client_ip = null, $client_domain = null) Parametreler: - $private_key_path (string): Private key dosyasının yolu - $client_ip (string): İstemci IP adresi (opsiyonel) - $client_domain (string): İstemci domain'i (opsiyonel) Dönüş: array [ 'status' => bool, // Doğrulama durumu 'method' => string, // 'offline' veya 'online' 'license_data' => array, // Lisans bilgileri 'verified_at' => string, // Doğrulama zamanı 'error' => string, // Hata mesajı (başarısızsa) 'error_code' => string // Hata kodu (başarısızsa) ]

📊 get_license_info()

Açıklama: Lisans bilgilerini getirir

get_license_info($private_key_path) Parametreler: - $private_key_path (string): Private key dosyasının yolu Dönüş: array [ 'status' => bool, 'license_info' => array [ 'license_code' => string, 'client' => string, 'product_id' => string, 'expiry_date' => string, 'licensed_ips' => string, 'licensed_domains' => string ] ]

📅 check_license_expiry()

Açıklama: Lisans süresini kontrol eder

check_license_expiry($private_key_path) Dönüş: array [ 'status' => bool, 'expires' => bool, // Süresi var mı? 'expiry_date' => string, // Son kullanma tarihi 'days_remaining' => int, // Kalan gün sayısı 'is_expired' => bool, // Süresi dolmuş mu? 'message' => string // Açıklayıcı mesaj ]

🌐 Online API Endpoint'leri

Base URL: https://license.diciwall.com/index.php/api_external/
Endpoint Method Açıklama
/verify_license POST Online lisans doğrulama
/activate_license POST Lisans aktivasyonu
/hybrid_verify_full POST Hibrit lisans doğrulama (Online + Offline)
/hybrid_download_private_key/{license} GET Private key indirme

📤 Gerekli Header'lar

LB-API-KEY: YOUR_API_KEY LB-URL: https://your-domain.com LB-IP: YOUR_SERVER_IP Content-Type: application/json

🚀 API Kullanım Örneği

cURL ile Test

curl -s "https://license.diciwall.com/index.php/api_external/hybrid_verify_full" \ -H "Content-Type: application/json" \ -H "LB-API-KEY: YOUR_API_KEY" \ -H "LB-URL: https://your-domain.com/" \ -H "LB-IP: YOUR_SERVER_IP" \ -X POST \ -d '{ "license_code": "XXXX-XXXX-XXXX-XXXX", "client_ip": "YOUR_SERVER_IP", "client_domain": "your-domain.com" }'

JavaScript/Fetch ile Kullanım (Proxy Endpoint Gerekli)

⚠️ CORS Uyarısı: Web uygulamalarında direkt API çağrısı CORS hatası verir. Aşağıdaki proxy endpoint'i sunucunuzda oluşturun.
1. Sunucunuzda Proxy Endpoint Oluşturun (/api/server/license/hybrid.php):
'Method not allowed']); exit(); } $input = file_get_contents('php://input'); $data = json_decode($input, true); if (!$data) { http_response_code(400); echo json_encode(['error' => 'Invalid JSON']); exit(); } $license_server_url = 'https://license.diciwall.com/index.php/api_external/hybrid_verify_full'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $license_server_url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', 'LB-API-KEY: YOUR_API_KEY', 'LB-URL: https://your-domain.com/', 'LB-IP: YOUR_SERVER_IP' ]); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); http_response_code($http_code); echo $response; ?>
2. Web Uygulamanızda Proxy Endpoint'ini Kullanın:
// Kendi sunucunuzdaki proxy endpoint'e istek atın const response = await fetch('/api/server/license/hybrid', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ license_code: 'XXXX-XXXX-XXXX-XXXX', client_ip: 'YOUR_SERVER_IP', client_domain: 'your-domain.com' }) }); const result = await response.json(); if (result.status === true) { console.log('✅ License geçerli!', result); } else { console.log('❌ License hatası!', result); }

Başarılı Response Örneği

{ "status": true, "method": "online", "license_data": { "license_code": "XXXX-XXXX-XXXX-XXXX", "client": "your-domain.com", "expiry": "2025-12-31 23:59:59", "validity": "1" }, "verified_at": "2025-10-05 20:30:00" }

🔧 Sorun Giderme

❌ Yaygın Hatalar ve Çözümleri

Hata Kodu Açıklama Çözüm
FILE_NOT_FOUND Private key dosyası bulunamadı Dosya yolunu kontrol edin, dosyanın var olduğundan emin olun
INVALID_SIGNATURE Lisans imzası geçersiz Dosya bozulmuş olabilir, yeni private key indirin
LICENSE_EXPIRED Lisans süresi dolmuş Lisansınızı yenileyin veya süre uzatın
IP_NOT_AUTHORIZED IP adresi yetkisiz Admin panelinden IP adresinizi ekleyin
DOMAIN_NOT_AUTHORIZED Domain yetkisiz Admin panelinden domain'inizi ekleyin
CLIENT_DOMAIN_MISMATCH Key'deki client ile domain uyumsuz Doğru lisans için private key indirin
SUSPICIOUS_CONTENT Şüpheli içerik tespit edildi Orijinal private key dosyasını kullanın

🔍 Debug Modu

Debug modu nasıl aktif edilir:

  • Config dosyanızda define('DICIWALL_DEBUG', true); yapın
  • Debug logları konsola ve diciwall_debug.log dosyasına yazılır
  • Production ortamında mutlaka false yapın
<?php // Debug modu aktif et define('DICIWALL_DEBUG', true); // Helper dosyasını dahil et require_once 'hybrid_license_helper.php'; // Debug modu için detaylı hata raporlama error_reporting(E_ALL); ini_set('display_errors', 1); // Lisans doğrulama ile debug $result = verify_hybrid_license($private_key_path, $client_ip, $client_domain); // Detaylı hata bilgisi if (!$result['status']) { echo "Hata Kodu: " . ($result['error_code'] ?? 'UNKNOWN') . "\n"; echo "Hata Mesajı: " . $result['error'] . "\n"; // Private key dosyası kontrolü if (file_exists($private_key_path)) { echo "Dosya boyutu: " . filesize($private_key_path) . " bytes\n"; echo "Dosya izinleri: " . substr(sprintf('%o', fileperms($private_key_path)), -4) . "\n"; } else { echo "❌ Private key dosyası bulunamadı: $private_key_path\n"; } } // Debug log dosyasını kontrol et $debug_log = dirname(__FILE__) . '/diciwall_debug.log'; if (file_exists($debug_log)) { echo "\n=== Debug Log İçeriği ===\n"; echo file_get_contents($debug_log); } ?>

🌐 Web Uygulamaları için Özel Notlar

CORS Sorunu Çözümü:

  • Web uygulamalarında direkt API çağrısı CORS hatası verir
  • Yukarıdaki proxy endpoint kodunu sunucunuzda oluşturun
  • Web uygulamanızda kendi proxy endpoint'inizi kullanın

Yaygın Web Hataları:

  • net::ERR_UPLOAD_FILE_CHANGED - Proxy endpoint çalışmıyor
  • Failed to fetch - CORS sorunu veya proxy endpoint eksik
  • 400 Bad Request - Proxy endpoint'te hatalı parametre iletimi

📞 Destek

Teknik Destek:

  • 🌐 Website: license.diciwall.com
  • 📧 E-posta: support@diciwall.com
  • 📋 Dokümantasyon: Bu sayfa sürekli güncellenmektedir
✅ Başarılı Entegrasyon İpuçları:
  • Private key dosyasını güvenli bir dizinde saklayın
  • Cache sistemini kullanarak performansı artırın
  • Hata durumlarını loglamayı unutmayın
  • Lisans süresi kontrolünü düzenli yapın
  • Test ortamında önce deneyin
  • Web uygulamaları için mutlaka proxy endpoint kullanın

🎉 Entegrasyon Tamamlandı!

Diciwall Hibrit Lisans Sistemi başarıyla entegre edildi. Artık güvenli ve esnek lisans doğrulama sistemini kullanabilirsiniz.

Sürüm: 1.0.0 | Son Güncelleme: | © 2025 Diciwall