Jump to content

IPB Forum & PHP


.:HyPeX:.

Recommended Posts

Hello everyone i'm doing a login panel to include IPB forum.

This has been over seen lots of times, and i've only got one problem.

What are the IPB functions aviable?

I've already readed fatalterror's tutorial and QuantumZ's tutorialonly covered how to register accounts, not how to load them, or add any data to them.

I was told to use IPB's functions to all this. (I could already manage to get things working arround).

If anyone was kind enought to tell me wich are the functions i'd need to do a member login, get its user ID (in the forum), and save/restore data from its account, and its arguments, i'd be totally gratefull.

Greeetz

Link to comment

Okay, so now i got a problem, i could get to advance a little bit, searching arround:

http://www.invisionpower.com/support/gu ... odules-r42

But, i got a problem, it is not working as it should.

http://www.emp-clan.eu/hypexlogin.php

Parse error: syntax error, unexpected '[', expecting ')' in /data/web/virtuals/69588/virtual/www/hypexlogin.php on line 88

This is the php code

  
<?php 
require( "initdata.php"); 
require( "hypexmta/sdk/mta_sdk.php" ); 
require( "admin/sources/base/ipsRegistry.php" ); 
require( "admin/sources/loginauth/login_core.php" ); 
require( "admin/sources/loginauth/interface_login.php" ); 
ipsRegistry::init(); 
  
$table = mta::getInput(); 
$text = $table[1]; 
if(isset($text)){ 
 $returning = authenticate("hypex", "", "atrevidos"); 
 mta::doReturn($returning); 
} 
  
class login_test extends login_core implements interface_login 
{ 
    /** 
     * Properties passed from database entry for this method 
     * 
     * @param  array 
     */ 
    protected $method_config    = array(); 
  
    /** 
     * Properties passed from conf.php for this method 
     * 
     * @param  array 
     */ 
    protected $external_conf    = array(); 
  
    /** 
     * Constructor 
     * 
     * @param  object  ipsRegistry object 
     * @param  array   DB entry array 
     * @param  array   conf.php array 
     * @return void 
     */ 
    public function __construct( ipsRegistry $registry, $method, $conf=array() ) 
    { 
        $this->method_config    = $method; 
        $this->external_conf    = $conf;     
  
        parent::__construct( $registry ); 
    } 
  
    /** 
     * Authenticate the member against your own system 
     * 
     * @param   string  Username 
     * @param   string  Email Address 
     * @param   string  Plain text password entered from log in form 
     * @return  bool 
     */ 
    public function authenticate( $username, $email_address, $password ) 
    { 
        /* Depending on your type of auth, username or email address will be blank 
           For this example, we'll only accept email address log in and this will 
           be set from the Admin CP.*/ 
  
        /* We assume that myDB is a static class that interfaces with your own 
           database systems */ 
  
        $member = myDB::query("select id, userName, emailAddress from myMembers where emailAddress='$email_address'"); 
  
        if ( ! $member['id'] ) 
        { 
            $this->return_code = 'NO_USER'; 
            return false; 
        } 
  
        if ( md5( $password ) != $member['md5Password'] ) 
        { 
            $this->return_code = 'WRONG_AUTH'; 
            return false; 
        } 
  
        if ( $member['id'] ) 
        { 
            $this->return_code = 'SUCCESS'; 
  
            /* We must populate $this->member_data if we find a matching user. 
               If we do not have one, one must be created like so */ 
  
            /* Test locally */ 
            $localMember = IPSMember::load( $member['emailAddress'] ); 
  
            if ( $localMember['member_id'] ) 
            { 
                $this->member_data = $localMember; 
            } 
            else 
            { 
                $this->member_data = $this->createLocalMember( array( 'members' => array( 'name' => $member['userName'], 'password' => $password, 'email' => $mem-ber['emailAddress'] ) ) ); 
            } 
  
            return true; 
        } 
  
        return false; 
    } 
} 
?> 

it is funny, becouse the exact code given by IPB fails to load...

Link to comment
  • Administrators

I'm not familiar with IPB, but did you try to remove the [ ] on line 88?

$localMember = IPSMember::load( $member ); 

Maybe something like this?

$localMember = IPSMember::load( $member ); 
$localMemMail = $localMember['emailAddress']; 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...