I will pay 40$ max for this simple upgrade.
I currently have user registrations and logins integrated on my site with phpbb2. I am looking for an individual to upgrade this script to function with phpbb3. Please do not bid if you do not have previous experience, I would like to have this completed as soon as possible. The following is the script I am currently using to integrate the phpbb2 registration.
<?PHP
// Contribs: Richard Munroe, Tony Fugere
class phpbb
{
public function __construct($patch)
{
global $db;
$this->patch = $patch;
}
public function check_login()
{
global $db, $lang, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
require_once($this->patch.'/[login to view URL]');
define('IN_PHPBB',true);
$phpbb_root_path = $this->patch;
require_once( $phpbb_root_path . "extension.inc" );
require_once( $phpbb_root_path . "common.php" );
$cok = $board_config[ "cookie_name" ].'_data';
$x = stripslashes($_COOKIE[$cok]);
$x = unserialize($x);
IF(is_array($x) and $x['userid'] != -1)
{
return true;
}
else
{
return false;
}
}
public function logout()
{
global $db, $lang, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
echo $SID;
$session_id = $SID;
require_once($this->patch.'/[login to view URL]');
define('IN_PHPBB',true);
$phpbb_root_path = $this->patch;
require_once( $phpbb_root_path . "extension.inc" );
require_once( $phpbb_root_path . "common.php" );
$x = $HTTP_COOKIE_VARS['phpbb2mysql_data'];
$x = unserialize(stripslashes($x));
$phpbb_user_id = $x['userid'];
session_end( $session_id, $phpbb_user_id );
setcookie( $board_config[ "cookie_name" ] . "_sid", "", time() - 3600, " " );
setcookie( $board_config[ "cookie_name" ] . "_mysql", "", time() - 3600, " " );
}
public function login($login, $pass)
{
global $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
require_once($this->patch.'/[login to view URL]');
define('IN_PHPBB',true);
define("IN_LOGIN", true);
$phpbb_root_path = $this->patch;
require_once( $this->patch . "extension.inc" );
require_once( $this->patch . "common.php" );
$sql = "SELECT user_id FROM " . USERS_TABLE . " WHERE username = '" . str_replace("'", "''", $login) . "' AND user_password = '".md5($pass)."'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
IF(isset($row['user_id']))
{
return session_begin( $row['user_id'], $user_ip, PAGE_INDEX, FALSE, TRUE );
}
else
{
return false;
}
}
public function register($login, $pass, $email, $useractive = 1)
{
global $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
//global $config;
require_once($this->patch.'/[login to view URL]');
//echo $this->patch;
define('IN_PHPBB',true);
define("IN_LOGIN", true);
$phpbb_root_path = $this->patch;
require_once( $this->patch . "/extension.inc" );
require_once( $this->patch . "/common.php" );
$sql = "SELECT user_id FROM " . USERS_TABLE . " ORDER BY user_id DESC LIMIT 1";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$id = $row['user_id'] + 1;
$pass = md5($pass) ;
$sql = "INSERT INTO " .USERS_TABLE ." (user_id, user_active, username, user_password, user_email) " ." VALUES (" .""$id", " .""$useractive", " .""$login", " .""$pass", " .""$email")" ;
$db->sql_query($sql) ;
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending) VALUES ('".$id."', '".$id."', 0)";
$db->sql_query($sql);
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_type, group_description, group_moderator, group_single_user) VALUES ('".$id."', 1, 'Personal User', 0, 1)";
$db->sql_query($sql);
}
public function recoverpass($login, $pass)
{
global $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
require_once($this->patch.'/[login to view URL]');
define('IN_PHPBB',true);
define("IN_LOGIN", true);
$phpbb_root_path = $this->patch;
require_once( $this->patch . "extension.inc" );
require_once( $this->patch . "common.php" );
$pass = md5($pass) ;
$sql = "UPDATE " .USERS_TABLE ." set `user_password` = '".$pass."' where `username`='".$login."'";
$db->sql_query($sql) ;
}
public function is_admin()
{
global $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
require_once($this->patch.'/[login to view URL]');
define('IN_PHPBB',true);
define("IN_LOGIN", true);
$phpbb_root_path = $this->patch;
require_once( $this->patch . "extension.inc" );
require_once( $this->patch . "common.php" );
$cok = $board_config[ "cookie_name" ].'_data';
$x = stripslashes($_COOKIE[$cok]);
$x = unserialize($x);
IF(count($x) > 1)
{
$sql = "SELECT group_id FROM " . USER_GROUP_TABLE . " WHERE user_id = '" . str_replace("'", "''", $x['userid']) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
IF($row['group_id'] == 2)
{
return true;
}
}
else
{
return false;
}
}
public function is_user()
{
global $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
require_once($this->patch.'/[login to view URL]');
define('IN_PHPBB',true);
define("IN_LOGIN", true);
$phpbb_root_path = $this->patch;
require_once( $this->patch . "extension.inc" );
require_once( $this->patch . "common.php" );
$cok = $board_config[ "cookie_name" ].'_data';
$x = stripslashes($_COOKIE[$cok]);
$x = unserialize($x);
IF(count($x) > 1)
{
$sql = "SELECT group_id FROM " . USER_GROUP_TABLE . " WHERE user_id = '" . str_replace("'", "''", $x['userid']) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
IF($row['group_id'] == 3)
{
return true;
}
}
else
{
return false;
}
}
public function board_config()
{
global $db, $lang, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
require_once($this->patch.'/[login to view URL]');
define('IN_PHPBB',true);
$phpbb_root_path = $this->patch;
require_once( $phpbb_root_path . "extension.inc" );
require_once( $phpbb_root_path . "common.php" );
return $board_config;
}
public function get_user_data()
{
global $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
require_once($this->patch.'/[login to view URL]');
define('IN_PHPBB',true);
define("IN_LOGIN", true);
$phpbb_root_path = $this->patch;
require_once( $this->patch . "extension.inc" );
require_once( $this->patch . "common.php" );
$cok = $board_config[ "cookie_name" ].'_data';
$x = stripslashes($_COOKIE[$cok]);
$x = unserialize($x);
IF(count($x) > 1)
{
$sql = "SELECT * FROM " . USERS_TABLE . " WHERE user_id = '" . str_replace("'", "''", $x['userid']) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
return $row;
}
else
{
return false;
}
}
}
?>