$type = $data['type']; $start = date("Y-m-d"); $end = date("Y-m-d", strtotime("+1 month")); // یا بر اساس نوع اشتراک switch ($type) { case "monthly": $end = date("Y-m-d", strtotime("+1 month")); break; case "quarterly": $end = date("Y-m-d", strtotime("+3 months")); break; case "vip": $end = date("Y-m-d", strtotime("+1 year")); break; } $stmt = $conn->prepare("INSERT INTO subscriptions (user_id, type, start_date, end_date, status) VALUES (?, ?, ?, ?, 'active')"); $stmt->bind_param("isss", $user_id, $type, $start, $end); $stmt->execute();