decode($hostname); } catch (Exception $e) { $decoded_hostname = null; } } if (empty($type)) { if ($decoded_hostname) { $stmt = $db->prepare('SELECT target, type FROM apache_redirect WHERE vhost = :vhost UNION SELECT target, type FROM apache_redirect WHERE vhost = :decoded'); $stmt->execute(array('vhost' => $hostname, 'decoded' => $decoded_hostname)); } else { $stmt = $db->prepare('SELECT target, type FROM apache_redirect WHERE vhost = :vhost'); $stmt->execute(array('vhost' => $hostname)); } $row = $stmt->fetch(); if ($row) { if ($row['type'] == 'temporary') { $type = 302; } else if ($row['type'] == 'permanent') { $type = 301; } else { $type = 'iframe'; } $parts = parse_url($row['target']); if (empty($parts['scheme'])) { $target = 'http://' . $row['target']; } else { $target = $row['target']; } } } if (empty($type)) { $stmt = $db->prepare('SELECT customer FROM apache_vhosts WHERE vhost = :vhost AND active = "no"'); $stmt->execute(array('vhost' => $hostname)); $row = $stmt->fetch(); $brand = $row['customer'] < 250000 ? 'izone' : 'domainplanet'; if ($row) { $type = 503; } } if (empty($type)) { $stmt = $db->prepare('SELECT 1 AS found FROM apache_deleted WHERE vhost = :vhost'); $stmt->execute(array('vhost' => $hostname)); $row = $stmt->fetch(); if ($row) { $type = 410; } } if (empty($type)) { if (preg_match('%cluster\.vim\.at$%', $hostname)) { return; } $type = 404; } $template = dirname(__FILE__) . '/' . $type . '.html.php'; if (!file_exists($template)) { $type = 500; echo '