Forum Moderators: coopster
<?php
//This updates the message status. Retrive data from buttons in form
$Read = $_POST['Make as Read'];
$Spam = $_POST['Spam'];
$Remove = $_POST['Remove'];
//ID from tick boxs in Form for each message. ( I think )
$messageid = $POST['id'];
//Update message_Read from 0 to 1 - Updates the message status
if ($Read)
{
$query = mysql_query("UPDATE messages SET message_read = '1' WHERE id = '$messageid'");
exit;
}
// Message admin with a notifaction displaying to_user, from_user and message_id.
if ($Spam)
{
// Edit Something
exit;
}
//Update "messages" in to_user from '$_SESSION[user_id]' to 0; keeping the message in the database but not viewable to the user.
if ($Remove)
{
// Remove Something
exit;
}
?>
<br />
Select: (All) <input type="checkbox" onClick="toggle(this)" /></td>
</tr>
<tr>
<td width="53%">
<form action="<?php echo $_SERVER['php_SELF'];?>" method="post">
<input type=hidden name="Make as Read">
<input type="submit" value="Make as Read">
<input type=hidden name="Spam">
<input type="submit" value="Spam">
<input type="hidden" name="Remove">
<input type="submit" value="Remove">
<?php
// get the messages from the table.
$get_messages = mysql_query("SELECT message_id FROM messages WHERE to_user='$_SESSION[user_id]' ORDER BY message_id DESC LIMIT 0, 10") or die(mysql_error());
$get_messages2 = mysql_query("SELECT * FROM messages WHERE to_user IN (SELECT id FROM users WHERE id='$_SESSION[user_id]') ORDER BY message_id DESC LIMIT 0, 10") or die(mysql_error());
$num_messages = mysql_num_rows($get_messages);
// display each message title, with a link to their content
echo '<ul>';
for($count = 1; $count <= $num_messages; $count++)
{
$row = mysql_fetch_array($get_messages2);
echo "<table width='100%' border='0' bgcolor='#E4E4E4'>";
//if the message is not read, show "(new)" after the title, else, just show the title.
echo '<tr>';
echo '<td width="5%" rowspan="3">' . $row['imagelocation'] . '</td>';
echo '<td width="10%">Title: <b></td>';
echo '<td width="85%"><a href="read_message.php?messageid=' . $row['message_id'] . '">' . $row['message_title'] . '</a></b></td>';
echo '</tr>';
echo '<tr>';
echo '<td>From: <b></td>';
echo '<td>' . $row['from_user'] . '</b></td>';
echo '</tr>';
echo '<tr>';
echo '<td>Text: <b></td>';
echo '<td>' . $row['message_contents'] . '</b></td>';
echo '</tr>';
echo '<tr><td><input type="checkbox" name="messageTick" id="' . $row['message_id'] . '" /></td><td colspan="2"><div class="date">Sent '.$row['message_date'] .' at '.$row['message_time'] .'</b></div></td></tr>';
}
echo '</table>';
echo '</ul>';
echo '<form action="new_message.php">';
echo '<span class="art-button-wrapper">';
echo '<span class="l"> </span>';
echo '<span class="r"> </span>';
echo '<input class="art-button" type="submit" value="New Message"/>';
echo '</span>';
echo '</form>';
echo '<form action="inbox.php">';
echo '<span class="art-button-wrapper">';
echo '<span class="l"> </span>';
echo '<span class="r"> </span>';
echo '<input class="art-button" type="submit" value="Refresh"/>';
echo '</span>';
echo '</form>';
?>
</form>
//ID from tick boxs in Form for each message. ( I think )
$messageid = $POST['id'];
//ID from tick boxs in Form for each message. ( I think )
$messageid = $_POST['id'];
<form action="<?php echo basename($_SERVER['SCRIPT_NAME']); ?>" method="post">
if ($Read){
$query = mysql_query("UPDATE messages SET message_read = '1' WHERE id = '$messageid'");
exit;
}