= $data['next_payout']) { if (file_exists($pulFile)) { $currentBal = floatval(file_get_contents($pulFile)); } else { $currentBal = 0; } $currentBal += $data['daily_income']; file_put_contents($pulFile, $currentBal); $data['days_left'] -= 1; if ($data['days_left'] <= 0) { @unlink($file); } else { $data['next_payout'] += 86400; file_put_contents($file, json_encode($data)); } $processed++; } } echo "Cron executed at " . date('Y-m-d H:i:s') . " | Processed: " . $processed; } else { echo "VIP yoki pul papkasi topilmadi!"; } exit; } // ========================================== // 4. ASOSIY DASTUR // ========================================== foreach ([$userDir, $vipDir, $pulDir] as $dir) { if (!is_dir($dir)) mkdir($dir, 0777, true); } $userFile = $userDir . $phone . '.json'; $pulFile = $pulDir . $phone . '.txt'; if (!file_exists($userFile)) { $profileData = ['phone' => $phone, 'name' => 'Foydalanuvchi']; file_put_contents($userFile, json_encode($profileData)); } else { $profileData = json_decode(file_get_contents($userFile), true); } if (file_exists($pulFile)) { $currentBalance = floatval(file_get_contents($pulFile)); } else { $currentBalance = 0; } $realName = htmlspecialchars($profileData['name']); // ========================================== // 5. AJAX SO'ROVLAR // ========================================== if ($_SERVER['REQUEST_METHOD'] === 'POST') { header('Content-Type: application/json; charset=utf-8'); // Ismni yangilash if (isset($_POST['update_name'])) { $newName = trim($_POST['name'] ?? ''); if ($newName !== '') { $profileData['name'] = $newName; file_put_contents($userFile, json_encode($profileData)); echo json_encode(['success' => true, 'name' => $newName]); } else { echo json_encode(['success' => false, 'error' => 'Ism bo\'sh bo\'lishi mumkin emas']); } exit; } // VIP sotib olish if (isset($_POST['action']) && $_POST['action'] === 'buy_vip') { try { $vipLevel = (int)($_POST['vip_level'] ?? 0); $amount = (int)($_POST['amount'] ?? 0); $days = (int)($_POST['days'] ?? 0); if ($vipLevel < 1 || $vipLevel > 3 || $amount <= 0 || $days <= 0) { throw new Exception('Noto\'g\'ri ma\'lumotlar!'); } $vipFile = $vipDir . "vip{$vipLevel}_{$phone}.json"; if (file_exists($vipFile)) { throw new Exception('Sizda ushbu VIP daraja allaqachon faol!'); } // Balansni qayta o'qish if (file_exists($pulFile)) { $currentBalance = floatval(file_get_contents($pulFile)); } else { $currentBalance = 0; } if ($currentBalance < $amount) { throw new Exception('Hisobingizda mablag\' yetarli emas! Joriy balans: ' . number_format($currentBalance, 0, ',', ' ') . ' so\'m'); } // Foizni ANIQ hisoblash $baseRate = ($vipLevel == 1) ? 3.5 : (($vipLevel == 2) ? 4.8 : 5.3); $rateStartDay = ($vipLevel == 1) ? 5 : (($vipLevel == 2) ? 7 : 20); $currentRate = $baseRate + max(0, $days - $rateStartDay) * 0.05; $dailyIncome = round($amount * ($currentRate / 100), 2); $startTime = time(); $endTime = $startTime + ($days * 86400); // Balansdan yechish va birinchi daromadni qo'shish $newBalance = $currentBalance - $amount + $dailyIncome; // Faylga yozish (xatolik tekshiruvi bilan) $writeResult = file_put_contents($pulFile, $newBalance); if ($writeResult === false) { throw new Exception('Balans faylini yangilab bo\'lmadi!'); } $daysLeft = $days - 1; $nextPayout = $startTime + 86400; $vipData = [ 'phone' => $phone, 'vip_level' => $vipLevel, 'amount' => $amount, 'days_total' => $days, 'days_left' => $daysLeft, 'daily_income' => $dailyIncome, 'rate' => $currentRate, 'start_time' => $startTime, 'end_time' => $endTime, 'next_payout' => $nextPayout ]; $writeVip = file_put_contents($vipFile, json_encode($vipData)); if ($writeVip === false) { throw new Exception('VIP faylini saqlab bo\'lmadi!'); } echo json_encode([ 'success' => true, 'message' => 'Investitsiya muvaffaqiyatli rasmiylashtirildi!', 'end_date' => date('d/m', $endTime), 'daily_income' => $dailyIncome, 'rate' => $currentRate, 'new_balance' => $newBalance ]); } catch (Exception $e) { echo json_encode(['success' => false, 'message' => $e->getMessage()]); } exit; } // Agar hech qanday action bo'lmasa echo json_encode(['success' => false, 'message' => 'Noto\'g\'ri so\'rov']); exit; } // Faol VIP larni o'qish $activeVips = []; for ($i = 1; $i <= 3; $i++) { $vFile = $vipDir . "vip{$i}_{$phone}.json"; if (file_exists($vFile)) { $activeVips[$i] = json_decode(file_get_contents($vFile), true); } } ?>

Foiz stavkasi
Amal qilish
muddati
Kunlik investitsiya
daromadi

Foiz stavkasi
Amal qilish
muddati
Kunlik investitsiya
daromadi

Foiz stavkasi
Amal qilish
muddati
Kunlik investitsiya
daromadi