Reply Messages
Posted: Mon Oct 14, 2013 10:08 pm
Okay, I have copied the send message information in order to try and figure out how to make a reply. I have the reply button there, and it shows the form to reply to the user, but the subject isn't the same subject in the field when you hit reply. It's the very first message subject that you have in your inbox. So it's not selecting the subject of the inbox you are wanting to reply to. I tried using some Get commands, which I do believe I will need to get the information from the read mail, but can't get it figured out. Below is the code for reading the message and replying to the message. Any help would be awesome
Thx!!!
Where you read the message:
Where I have started the Reply Information:
Where you read the message:
Code: Select all
<?php
if(isset($_POST['readmessage'])) {
$bypass = 1;
$randid = $_POST['randid'];
$date = $_POST['date'];
$updatemessage = "UPDATE messages SET readm='0' WHERE pid='$users_username' AND date='$date' AND randid='$randid'";
$user_query = mysqli_query($db_conx, $updatemessage);
$messageinfo = "SELECT * FROM messages where pid='$users_username' AND date='$date' AND randid='$randid'";
$user_query1 = mysqli_query($db_conx, $messageinfo);
$messageinfo3=mysqli_fetch_array($user_query1);
$messageinfo3['message'] = nl2br(preg_replace('#(\\]{1})(\\s?)\\n#Usi', ']', stripslashes($messageinfo3['message'])));
echo "<b><font color='lime'>Subject: " . $messageinfo3['subject'] . "<br><br></b>From: " . $messageinfo3['sender'] . " " . $messageinfo3['date'] . "<br><br>";
echo " " . $messageinfo3['message'] . "<br><br><br>";
echo "<center><form method='post' action='messages.php'><input type='submit' value='Reply'></center><input type='hidden' name='reply' value='1'></form>";
echo "<br>";
echo "<center><form method='post' action='messages.php'><input type='submit' value='Delete'></center>
<input type='hidden' name='deletemessage' value='1'>
<input type='hidden' name='randid' value='$messageinfo3[randid]'>
<input type='hidden' name='date' value='$messageinfo3[date]'>
</form>";
echo "<center><form method='post' action='messages.php'><input type='submit' value='Back to Inbox'>
<input type='hidden' name='messages' value='1'>
</form>";
}
Code: Select all
<?php
if(isset($_POST['reply'])) {
$bypass = 1;
if($bypass != 1)
{
$message = protect($_POST["message"], ENT_QUOTES);
$subject = protect($_POST["subject"], ENT_QUOTES);
$sendto = protect($_POST["sendto"], ENT_QUOTES);
$randid = rand(999,9999999);
$sql = "INSERT INTO `messages` (`pid`,`sender`,`message`,`subject`,`randid`) VALUES ('".$sendto."','".$users_username."','".$message."','".$subject."','".$randid."')";
$user_query3 = mysqli_query($db_conx, $sql);
echo "Message Sent";
}
$messageinfo = "SELECT * FROM messages where pid='$users_username' ";
$user_query1 = mysqli_query($db_conx, $messageinfo);
$messageinfo3=mysqli_fetch_array($user_query1);
echo "<div style='width:600px'>";
echo "<br><form method ='post' action = 'messages.php'>";
echo "Send To: " . $messageinfo3['sender'] . "<input type = 'hidden' name = 'sendto' size = '25'>";
echo "</div>";
echo "<div>";
echo "Subject: " . $messageinfo3['subject'] . "<input type = 'hidden' name = 'subject' size = '25' maxlength='25'><br><br>";
echo "</div>";
echo "<div style='vertical-align: top';>";
echo "Content: <textarea onfocus='limitTextarea(this,20)' rows='15' cols='60' maxlength = '600' name = 'message'>";
echo "</textarea><br>";
echo "</div>";
echo "<input type = 'hidden' name = 'reply' value = '1'>";
echo " <input type = 'submit' name = 'reply' id = 'reply' value = 'Send Message'>";
echo "</form>";
}
?>