<?php

$content = api_query('https://' . $server . '/manager/ispmgr?func=emailredirect&out=xml&authinfo=' . urlencode($_SESSION['username']) . ':' . urlencode($_SESSION['password']));
$parse_xml = simplexml_load_string($content);
echo '<div class="menu"><img src="images/t-new.png" alt="." /><a href="?func=emailredirect.edit">Создать почтовый редирект</a>' . "\n";
echo '</div>' . "\n";
foreach($parse_xml->elem as $var) {
    echo '<div class="post"><b>E-mail адрес:</b> '.htmlentities((string)$var->name, ENT_QUOTES, 'UTF-8') . '<br />' . "\n";
    echo '<b>Перенаправить на:</b> '.htmlentities((string)$var->forward, ENT_QUOTES, 'UTF-8') . '<br />';
    echo '&#187; <a href="?func=emailredirect.edit&amp;elid=' . urlencode((string)$var->name) . '">Изменить</a><br />' . "\n";
    echo '&#187; <a href="?func=emailredirect.delete&amp;elid=' . urlencode((string)$var->name) . '">Удалить</a>' . "\n";
    echo '</div>' . "\n";
}
echo '<div class="menu"><img src="images/sb-menu.png" alt="." /><a href="?func=menu">Вернуться в меню</a>' . "\n</div>";

?>