Plogger Support Forum - Comments not working correctly Thu, 28 Mar 2024 23:20:39 +0000 http://www.plogger.org/forum/ Lussumo Vanilla 1.1.10 Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11167#Comment_11167 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11167#Comment_11167 Thu, 30 Jul 2009 15:21:12 +0000 joshua.s.belanger
http://northlakesfireandrescue.org/beta/pics/?level=picture&id=40

It will work fine. But I use my embeded page like:

http://www.northlakesfireandrescue.org/beta/photos.php?level=picture&id=40

It errors out with:

Notice: Undefined index: plogger-token in C:\sites\accounts\northlakesfire\northlakesfireandrescue.org\www\beta\pics\plog-comment.php on line 52

Warning: Cannot modify header information - headers already sent by (output started at C:\sites\accounts\northlakesfire\northlakesfireandrescue.org\www\beta\pics\plog-comment.php:52) in C:\sites\accounts\northlakesfire\northlakesfireandrescue.org\www\beta\pics\plog-comment.php on line 147

Can someone help with this please? Atleast let me know if it is something to do with my PHP setup.]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11169#Comment_11169 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11169#Comment_11169 Thu, 30 Jul 2009 15:40:53 +0000 sidtheduck
What is the code for your page http://www.northlakesfireandrescue.org/beta/photos.php? Can you post it here please?]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11170#Comment_11170 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11170#Comment_11170 Thu, 30 Jul 2009 15:48:38 +0000 joshua.s.belanger <?php require("pics/gallery.php"); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php the_plogger_head(); ?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="style.css" rel="stylesheet" type="text/css" />
<title>North Lakes Fire & Rescue</title>
</head>

<body>
<div id="container">
<div id="header">
<ul>
<li><?php include 'links.xml';?></li>
</ul>
</div>
<div id="content">
<div id="left_noright">
<?php the_plogger_gallery(); ?>
</div>
<div id="footerline">
</div>
</div>
<?php include 'footer.php';?>
</div>
</body>
</html>]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11171#Comment_11171 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11171#Comment_11171 Thu, 30 Jul 2009 15:55:07 +0000 sidtheduck <?php require("pics/gallery.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


Plogger cannot start the session for session the spam token session variable if there is any output before it is called (i.e. your doctype declaration output stops the session from being created).]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11176#Comment_11176 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11176#Comment_11176 Thu, 30 Jul 2009 16:07:49 +0000 joshua.s.belanger
I even completely deleted everything from my page but the plogger stuff...

<?php require("pics/gallery.php"); ?>
<html>
<head>
<?php the_plogger_head(); ?>
</head>

<body>
<?php the_plogger_gallery(); ?>
</body>
</html>


and I still get the same error. I can also go into the plog-functions to plogger_get_form_token and change this line:
return '<input type="hidden" name="plogger-token" value="'.$token.'" />'."\n";
to
return '<input type="text" name="plogger-token" value="'.$token.'" />'."\n";

and I see a token being generated. It's like it doesn't know how to get the variable for some reason when it asks for plogger-token.]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11181#Comment_11181 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11181#Comment_11181 Thu, 30 Jul 2009 19:33:59 +0000 sidtheduck
However, I was able to get it to work correctly by opening plog-globals.php and adding the session_name('Plogger') code as seen below (should be around lines 37-44(5)):
// Start the session
if (!headers_sent() && !session_id()) {
// Set the session.save_path if user defined in plog-config
if (defined('PLOGGER_SESSION_SAVE_PATH') && PLOGGER_SESSION_SAVE_PATH != '') {
session_save_path(PLOGGER_SESSION_SAVE_PATH);
}
session_name('Plogger');
session_start();
}


ETA: Here's another code that also seems to work by defining the session.cookie_domain (which may be better than session_name) and only falls back on the generic session_name if the $_SERVER['SERVER_NAME'] variable is not set:
// Start the session
if (!headers_sent() && !session_id()) {
// Set the session.save_path if user defined in plog-config
if (defined('PLOGGER_SESSION_SAVE_PATH') && PLOGGER_SESSION_SAVE_PATH != '') {
session_save_path(PLOGGER_SESSION_SAVE_PATH);
}
// Set the session.cookie_domain if not already set
if (!ini_get('session.cookie_domain')) {
// To clear up any embed issues we set the cookie domain to the SERVER_NAME (if set)
if (isset($_SERVER['SERVER_NAME'])) {
$server_name = @ini_set("session.cookie_domain", $_SERVER['SERVER_NAME']);
} else {
$server_name = false;
}
// Otherwise, we just create a generic session name
if ($server_name === false) {
session_name('Plogger');
}
}
session_start();
}
]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11188#Comment_11188 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11188#Comment_11188 Fri, 31 Jul 2009 13:45:33 +0000 joshua.s.belanger Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11189#Comment_11189 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11189#Comment_11189 Fri, 31 Jul 2009 15:36:28 +0000 sidtheduck // Start the session
if (!headers_sent() && !session_id()) {
// Set the session.save_path if user defined in plog-config
if (defined('PLOGGER_SESSION_SAVE_PATH') && PLOGGER_SESSION_SAVE_PATH != '') {
session_save_path(PLOGGER_SESSION_SAVE_PATH);
}
ini_set('session.cookie_domain', '.northlakesfireandrescue.org');
session_start();
}


Let me know if that's still causing issues.]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11190#Comment_11190 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11190#Comment_11190 Fri, 31 Jul 2009 15:43:23 +0000 joshua.s.belanger
I cheated it. In plog-comments I deleted:
if (isset($_POST['plogger-token']) && $_POST['plogger-token'] === $_SESSION['plogger-token']) {

along with the end bracket and the else statement:
} else {
// Missing form token
$errors = array(plog_tr('Spam token missing or does not match!'));
}


This allows me to post comments. I have the comments set to admin approve only so spam in the comments won't be a issue, I will just have to sort it out in the approve thing. The last thing I had to do was to fix the redirect so it would go back to my photos.php. I did that by changing the last line:
header('Location: '.$redirect);
to
header('Location: http://www.northlakesfireandrescue.org/beta/photos.php?level=picture&id='.$parent_id);]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11191#Comment_11191 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11191#Comment_11191 Fri, 31 Jul 2009 18:32:55 +0000 sidtheduck
Also, if you want to redirect back to the same page, you can hard-code that in or you can use a hidden redirect input (see the example themes included in Plogger). Those should work to redirect back to the page you were commenting on.]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11202#Comment_11202 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11202#Comment_11202 Sun, 02 Aug 2009 12:53:20 +0000 supertelugu me too facing problems with posting comments in my gallery..
when i try to post a comment error displays 'Comment did not post! Please fill in required fields.'(even though i filled all the fields)
i changed it from moderated to public but no use.
i also changed code in plog-globals.php and added session name but still not working

url of my gallery http://www.supertelugu.com/gallery/

waiting for ur help]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11211#Comment_11211 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11211#Comment_11211 Tue, 04 Aug 2009 01:18:07 +0000 sidtheduck
// Start the session
if (!headers_sent() && !session_id()) {
// Set the session.save_path if user defined in plog-config
if (defined('PLOGGER_SESSION_SAVE_PATH') && PLOGGER_SESSION_SAVE_PATH != '') {
session_save_path(PLOGGER_SESSION_SAVE_PATH);
}
session_name('Plogger');
session_set_cookie_params(0, '\', $_SERVER['SERVER_NAME']);
session_start();
}
]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11219#Comment_11219 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11219#Comment_11219 Tue, 04 Aug 2009 14:30:54 +0000 sidtheduck Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11223#Comment_11223 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11223#Comment_11223 Tue, 04 Aug 2009 16:51:43 +0000 Nanflexal
pleaase take a look. Thanks
http://picture.adamos.org/plog-comment.php?level=picture&id=0]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11224#Comment_11224 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11224#Comment_11224 Tue, 04 Aug 2009 16:57:58 +0000 sidtheduck
It looks like you are missing the code <?php echo plogger_get_form_token(); ?> from your comments.php file. You need to include this between the <form> and </form> elements if you are upgrading and using an old theme file (this is displayed if you go to your Admin -> Themes tab). This should clear things up for you.

Also, if you are using an old theme that has the whole comment form code wrapped in quotes with a "print" function before it, you will need to add '.plogger_get_form_token().' instead (assuming that the quotes are single quotes and not double quotes).

An example from the old default theme comments.php file should look like this:
print '<a name="comment-post"></a><h2 class="comment-heading">Post a comment:</h2>
<form action="' . $config["gallery_url"] . 'plog-comment.php" method="post" id="commentform">
<p>
<input type="text" name="author" id="author" class="textarea" value="" size="28" tabindex="1" />
<label for="author">Name</label> (required) <input type="hidden" name="comment_post_ID" value="40" />
<input type="hidden" name="parent" value="'.plogger_get_picture_id().'" />
</p>
<p>
<input type="text" name="email" id="email" value="" size="28" tabindex="2" />
<label for="email">E-mail</label> (required, but not publicly displayed)
</p>
<p>
<input type="text" name="url" id="url" value="" size="28" tabindex="3" />
<label for="url">Your Website (optional)</label>
</p>
<p>
<label for="comment">Your Comment</label>
<br /><textarea name="comment" id="comment" cols="70" rows="4" tabindex="4"></textarea>
</p>
<p>
<input class="submit" name="submit" type="submit" tabindex="5" value="Post Comment!" />
</p>
'.plogger_get_form_token().'
</form>';
]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11372#Comment_11372 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11372#Comment_11372 Tue, 15 Sep 2009 18:28:55 +0000 becket
I have the same problem on http://www.gdvteam.com/motos/galeries.php?level=picture&id=12.

I have tried change the start session part, but nothing change (now plog-global.php is back to default).

Thank you for your help !!

ps: I use winrar.]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11549#Comment_11549 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=11549#Comment_11549 Thu, 22 Oct 2009 18:11:57 +0000 sidtheduck Posted By: sidtheduckOkay, I just tested on my server and received the same error. The only thing I can think of is that the session_start is being called from different locations on the server (the first from the root folder with photos.php and the second from plog-comment.php). I don't know why this is an issue as I swear I've used this in scripts in the past.I think I finally have a solution to this. I was running into issues within an embedded gallery, but only ON THE FIRST ATTEMPT. After I received the error, I was able to successfully post a comment.

The reason I found was the redirect rules in the Plogger .htaccess, most notably forcing a trailing slash and/or the leading 'www'. I was accessing the indexed page as http://mysite.com/embed-test.php which was then being sent to http://mysite.com/plogger/plog-comment.php to process the comment form. However, the redirect rules came into effect then and redirected to http://www.mysite.com/plogger/plog-comment.php which reset the session ID since PHP thinks www.mysite.com and mysite.com are different domains (one with www. and the other without). Because it resets the session_id, there is no form_token session variable anymore and throws an error. It works the second time, because plog-comment.php redirects back to the image page with the leading 'www.' added, so it works when you send the form again.

Moral of the story, do 1 of 3 things:
1. Make sure all of your links to embedded galleries match the domain structure (www or non-www) that is set in your Admin -> Options -> Gallery URL setting.
2. Have the 'www' and/or trailing slash forced in your root directory .htaccess file, not just in the Plogger directory.
3. Completely remove the 'www' and/or trailing slash rewrite rules in your Plogger .htaccess file (you will most likely have to change your permissions on your .htaccess file to read only as saving any Admin -> Options will rewrite the rules if the .htaccess has write access).

Hope that helps some people!]]>
Comments not working correctly http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=14023#Comment_14023 http://www.plogger.org/forum/comments.php?DiscussionID=2814&Focus=14023#Comment_14023 Tue, 04 Oct 2011 01:40:45 +0000 inters0911 diseņo web navarra]]>