<?php

$file = __FILE__;
include ("inc/inc_common.php");
include ("inc/inc_connect.php");
include ("inc/inc_admincheck.php");
include ("inc/inc_getdate.php");
include ("inc/inc_forumname.php");
$page = "Inbox";
$pagelink = $file;
include("inc/inc_setonline.php");
$title = "Inbox";
include ("inc/inc_head.php");
include ("inc/inc_body.php");
$title = "Inbox";
include ("inc/inc_title.php");

print "</centeR><table border=0 width=\"100%\" cellpadding=1 cellspacing=0><tr><td  width=\"20%\">
<table border=0 cellpadding=1 cellspacing=0><tr><td>
<font face=\"$font\" size=$fontsize><image src=\"images/folder_icon.gif\">&nbsp;<a href=\"index.php\">$name1&nbsp;Home</a>
</td></tr>
<tr><td><image src=\"images/folder_line.gif\">
<font face=\"$font\" size=$fontsize><image src=\"images/folder_icon.gif\">&nbsp;<a href=\"inbox.php\">Inbox</a></td></tr>
<tr><td><font face=\"$font\" size=$fontsize>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<image src=\"images/folder_line.gif\">
<image src=\"images/open_folder_icon.gif\">&nbsp;Read Message</td></tr>

</table>
</td><td><center>";

include ("inc/inc_navigation.php");
include ("inc/inc_newmailsdisplay.php");
print "</td></tr></table><br><br><center>";

//end of include files...

$result = mysql_query( "SELECT * FROM $pmtable WHERE intId = '$messageid'" );
$num_rows = mysql_num_rows( $result );

//Dispay records
while ( $a_row = mysql_fetch_object( $result ) )
{
    if ( $a_row->intReplied == 1)
    {
        print "<font face=$font size=2>You replied to this message at $a_row->strTimeReplied on the $a_row->strDateReplied...<br><br>";
    }


    print "<table border=1 cellpadding=0 cellspacing=0 style=\"border-collapse: collapse\" bordercolor=\"$bordercolor\" width=\"80%\">
    <tr><td width=\"100%\" bgcolor=\"$fgcolour\" align=\"right\">

    <a OnClick=\"return confirm('Are you sure you want to delete this private message?')\" href=\"inbox_delete.php?id=$messageid\"><img border=0 src=\"images/delete_private_message.gif\"></a>

    &nbsp;
    <a href=\"inbox.php\"><img border=0 src=\"images/inbox.gif\"></a>";

    if ($to != "Forum Admin")
    {
        print "&nbsp;
        <a href=\"inbox_create.php?to=$to&subject=$subject&id=$id\">
        <img border=0 src=\"images/reply_private_message.gif\"></a>";
    }

    print "&nbsp;
    <a href=\"inbox_create.php\"><img border=0 src=\"images/new_private_message.gif\"></a>

    </td></tr></table>
    <table border=1 cellspacing=0 width=\"80%\" cellpadding=0 style=\"border-collapse: collapse\" bordercolor=\"$bordercolor\">
    <tr><td width=100% bgcolor=\"$fgcolour\">
    <b><font face=\"$font\">&nbsp;$a_row->strSubject</font></b></td>
    </tr>
    <td width=100%>
    <font face=$font size=2>&nbsp;From: $a_row->strFrom at $a_row->strTimeRecieved
    on the $a_row->strDateRecieved.
    </td></tr></table>
    <table border=1 cellspacing=0 style=\"border-collapse: collapse\" bordercolor=#111111 width=80% cellpadding=3>
    <tr>";

  $postthis = $a_row->memMessage;
  include("formatposts.php");
  $postthis = str_replace("[report]", "<a href=\"", $postthis);
  $postthis = str_replace("[unreport]", "\">Click here to see the post</a>.", $postthis);

    print "<td width=100%><br><font face=$font size=2>$postthis<br><br></td>
  </tr></table><br><br>";
  if ( $a_row->intRead == 0 )
    {
        $date_array = getdate();
        $date = "$date_array[mday]/$date_array[mon]/$date_array[year]";
        $time = "$date_array[hours]:$date_array[minutes]:$date_array[seconds]";

      $query = mysql_query( "UPDATE $pmtable SET intRead = '1', strDateRead = '$date', strTimeRead = '$time' WHERE intId = '$messageid'");
      mysql_query( $query, $link );
    }
}


include ("inc/inc_footer.php")
?>