Class Declarations

Discussion in 'Troubleshooting' started by Nick Taylor, Sep 14, 2003.

  1. Nick Taylor

    Nick Taylor Guest

    Hi.

    I've just run into a small problemette - in that Amember uses a class db, and so does the CMS I'm trying to integrate it with - it gives a "cannot redeclare class" error.

    I thought maybe I could combine the funtions from one class and the another but there's the function
    function db(& $config){
    which needs a parameter passed to it (when passing by ref it appears that you can't use defaults like, for example function db(& $config=0). This means that every single instance of the class in the CMS (there are hundreds of them) will need a null variable passed to it. I guess I could do a global search and replace but this is seriously altering the CMS code.

    Any ideas?


    rgds


    Nick
  2. alex-adm

    alex-adm Guest

    May be it is possible to don't include aMember code inside your CMS? Or, you can use lite.inc.php include (exists in aMember Pro version only).
  3. Guest

    Guest Guest

    Apparently I need to include

    check.inc.php

    to protect certain areas - this includes the db class. I have the pro version. What does lite.inc.php do? How do I use it?



    n
  4. alex-adm

    alex-adm Guest

    it can be used like:

    Code:
    require '/web/site/amember/lite.inc.php';
    
    if (!amember_login_user(
             $_POST['username'] ? $_POST['username'] : $_SESSION['_amember_login'], 
             $_POST['password'] ? $_POST['password'] : $_SESSION['_amember_pass'] )){
        display_login_form(); /// must be defined in your code below !
        exit(); 
    } else {
        // get products which this user is subscribed for
        $products = amember_get_products($_POST['username'] ? $_POST['username'] : $_SESSION['_amember_login']); 
    
        if (!$products[1]) { // 1 here is id of product which you require
             die("You have not subscribed to product #1");
        }
        //// user is successfully logged-in here
    }
    
    
    

Share This Page