Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

  1.  
    I am having a weird issue. If I try to post a comment from the plogger page:

    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.
    •  
      CommentAuthorsidtheduck
    • CommentTimeJul 30th 2009
     
    joshua,

    What is the code for your page http://www.northlakesfireandrescue.org/beta/photos.php? Can you post it here please?
    Thankful People: joshua.s.belanger
  2.  
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <?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>
    •  
      CommentAuthorsidtheduck
    • CommentTimeJul 30th 2009
     
    Your first two lines should be switched:
    <?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).
  3.  
    Didn't help :/

    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.
    •  
      CommentAuthorsidtheduck
    • CommentTimeJul 30th 2009 edited
     
    Okay, 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.

    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();
    }
  4.  
    Well, still not working. I tried both things. Do I need to also change something else?
    •  
      CommentAuthorsidtheduck
    • CommentTimeJul 31st 2009
     
    You can try hard-coding it in like this:
    // 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.
  5.  
    Still nothing.

    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);
    •  
      CommentAuthorsidtheduck
    • CommentTimeJul 31st 2009
     
    That works too! :D However, just to let you know that was in place to keep spammers from flooding your comments by submitting a form not located on your server.

    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.
    • CommentAuthorsupertelugu
    • CommentTimeAug 2nd 2009 edited
     
    Hello sid
    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
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 4th 2009
     
    Alright, this may work, so I'll need some other people willing to test (hopefully some of you can help me out). It works on my server, but so does just declaring the session_name().

    // 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();
    }
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 4th 2009
     
    Just to double-check as well, what .zip extraction software are you using after downloading the SVN trunk? WinZip? WinRAR? 7-ZIP? Built-in Windows .ZIP extractor?
    • CommentAuthorNanflexal
    • CommentTimeAug 4th 2009
     
    i have the same problem, i can't add comment

    pleaase take a look. Thanks
    http://picture.adamos.org/plog-comment.php?level=picture&id=0
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 4th 2009 edited
     
    Nanflexal,

    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>';
    • CommentAuthorbecket
    • CommentTimeSep 15th 2009
     
    Hi sidtheduck !

    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.
    •  
      CommentAuthorsidtheduck
    • CommentTimeOct 22nd 2009 edited
     
    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!
  6.  
    If anyone get the solution for the above issue.let me know also.please..diseņo web navarra