Skip to content

Commit

Permalink
test comment again
Browse files Browse the repository at this point in the history
  • Loading branch information
abourque72 committed Jan 16, 2024
1 parent 9bdc8b9 commit 1445f2d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/_layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ <h1>Post a comment</h1>
var comtext = document.getElementById("commentmsg").value;

// Construct URL with parameters
var url = "{{site.url}}/commentsubmitcopy.php";
url += "?compostid=" + encodeURIComponent(compostid);
var url = "{{site.url}}/process_comment.html";
url += "?post_id=" + encodeURIComponent(compostid);
url += "&comreturnurl=" + encodeURIComponent(comreturnurl);
url += "&comname=" + encodeURIComponent(comname);
url += "&comtext=" + encodeURIComponent(comtext);
url += "&name=" + encodeURIComponent(comname);
url += "&comment=" + encodeURIComponent(comtext);

location.href = url;
}
Expand Down
43 changes: 43 additions & 0 deletions docs/process_comment.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
layout: default
---

<h1>Processing Comment...</h1>

<?php

// code modified from https://github.com/mpalmer/jekyll-static-comments

$DATE_FORMAT = "Y-m-d H:i";

$EMAIL_ADDRESS = "[email protected]";

$SUBJECT = "Blog comment received";

$msg = "date: " . date($DATE_FORMAT) . "\n";

foreach ($_GET as $key => $value) {
if (strstr($value, "\n") != "") {
$value = str_replace("\n", "\n ", $value);
}
$value = "'" . str_replace("'", "''", $value) . "'";
$msg .= "$key: $value\n";
}

if (mail($EMAIL_ADDRESS, $SUBJECT, $msg))
{
echo '<h1>Comment Received!</h1>';
echo '<p>Thank you for your comment. It will be reviewed and published shortly.</p>'
$return_url = $_GET['comreturnurl'];
$return_delay = 5; //Number of seconds
echo "<meta http-equiv=\"refresh\" content=\"$return_delay;url='$return_url'\" />";
echo '<p>You will be redirected to the original post in 5 seconds. Click the link below if you are not redirected automatically.</p>';
echo '<p><a href="'.$return_url.'">'.$return_url.'</a></p>';
}
else
{
echo '<h1>Error!</h1>'
echo '<p>There was a problem sending the comment. Please contact the site's owner.</p>';
}

?>

0 comments on commit 1445f2d

Please sign in to comment.