
<?php
// manage.in2digital.com.au -> portal redirector (WHMCS retired 2026-09-23)
// Synergy Wholesale renewal notices link: /index.php?rp=/domain/<domain>/renew
require_once '/etc/in2digital/config.php';
require_once '/home/in2digital_portal/portal.in2digital.com.au/public_html/config/database.php';

$rp = $_GET['rp'] ?? ($_SERVER['REQUEST_URI'] ?? '');
if (preg_match('#/domain/([a-z0-9\.\-]+)/renew#i', $rp, $m)) {
    $domain = strtolower($m[1]);
    try {
        $pdo = getDB();
        $stmt = $pdo->prepare("SELECT id FROM services_domains WHERE domain_name = ? LIMIT 1");
        $stmt->execute([$domain]);
        // Public renewal form (no login) - domain prefilled and auto-checked
        header('Location: https://portal.in2digital.com.au/renew_domain.php?domain=' . rawurlencode($domain), true, 302);
        exit;
    } catch (Throwable $e) { /* fall through to 410 */ }
}
http_response_code(410);
echo '<!DOCTYPE html><html><head><meta charset="utf-8"><title>Page retired</title></head>';
echo '<body style="font-family:sans-serif;max-width:34rem;margin:4rem auto;padding:0 1rem">';
echo '<h1>This page has been retired</h1>';
echo '<p>Domain management has moved to the <a href="https://portal.in2digital.com.au/domains.php">In2Digital Client Portal</a>.</p>';
echo '<p style="color:#666">If you followed a link from a renewal notice, please contact james@in2digital.com.au.</p>';
echo '</body></html>';
