justin7410 Posted April 23, 2013 Share Posted April 23, 2013 Hey guys, i have already created a log-in / register system for my website, and i am currently trying to integrate a web forum from phpBB3. i have installed the forum correctly and it is up and running just fine. what i am having an issue with is merging the register systems of both and matching the queries of each databases username and password.and am somewhat lost in watching a tutorial. i have my login logic: <?include('include/init.php'); // DB CONNECTION AND SESSION START .. etc // Redirects user if already logged in logged_in_redirect(); if (empty($_POST) === false) { $username = $_POST['loginname']; $password = $_POST['loginpass']; if (empty($username) === true || empty($password) === true) { $errors[] = 'You need to enter a valid Username & Password'; } else if (user_exists($username) === false ) { $errors[] = ' We could not find this user info in our userbase.'; } else if (user_active($username) === false ) { $errors[] = 'This account still needs to be activated or is no longer active'; } else { $login = login($username, $password); if ($login === false) { $errors[] = ' The Username / Password combination you entered is incorrect.'; } else { $_SESSION['user_id'] = $login; header("Location: index.php"); exit(); } } }else { $errors[] = 'No Data Retrieved'; } if (empty($errors) === false) { ?> <div style=" width: auto; height: 300px; margin: auto; padding: none; text-align: center; position: relative; top: 300px;"> <h5> We tried our best to log you in, but.. <? echo output_errors($errors); }?> Click <a href="redirect.php">Here</a> to go back to the login. </h5> </div> and my sessions logic in the INIT.php: ob_start(); if(!isset($_SESSION)) { session_start(); } error_reporting(E_ALL| E_STRICT); ini_set('display_errors', 1); require_once ('core/database/dbconnect.php'); require_once ('core/functions/general.php'); require_once ('core/functions/users.php'); require_once 'core/queries/dbqueries.php'; require_once ('forums/phpBB3/includes/functions.php'); $current_file = explode('/', $_SERVER['SCRIPT_NAME']); $current_file = end($current_file); if (logged_in() === true) { $session_user_id = $_SESSION['user_id']; $user_data = user_data($session_user_id, 'user_id', 'username', 'password', 'email', 'gender', 'country', 'month' ,'date' , 'year', 'pass_recover', 'type'); if (user_active($user_data['username']) === false){ session_destroy(); header('Location: index.php'); exit(); } if($current_file !== 'change_password.php' && $current_file !== 'logout.php' && $user_data['pass_recover'] == 1 ){ header('Location: change_password.php?force'); exit(); } } $errors = array(); ?> now i have uploaded my phpbb3 file and set them into a directory called forums and in this directory come a bunch of predefined functions. so i wanted to start to add the conditionals to check to see if it was finding the other forums register info i added this: } else { $login = login($username, $password); if ($login === false) { $errors[] = ' The Username / Password combination you entered is incorrect.'; } else {$find = mysql_query("SELECT * FROM phpbb_users WHERE username = '$username' "); ----| if(mysql_num_rows($find)==0) { | echo "ERROR"; | } else { | while ($find_row = mysql_fetch_assoc($find)){ | // THIS WHOLE SNIPPET HAS BEEN ADDED $password_hash = $find_row['user_password']; | } | echo $password_hash; | } ----| $_SESSION['user_id'] = $login; header("Location: index.php"); exit(); } } i had to go into the main functions of the and comment out this line of code so my page would show /*if (!defined('IN_PHPBB')) { exit; } */ nothing seems to output when i add these conditionals, and i at this point i am just lost as to how to get this task done. i can still login with a user who registered using the site / but typing in the username of a user who has registered via forum is not outputting anything. any suggestion or ideas ? i really would appreciate any help on this Quote Link to comment Share on other sites More sharing options...
annaharris Posted May 6, 2013 Share Posted May 6, 2013 Check out this link to get proper information on How to integrate phpbb forum login... http://www.barattalo.it/2010/09/17/phpbb-login-integration/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.