Your IP : 216.73.217.79


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

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

if (!isset($_SESSION["StudentID"]) || empty($_SESSION["StudentID"])) header("Location: http://www.cesa.co.za/mentanet/login.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>MentaNet</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<!--[if IE 5]>
<style type="text/css"> 
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLtHdr #sidebar1 { width: 230px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css"> 
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
</head>

<body class="twoColFixLtHdr">

<div id="container">
<?php include("inc_header.php"); ?>
<?php include("inc_sidebar.php"); ?>
  <div id="mainContent">
    <h1>Read Message</h1>
    <p><a href="modcontact.php">Click here to send a message now.</a></p>
<?php
$sql = "SELECT CCMMessages.* FROM CCMMessages
WHERE CCMMessages.CCMMessageID
AND CCMMessages.CCMMessageID=".$_GET["id"];
$rec=mysql_query($sql);
if ($row=mysql_fetch_assoc($rec)) {
	if (isset($_GET["archive"]) && ($_GET["archive"]==1)) {
		$sql="UPDATE CCMMessagesSentTo SET Archived=1 WHERE SentType='".$_SESSION["MessageType"]."'
AND SentID=".$_SESSION["StudentID"]." AND CCMMessageID=".$_GET["id"];
		mysql_query($sql);
		echo "<p><b style='color:red'>The message has been archived.</b></p>";
	}
?>
    <table border="0">
  <tr>
    <td colspan="2" align="right" valign="top"><b>
<?php
	$sql = "SELECT CCMMessages.* FROM CCMMessages, CCMMessagesSentTo
	WHERE CCMMessages.CCMMessageID=CCMMessagesSentTo.CCMMessageID
	AND CCMMessagesSentTo.SentType='".$_SESSION["MessageType"]."'
	AND CCMMessagesSentTo.SentID=".$_SESSION["StudentID"]."
	AND CCMMessages.CCMMessageID < ".$_GET["id"]."
	ORDER BY SentDateTime DESC";
	$recPrev=mysql_query($sql);
	if ($rowPrev=mysql_fetch_assoc($recPrev)) {
		echo "<a href='readmessage.php?id=".$rowPrev["CCMMessageID"]."'>&lt;&lt; Previous message</a><br />";
	}
	$sql = "SELECT CCMMessages.* FROM CCMMessages, CCMMessagesSentTo
	WHERE CCMMessages.CCMMessageID=CCMMessagesSentTo.CCMMessageID
	AND CCMMessagesSentTo.SentType='".$_SESSION["MessageType"]."'
	AND CCMMessagesSentTo.SentID=".$_SESSION["StudentID"]."
	AND CCMMessages.CCMMessageID > ".$_GET["id"]."
	ORDER BY SentDateTime ASC";
	$recNext=mysql_query($sql);
	if ($rowNext=mysql_fetch_assoc($recNext)) {
		echo "<a href='readmessage.php?id=".$rowNext["CCMMessageID"]."'>Next message &gt;&gt;</a>";
	}
?></b>
</td>
    </tr>
  <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 nl2br($row["MessageText"]); ?></td>
</tr>
<tr><td valign="top"><b>Attachment:</b></td>
<td valign="top"><?php if (!empty($row["MessageFile"])) echo "<a href='/ccmadmin/msgattach/".$row["MessageFile"]."' target='_blank'>".$row["MessageFile"]."</a>"; ?></td>
</tr>
<tr>
  <td colspan="2" align="center"><hr /></td>
</tr>
<tr><td colspan="2" align="center"><b><a href="modcontact.php?replyto=<?php echo $row["CCMMessageID"]; ?>"><strong>Reply</strong></a></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><a href="modcontact.php?fwd=<?php echo $row["CCMMessageID"]; ?>">Forward</a></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><a href="readmessage.php?archive=1&id=<?php echo $row["CCMMessageID"]; ?>">Archive</a></b></td></tr>
</table>
<?php	
}
	$sql = "INSERT INTO CCMMessageLog (CCMMessageID, ReadByType, ReadByID, ReadDateTime) VALUES (".$_GET["id"].", '".$_SESSION["MessageType"]."', ".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."')";
	mysql_query($sql);
?>
    <p></p>
  </div>
<?php include("inc_footer.php"); ?>
	</div>
</body>
</html>