Error: ensure that the class "API_USER" was loaded

Discussion in 'Integration' started by jpokress, Aug 18, 2008.

  1. jpokress

    jpokress New Member

    Joined:
    Aug 18, 2008
    Messages:
    7
    Hi everyone,

    I'm trying to integrate amember with my website (which on a third-party engine) -- specifically, I'm trying to embed a login form into my existing site.

    The amember documentation at http://manual.amember.com/Integrating_aMember_Pro_with_website) says to add the following code to my "page", which I did.


    <?php session_start(); ?>
    <?php
    if ($au=$_SESSION['_amember_user']){ // user is logged-in
    print "Hello $au[name_f] $au[name_l]!<br>";
    print "<a href='/amember/logout.php'>Logout</a>";
    } else { // user is not logged-in
    print "<form method=post action='/amember/login.php'>
    Username: <input type=text name=amember_login size=10><br>
    Password: <input type=password name=amember_pass size=10><br>
    <input type=submit value='Login'>
    </form>";
    }
    ?>

    I'm getting the following two errors, however:

    Notice: A session had already been started - ignoring session_start() in E:\hosting\member\jpokress\production\wislabs\okb\i\k\init.php on line 273

    Notice: AKB_AUTH::IsLoggedIn() [function.AKB-AUTH-IsLoggedIn]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "API_USER" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in E:\hosting\member\jpokress\production\wislabs\okb\i\k\includes\classes\class.auth.php on line 94


    The first one, ok no biggie. Evidently the application I'm embedding this in already called it somewhere in the chain of processing.

    But the second one has me stumped.

    Any ideas?
  2. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    sorry for stating an obvious question, what is class.auth.php in your \includes\classes directory?

    Have you tried amember on a static php file or tried commenting out any other session/auth code from your site?
  3. jpokress

    jpokress New Member

    Joined:
    Aug 18, 2008
    Messages:
    7
    It works

    Actually, astonishingly, when I removed the session_start() line, all the errors disappeared. Guess I should have tried this first : )
  4. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    that is great news.

Share This Page