Your IP : 216.73.217.117


Current Path : /var/www/cesa.co.za/cesanet/
Upload File :
Current File : /var/www/cesa.co.za/cesanet/readmessage.php

<?php
include("inc_functions.php");

//ini_set('display_errors', 1);
//error_reporting(E_ALL);

if (!isset($_SESSION["StudentID"]) || empty($_SESSION["StudentID"]) || $_SESSION["StudentID"] == null)
    header("Location: /cesanet/login.php");

include_once($_SERVER['DOCUMENT_ROOT'] . "/cesanet/includes/html_begin.php");
?>
<h1>Read Message</h1>
<?php
include_once($_SERVER['DOCUMENT_ROOT'] . "/cesanet/includes/message_menu.php");

$sql = "SELECT DISTINCT CCEMessages.* FROM CCEMessages, CCEMessagesSentTo
WHERE CCEMessages.CCEMessageID=CCEMessagesSentTo.CCEMessageID
AND (CCEMessagesSentTo.SentID=" . $_SESSION["StudentID"] . " OR CCEMessages.SentByStudentID=" . $_SESSION["StudentID"] . ")
AND CCEMessages.CCEMessageID=" . $_GET["id"];
//echo $sql;
$rec = mysql_query($sql);
if ($row = mysql_fetch_assoc($rec)) {
    ?>
    <table border="0" class="table" cellpadding="4" cellspacing="0" width="100%">
        <tr><td valign="top"><b>From:</b></td>
            <td valign="top"><?php echo $row["SentByName"]; ?></td>
        </tr>
        <tr><td valign="top"><b>Subject:</b></td>
            <td valign="top"><?php echo $row["MessageSubject"]; ?></td>
        </tr>
        <tr><td valign="top"><b>Message:</b></td>
            <td valign="top"><?php echo formatCceMessageForDisplay($row["MessageText"]); ?></td>
        </tr>
        <tr><td valign="top"><b>Attachment:</b></td>
            <td valign="top"><?php if (!empty($row["MessageFile"])) echo "<a href='/cceadmin/msgattach/" . $row["MessageFile"] . "' target='_blank'>" . $row["MessageFile"] . "</a>"; ?></td>
        </tr>
        <tr><td colspan="2" align="center">
                <b><a href="modcontact.php?replyto=<?php echo $row["CCEMessageID"]; ?>&all=1" class="btn btn-primary">Reply to
                        All</a>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="modcontact.php?replyto=<?php echo $row["CCEMessageID"]; ?>" class="btn btn-primary">Reply</a>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="modcontact.php?fwd=<?php echo $row["CCEMessageID"]; ?>" class="btn btn-primary">Forward</a></b>
            </td></tr>
    </table>
    <?php
}
$sql = "INSERT INTO CCEMessageLog (CCEMessageID, ReadByType, ReadByID, ReadDateTime) VALUES (" . $_GET["id"] . ", 'Student', " . $_SESSION["StudentID"] . ", '" . date("Y-m-d H:i:s") . "')";
mysql_query($sql);

include_once($_SERVER['DOCUMENT_ROOT'] . "/cesanet/includes/html_end.php");