php bb/forum

This is a discussion on "php bb/forum" within the PHP Forum section. This forum, and the thread "php bb/forum are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Dec 25th, 2007, 22:51
Up'n'Coming Member
Join Date: Apr 2007
Location: Canada
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
php bb/forum

Happy Holidays friends!

I was wondering if it is possible to implement any bulletein boad with my existing user table! what I meant is I alrady have a page where users signup to log in. Now I want to use the same user credential to use the bulletein board. Could some one pls explain how can i implement it.
Reply With Quote

  #2 (permalink)  
Old Dec 26th, 2007, 19:14
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: php bb/forum

It would probably take a lot of queries, what does your user table look like?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #3 (permalink)  
Old Dec 27th, 2007, 18:55
Up'n'Coming Member
Join Date: Apr 2007
Location: Canada
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Re: php bb/forum

My user table has following field
userid(which is email address), firstname, middlename, lastname, address, city, country, age, gender, education and current profession. you can view it at
http://www.bangladeshilivingabroad.com/signup.html
Reply With Quote
  #4 (permalink)  
Old Dec 28th, 2007, 19:13
saltedm8's Avatar
Lead Administrator

SuperMember
Join Date: Nov 2005
Location: Always About
Age: 27
Posts: 1,296
Blog Entries: 1
Thanks: 1
Thanked 6 Times in 6 Posts
Re: php bb/forum

PHPBB2 keeps sessions using cookies. Making the cookies extend to your main site is a fairly simple task.
There is a small complication with keeping the PHPBB2 sessions active when linking from your integrated main site to your forum. You have to use the append_sid() function on all the links to your forum. It is also recommended to do this with all links that point to the mainsite, but it is not required.
Lets start with a simple file that we will include in all your main site pages. This file will take care of the cookies PHPPBB2 uses and allow us to use PHPBB2 defined functions.

PHP: Select all

  <?php
define
('IN_PHPBB'true);
 
$phpbb_root_path 'forums/'//Relative path to your PHPBB2 installation
include($phpbb_root_path 'extension.inc');
include(
$phpbb_root_path 'common.'.$phpEx);
 
$userdata session_pagestart($user_ipPAGE_INDEX);
init_userprefs($userdata);
?>
THis is an example page which includes the above file and checks if a user is logged in and if the user is a guest displays a login form.

PHP: Select all

  <?php
include('include.php'); //include our session handling file, make sure you have the right file name if( !$userdata['session_logged_in'] ) // Is the user NOT logged in?
    
{
      
?>
<form action="forums/login.php" method="post" name="login"> <!-- Show a simple login form -->
 <input type="text" name="username"><br />
<input type="password" name="password"><br />
<input type="hidden" name="redirect" value="../index.php"> <!-- Redirect the user to a page different than the PHPBB2 index page. You can delete this if you want. The path must be relative from the PHPBB2 login file. -->
 <input type="submit" value="login" name="login"> 
</form>
      <?php
    
}
?>
Make sure that the action attribute of the form tag points to your forums login page.
Now for the append_sid() function, here is an example of how the function can be use on your URLs.

PHP: Select all


  <?php
 $phpbb_links 
= array ( //start our array
'home' => append_sid("index.$phpEx"), // .$phpEx is the way PHPBB2 writes the .php file extension, change this to just .html if you use .html files or other file extensions. 
 
'forums_home' => append_sid("forums/index.$phpEx"),
'tolist' => append_sid("toplist.$phpEx"), // notice the comma after each line
 
'downloads' => append_sid("downloads.$phpEx"// there is no comma on the last line
); // end our array
?>
You can simply put this code at the top of your page or even better put it in the sessions file that you include on each page.
Then you simply call the variable when you want the link.

PHP: Select all

<a href="<?php echo $phpbb_links['home']; ?>">Site Home</a>
It's as simple as that. This is how to display some information about a user when he or she is logged in.

PHP: Select all

  <?php
include('include.php'); //include our session handling file
if( $userdata['session_logged_in'] ) // Is the user logged in?
    
{
    
$appendLogout $u_login_logout $phpbb_root_path.'login.'.$phpEx.'?logout=true&amp;sid=' $userdata['session_id']; // Add the session ID to the logout link
     
echo "Welcome back, <a href=\"forums/profile.php?mode=viewprofile&u=".$userdata['user_id']."\" title=\"".$userdata['username']."\">".$userdata['username']."</a>!<br />"// Show a welcome message
     
echo "<a href=\"forums/privmsg.php?folder=inbox\" title=\"You have ".$userdata['user_unread_privmsg']." new messages\">(".$userdata['user_unread_privmsg'].") New Messages</a><br />"// Any new PMs?
     
echo "<a href=\"forums/profile.php?mode=editprofile\" title=\"My Profile\">My Profile</a><br />"// Edit your profile link
     
echo "<a href=\"".$appendLogout."\" title=\"Logout\">Logout</a><br />"// Logout link
    
// end if, if you want you could add a login form in an else statement below
?>
Make sure you make the links point to your forums, if you want you can change all the links to use the $phpbb_root_path set in the included file as I have done in the logout link. Also notice that i didn't use append_sid() on the logout link, it is required to add the session id manually on a logout link otherwise you will get an error from the logout page.
__________________
My Recipe forum...don't click here
Last Blog Entry: Basic Advice for newbies (Feb 1st, 2008)

Last edited by saltedm8; Dec 28th, 2007 at 19:20.
Reply With Quote
  #5 (permalink)  
Old Dec 29th, 2007, 16:34
Reputable Member
Join Date: Nov 2007
Location: India
Posts: 150
Blog Entries: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Re: php bb/forum

Do you mean you already have a database which has some usernames and passwords.
Now, you want to implement another forum and for people who have registered their usernames and passwords earlier, you want them to login into the new forum using the same usernames and pasword; right?
Last Blog Entry: Cross browser nuisance (Feb 11th, 2008)
Reply With Quote
  #6 (permalink)  
Old Dec 29th, 2007, 21:42
Up'n'Coming Member
Join Date: Apr 2007
Location: Canada
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Re: php bb/forum

First of all thank you very much to "Saltedm8" for your time to post such a long and descriptive posting. I will have to sit down and understand the whole thing. I am a novice in the subject so it will probably take time for me.
Now to Rohan, you got that right. I want the existing registerd people to use the BB using the same credential when they signup to the site. And also new people who sign up to the site should use the same id and password. I do not want user to register twice. I hope you understand.
Reply With Quote
  #7 (permalink)  
Old Dec 30th, 2007, 07:05
Reputable Member
Join Date: Nov 2007
Location: India
Posts: 150
Blog Entries: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Re: php bb/forum

The simplest solution I can think of is:
1. Change the headers of your existing database and make them similar to those of the table in forum database. Import this database into new forum database.
2. Now point your existing login script and registration form to the forum login form and registration form.
Last Blog Entry: Cross browser nuisance (Feb 11th, 2008)
Reply With Quote
  #8 (permalink)  
Old Dec 30th, 2007, 10:26
saltedm8's Avatar
Lead Administrator

SuperMember
Join Date: Nov 2005
Location: Always About
Age: 27
Posts: 1,296
Blog Entries: 1
Thanks: 1
Thanked 6 Times in 6 Posts
Re: php bb/forum

if you want to keep the same credentials, there is a mod that can help you add custom fields to the phpbb register form, and then you can just copy ( migrate ) your existing users and put them into the phpbb users table ( if you did what i said above, you will be using phpbb's database table, not a new one and you cant use the one you already have either )
__________________
My Recipe forum...don't click here
Last Blog Entry: Basic Advice for newbies (Feb 1st, 2008)
Reply With Quote
  #9 (permalink)  
Old Dec 31st, 2007, 23:56
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: php bb/forum

Surely the easiest thing would be to backup your table, install the phpBB forum database, and add your values to the correct fields in the new MYSQL database?
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #10 (permalink)  
Old Jan 1st, 2008, 03:36
saltedm8's Avatar
Lead Administrator

SuperMember
Join Date: Nov 2005
Location: Always About
Age: 27
Posts: 1,296
Blog Entries: 1
Thanks: 1
Thanked 6 Times in 6 Posts
Re: php bb/forum

it would be but you have to make sure you change some of the values in the saved file to 'match' the mysql tables and database info of phpbb

for example you will have to change

my_table to phpbb_table

my_username to phpbb_username ...etc

( these are not the actual values they are just examples )
__________________
My Recipe forum...don't click here
Last Blog Entry: Basic Advice for newbies (Feb 1st, 2008)
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Paid Forum Posting - Political Forum entropy Job Opportunities 0 Sep 22nd, 2007 03:13
Best forum -> news script/forum? limezor Scripts and Online Services 4 Aug 21st, 2007 15:45
Really like this forum grandadbob Introduce Yourself 8 Apr 16th, 2007 09:52
Hello Forum Gordon Introduce Yourself 15 Dec 23rd, 2006 09:00
HotSeoTalk.com - SEO Forum Search Engine Optimization Ranking Marketing forum hotseotalk Link Building and Link Sales 1 Aug 19th, 2006 09:43


All times are GMT. The time now is 02:09.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43