PHP Include bug

Discussion in 'Installation' started by js_thind, Jul 8, 2006.

  1. js_thind

    js_thind New Member

    Joined:
    Jun 19, 2006
    Messages:
    6
    Hello,

    I have added the following two line to the top of a script test.php . There is no other PHP code on the page.

    PHP:
    $_product_id = array('ONLY_LOGIN');
    include(
    "amember/plugins/protect/php_include/check.inc.php");
    When the page test.php is called, the script works correctly and displays a login form. I fill in the login details and submit the login form. Once logged in my test.php page is displayed.

    The aMember scripts work correctly til this point. However the script breaks down when I try to refresh the page.

    When the page is refereshed, the brower, understandably, displays the warning about reposting the form.

    If the form is reposted the following error is displayed:
    Session expired, please enter username and password again

    I am using aMember Pro on PHP 4-4.2, Apache 2.

    Someone please help me with this.

    Regards,
    Jatinder Singh Thind
  2. Sergei

    Sergei aMember Pro Customer

    Joined:
    Mar 6, 2006
    Messages:
    96
    It should look something like this:

    Code:
    <?php 
    $_product_id = array(1,3); // or $_product_id = array(1) if it so
    include("/home/public_html/plugins/protect/php_include/check.inc.php"); 
    
    .. your existing PHP code goes here
    ?>
    
  3. rob_mert

    rob_mert Guest

    I'm guessing you need to add session_start(); to the top of your test.php...

    EDIT: Never mind, I misread your post...
  4. js_thind

    js_thind New Member

    Joined:
    Jun 19, 2006
    Messages:
    6
    Although I didn't show the the <?php ?> tags in my post, they are there in code. I am familiar with PHP :)

    Like I mentioned in my question, the PHP script test.php page works perfectly except for that little issue about refershing the page.

    And test.php contains no other PHP except the two lines:
    PHP:
    <?php
    $_product_id 
    = array('ONLY_LOGIN');
    include(
    "amember/plugins/protect/php_include/check.inc.php");  
    ?>
    So it can't be an issue of my coding messing up the aMember functioning. I think this is definitely a bug in aMember.

    Regards,
    Jatinder Singh Thind
  5. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    It is not a bug. It is special protection against using "Back" buttons after "Logout".
    Why do you need to refresh page? Try to add special "Refresh" link or a button to the page, so user does not need press "Refresh" in the browser.
  6. js_thind

    js_thind New Member

    Joined:
    Jun 19, 2006
    Messages:
    6
    Hello Alex,

    Thanks for the explanation.

    I have no specific reason for refreshing the page. I am implementing aMember for a client. You never know what site visitors might do. So I was trying out a couple of things that I thought normal visitors might do when I found the issue about page refreshing.
  7. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    It only happens with page where user logged-in. If he clicks refresh on any other page, it won't happen.
    To be honest, implemented behaviour never caused any questions or problems.

    When it has not been implemented, anybody can press "Back" several times after logout, and be logged-in again, and it casued LOT of questions :)

Share This Page