<?php include('inc/header.php'); ?>
<h1>Suche - Maillogs</h1>
<div class="container">
    <div class="backend_button">
        <a href="javascript:history.back();">Gehe zurück</a>
    </div>
<?php
$resGetMails = odbc_exec($odbc_connect, '
   SELECT	[idReceiver],
            [idSender],
            [nGold],
            [szTitle],
            [szText],
            [dwItemId],
            [nItemNum],
            [dwSerialNumber],
            [SendDt]
  FROM	    [' . $_CONFIG['db_databases']['chr'] . '].[dbo].[MAIL_TBL]
  WHERE	    (idReceiver = \'' . mssql_escape_string($_GET['characterID']) . '\' or idSender = \'' . mssql_escape_string($_GET['characterID']) . '\')
            AND szTitle != \'Paargegenstand\' AND szTitle NOT LIKE \'%Lord]Steuer%\'
            AND szTitle NOT LIKE \'%Lord]Einnahme%\' AND szTitle NOT LIKE \'Titel für Lord %\'
');
if(@odbc_num_rows($resGetMails) > 0) {
    while($arrayGetMails = @odbc_fetch_array($resGetMails)) {
        echo '
        <div style="padding: 20px 0;">
            <p style="font-weight: bold;"><a href="search.php?search=' . $arrayGetMails['idSender'] . '&character=Charaktersuche">' . getUserName($arrayGetMails['idSender']) . '</a> hat <a href="search.php?search=' . $arrayGetMails['idReceiver'] . '&character=Charaktersuche">' . getUserName($arrayGetMails['idReceiver']) . '</a> am ' . date('d.m.Y, H:i', strtotime($arrayGetMails['SendDt'])) . ' Uhr folgende Nachricht geschrieben:</p>
            <div style="padding-left: 30px;">
                <p>' . utf8_encode($arrayGetMails['szTitle']) . '</p>
                <p style="padding-left: 25px;">' . utf8_encode($arrayGetMails['szText']) . '</p>
            </div>
            <div>
                <b>Inhalt dieser Nachricht:</b>
                <p style="padding-left: 30px;">' . $arrayGetMails['nGold'] . ' Penya</p>
                <p style="padding-left: 30px;">' . $arrayGetMails['nItemNum'] . 'x ' . getItemName($arrayGetMails['dwItemId']) . ' <i>(Item-ID: ' . $arrayGetMails['dwSerialNumber'] . ')</i></p>
            </div>
        </div>';
    }
}
else {
    echo '<div class="fail">Dieser Charakter hat noch keine Mail bekommen oder verschickt.</div>';
}
?>
</div>
<?php include('inc/footer.php'); ?>