prepare("SELECT live_api_key FROM ez_customers WHERE id = ? LIMIT 1"); $stmt->execute([$customer_id]); $api_key = $stmt->fetchColumn(); if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['pin_model'], $_POST['pin_product'], $_POST['quantity'])) { $pin_model = trim($_POST['pin_model']); $pin_product = trim($_POST['pin_product']); $quantity = (int) $_POST['quantity']; $stmt = $pdo->prepare("SELECT item_id FROM ez_eazypin_products WHERE pin_model = ? AND pin_product = ? LIMIT 1"); $stmt->execute([$pin_model, $pin_product]); $row = $stmt->fetch(PDO::FETCH_ASSOC); if ($row && $quantity > 0 && $api_key) { $product_id = (int) $row['item_id']; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://eazypin.co/interserver/free_fire_generate_pins/generate.php'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([ 'product_id' => $product_id, 'quantity' => $quantity, 'api_key' => $api_key ])); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); if (!empty($result['status']) && $result['status'] === 'success') { $_SESSION['swal'] = ['type' => 'success', 'msg' => 'Pins generated successfully.']; } else { $msg = $result['message'] ?? 'Failed to generate pins.'; $debug = isset($result['debug']) ? ' (' . $result['debug'] . ')' : ''; $_SESSION['swal'] = ['type' => 'error', 'msg' => $msg . $debug]; } } else { $_SESSION['swal'] = ['type' => 'error', 'msg' => 'Invalid Request']; } header("Location: " . $_SERVER['REQUEST_URI']); exit; } $search = trim($_GET['search'] ?? ''); $from = $_GET['from'] ?? ''; $to = $_GET['to'] ?? ''; $perPage = isset($_GET['perpage']) ? intval($_GET['perpage']) : 10; $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $offset = ($page - 1) * $perPage; $where = "WHERE pin_generated_by = :uid"; $params = ['uid' => $customer_id]; if ($search !== '') { $where .= " AND pin_code LIKE :search"; $params['search'] = "%$search%"; } if ($from !== '') { $where .= " AND pin_added_date >= :from"; $params['from'] = $from . " 00:00:00"; } if ($to !== '') { $where .= " AND pin_added_date <= :to"; $params['to'] = $to . " 23:59:59"; } if (isset($_GET['export']) && $_GET['export'] === 'txt') { $exportStmt = $pdo->prepare("SELECT pin_code FROM ez_eazypins $where ORDER BY pin_id DESC"); $exportStmt->execute($params); $codes = $exportStmt->fetchAll(PDO::FETCH_COLUMN); header('Content-Type: text/plain'); header('Content-Disposition: attachment; filename="generated_pins.txt"'); echo implode("\n", $codes); exit; } $totalStmt = $pdo->prepare("SELECT COUNT(*) FROM ez_eazypins $where"); $totalStmt->execute($params); $totalRecords = (int) $totalStmt->fetchColumn(); $totalPages = ceil($totalRecords / $perPage); $stmt = $pdo->prepare("SELECT * FROM ez_eazypins $where ORDER BY pin_id DESC LIMIT :limit OFFSET :offset"); foreach ($params as $key => $value) { $stmt->bindValue(":" . $key, $value, is_int($value) ? PDO::PARAM_INT : PDO::PARAM_STR); } $stmt->bindValue(':limit', $perPage, PDO::PARAM_INT); $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); $stmt->execute(); $pins = $stmt->fetchAll(PDO::FETCH_ASSOC); $models = $pdo->query("SELECT DISTINCT pin_model FROM ez_eazypin_products")->fetchAll(PDO::FETCH_COLUMN); $modelProducts = []; foreach ($models as $model) { $stmt = $pdo->prepare("SELECT DISTINCT pin_product FROM ez_eazypin_products WHERE pin_model = ?"); $stmt->execute([$model]); $modelProducts[$model] = array_column($stmt->fetchAll(PDO::FETCH_ASSOC), 'pin_product'); } ?> EazyPin - My Vouchers

Generate New PINs




My Vouchers

ID Model Product Code Date