Skip to content

Commit

Permalink
Fixed a bug where can't post replies to messages
Browse files Browse the repository at this point in the history
-Temporary fix, not the most optimal
(I stored the variable to $_SESSION but the way I want it is to pass the message id
throught the url so that the url stays consitent for bookmarking purposes.)
  • Loading branch information
hiimdoublej committed Jun 6, 2016
1 parent 2c57166 commit 2009bf4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions comment.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<?php
date_default_timezone_set("Asia/Taipei");
include_once 'header.php';

if(isset($_GET["m_id"]))
{
$parent_id = $_GET["m_id"];
$_SESSION['m_id'] = $parent_id;
}
else
{
$parent_id = $_SESSION['m_id'];
}

if(isset($_POST["delete_msg"]))//deleting message part
{
if($_POST["delete_msg"]=="delete")
Expand Down Expand Up @@ -50,7 +61,6 @@
}
echo "<br>";

$parent_id = $_GET["m_id"];
if(isset($_POST['submit_comment']))
{
if($_POST['comment']!='')
Expand Down Expand Up @@ -185,9 +195,8 @@
?>
<form action="comment.php" method="POST">
<input type="hidden" name="submit_comment" value="1" />
<?php echo "<input type='hidden' name='view_reply_parent' value=".$_SESSION['view_reply_parent'].">"; ?>
<?php echo "<input type='hidden' name='m_id' value=".$parent_id.">"; ?>
<textarea name="comment" id = 'msg'></textarea><br />
<button type="submit" id ='msg_submit'>Submit reply to this message</button>
</form>
<br>
<a href="home.php" id="back_to_home">Go Back</a>

0 comments on commit 2009bf4

Please sign in to comment.