[FREE] IPB 4 Fusion CMS Bridge
PHP Code:
<?php
class Ipb4 extends Plugin
{
private $username;
private $password;
private $email;
private $db;
public function register($username, $password, $email)
{
$this->username = $username;
$this->password = $password;
$this->email = $email;
$this->db = $this->CI->load->database($this->CI->config->item('bridge'), TRUE);
$this->process();
}
private function process()
{
$salt = $this->generatePasswordSalt(5);
$salt = str_replace( '\\', "\\\\", $salt );
$password = $this->encryptPassword($salt);
$key = $this->generateAutoLoginKey();
$expire = time() + 86400;
$this->db->query("INSERT INTO ".$this->CI->config->item('forum_table_prefix').
"core_members(`name`, `member_group_id`, `email`, `joined`, `member_login_key`, `members_pass_hash`, `members_pass_salt`, `member_login_key_expire`, `members_seo_name`)
VALUES(?, '3', ?, ?, ?, ?, ?, ?, ?)",
array($this->username, $this->email, time(), $key, $password, $salt, $expire, $this->username));
}
private function encryptPassword($salt)
{
return md5( md5($salt) . md5( $this->password ) );
}
private function generateAutoLoginKey( $len=60 )
{
$pass = $this->generatePasswordSalt( $len );
return md5($pass);
}
private function generatePasswordSalt($len=5)
{
$salt = '';
for ( $i = 0; $i < $len; $i++ )
{
$num = mt_rand(33, 126);
if ( $num == '92' )
{
$num = 93;
}
$salt .= chr( $num );
}
return $salt;
}
}
Create a new file with this code under : /var/www/html/application/modules/register/plugins (Or you path to the plugins folder)
After done this go to this file : /var/www/html/application/modules/register/config/bridge.php (Or you path to the plugins folder) and enter your forum config details ...
PHP Code:
<?php
$config['use_forum_bridge'] = false;
/**
* Default support:
* phpbb, ipb, smf, mybb
*/
$config['forum_bridge'] = "phpbb, ipb, ipb4, smf or mybb";
$config['forum_table_prefix'] = "phpbb_";
$config['bridge']['hostname'] = "127.0.0.1";
$config['bridge']['username'] = "root";
$config['bridge']['password'] = "";
$config['bridge']['database'] = "phpbb";
$config['bridge']['dbdriver'] = "mysqli";
$config['bridge']['dbprefix'] = "";
$config['bridge']['pconnect'] = TRUE;
$config['bridge']['db_debug'] = TRUE;
$config['bridge']['cache_on'] = FALSE;
$config['bridge']['cachedir'] = "";
$config['bridge']['char_set'] = "utf8";
$config['bridge']['dbcollat'] = "utf8_general_ci";
$config['bridge']['swap_pre'] = "";
$config['bridge']['autoinit'] = TRUE;
$config['bridge']['stricton'] = FALSE;
Quote:
Originally Posted by CoC
it must be named to ipb4 because we name the php file php4.php and inside the calass is named as Ipb4 !!!
After you have setup this, now you can close extra registrations in your forum, the cms will do it for you :) i cannot give any support, becuse i modded my cms and my codeingniter...
Originally posted by CoC