Skip to content

Commit

Permalink
Changed comment.php method to GET(for bookmarking that one comment)
Browse files Browse the repository at this point in the history
-To do list below:
update the security on passwords to hash
  • Loading branch information
hiimdoublej committed Jun 6, 2016
1 parent a58cff1 commit 2c57166
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
Binary file modified .DS_Store
Binary file not shown.
9 changes: 3 additions & 6 deletions comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@
}
}
echo "<br>";
if(isset($_POST['view_reply_parent']))
{
$_SESSION['view_reply_parent'] = $_POST['view_reply_parent'];
}
$parent_id = $_SESSION['view_reply_parent'];

$parent_id = $_GET["m_id"];
if(isset($_POST['submit_comment']))
{
if($_POST['comment']!='')
Expand Down Expand Up @@ -91,7 +88,7 @@
//display the parent message
$sql_select = "SELECT msg_id,msg, username,msg_time,uid
FROM messages, users
WHERE messages.uid = users.user_id AND messages.msg_id = $parent_id";
WHERE messages.msg_id = $parent_id AND messages.uid = users.user_id";
$res=$conn->prepare($sql_select);
$res->execute();
?>
Expand Down
14 changes: 7 additions & 7 deletions home.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,20 @@
ORDER BY cmt_time DESC ";
$num_of_replies = $conn->query($sql_count);
$num_result = $num_of_replies->fetch(PDO::FETCH_NUM)[0];
if($num_result%2==1|$num_result==0)
if($num_result<2)
{
echo "<td id='actions'>";
echo "<form action='comment.php' method='POST'>";
echo "<button type='submit' id='view_replies' name='view_reply_parent'
value=".$row->msg_id.">".$num_result." reply</button>";
echo "<form action='comment.php' method='GET'>";
echo "<button type='submit' id='view_replies' name='m_id'
value='".$row->msg_id."'>$num_result reply</button>";
echo "</form></td></tr>";
}
else
{
echo "<td id='actions'>";
echo "<form action='comment.php' method='POST'>";
echo "<button type='submit' id='view_replies' name='view_reply_parent'
value=".$row->msg_id.">".$num_result." replies</button>";
echo "<form action='comment.php' method='GET'>";
echo "<button type='submit' id='view_replies' name='m_id'
value='".$row->msg_id."'>$num_result replies</button>";
echo "</form></td></tr>";
}

Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ th#actions
}
th#replies
{
width:16em;
width:18em;
}

th:first-child {
Expand Down

0 comments on commit 2c57166

Please sign in to comment.