Full Site Integration

Discussion forum for MOD Writers regarding MOD Development.
Locked
swaymedia
Registered User
Posts: 7
Joined: Wed Jan 23, 2008 9:39 pm

Full Site Integration

Post by swaymedia »

Hi, im sure this is easy but I dont know where to start and iv tried to look around on the forum
  • how do i use the forums session data to authenticate users on the rest of my website?
  • and how do I allow users to login and make them stay in the index.php, not directing them to the forum?
  • how do I display the users name outside the forum, onto my root index.php?
  • is it possible to add fields on the users database, like trivial things specific to the rest of the site?
A reference to what im trying to get at is how sitepoint has intergrated and used there forums user authentication with the rest of the website, full intergrating it.[/

Thanks for any help & phpBB3 is great product
Last edited by swaymedia on Wed Jan 23, 2008 10:28 pm, edited 1 time in total.
swaymedia
Registered User
Posts: 7
Joined: Wed Jan 23, 2008 9:39 pm

Re: Full Site Integration

Post by swaymedia »

there must be a way, iv seen it done a 100 times with vBulletin? :cry:
User avatar
darcie
Community Team Member
Community Team Member
Posts: 5546
Joined: Thu Jul 27, 2006 9:52 am
Location: Davis, California
Name: Darcie Griffin
Contact:

Re: Full Site Integration

Post by darcie »

Please keep in mind that we have a six hour bump rule. All users and team members are volunteers, and patience is a virtue. :)
phpBB on Facebook | Site Rules | Former Community Team leader
swaymedia
Registered User
Posts: 7
Joined: Wed Jan 23, 2008 9:39 pm

Re: Full Site Integration

Post by swaymedia »

sorry dude

EDIT: F'k i didnt mean to bump it again.. I need some redbull
..::Frans::..
Registered User
Posts: 172
Joined: Sun Jun 20, 2004 10:25 am
Location: Netherlands
Contact:

Re: Full Site Integration

Post by ..::Frans::.. »

swaymedia wrote:Hi, im sure this is easy but I dont know where to start and iv tried to look around on the forum
  • how do i use the forums session data to authenticate users on the rest of my website?
  • and how do I allow users to login and make them stay in the index.php, not directing them to the forum?
  • how do I display the users name outside the forum, onto my root index.php?
  • is it possible to add fields on the users database, like trivial things specific to the rest of the site?
A reference to what im trying to get at is how sitepoint has intergrated and used there forums user authentication with the rest of the website, full intergrating it.[/

Thanks for any help & phpBB3 is great product
You mean something like:

http://www.startrekguide.com/community/ ... =integrate


Look around there to get all the other questions answered...;)
...pong
User avatar
Noxwizard
Support Team Leader
Support Team Leader
Posts: 10552
Joined: Mon Jun 27, 2005 8:41 pm
Location: Texas, USA
Name: Patrick Webster
Contact:

Re: Full Site Integration

Post by Noxwizard »

That's more if you want to design a site around the phpBB system, and not just tie two existing systems together.

To use the phpBB sessions, you'll need this code at the top of your file:

Code: Select all

define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup(); 
To see if a user is logged in:

Code: Select all

if($user->data['is_registered'])
     //user is logged in
else
     //user is not logged in  
For the login redirection, you'll probably need to add a hidden input with the redirect path.

Code: Select all

<input type="hidden" name="redirect" value="index.php">
So a login form would look like this:

Code: Select all

Please log in:<br />
<form method="POST" action="./ucp.php?mode=login">
<p>Username: <input type="text" name="username" size="40"><br />
Password: <input type="password" name="password" size="40"><br />
Remember Me?: <input type="checkbox" name="autologin"><br />
<input type="submit" value="Submit" name="login"></p>
<input type="hidden" name="redirect" value="index.php">
</form>
To show the user's name:

Code: Select all

echo "Welcome back " . $user->data['username']; 
You can add custom profile fields through the Users and Groups tab in the admin panel.
[Support Template] - [Read Before Posting] - [phpBB Knowledge Base]
Do not contact me for private support, please share the question in our forums.
swaymedia
Registered User
Posts: 7
Joined: Wed Jan 23, 2008 9:39 pm

Re: Full Site Integration

Post by swaymedia »

hey man, your a genious, and I think once someone brings out a official guide to how to fully incorpate phpBB3 to a site. It'll be revolutionary. If I get all of this done, Ill probably write that guide and host it on my site.

anyway
  • how do I log out, from my index.php (outside the forum)
  • I meant adding fields on the database, becuase my site requires that the users have "credits" and each contest they win there credit field should increment by one. I didnt mean the profile field thing. Like would thing muck up if I add a new field on the users mysql table
  • is there like a list of all the functions/scripts in the forum such as log-out, etc?
User avatar
Noxwizard
Support Team Leader
Support Team Leader
Posts: 10552
Joined: Mon Jun 27, 2005 8:41 pm
Location: Texas, USA
Name: Patrick Webster
Contact:

Re: Full Site Integration

Post by Noxwizard »

For a logout link:

Code: Select all

echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id). '">Log out</a>'; 
You can add fields to the database if you want, it won't affect phpBB, it only uses what it needs.

I don't think there's such a list, as it would be quite long.
[Support Template] - [Read Before Posting] - [phpBB Knowledge Base]
Do not contact me for private support, please share the question in our forums.
Glenn I
Registered User
Posts: 172
Joined: Wed Apr 20, 2005 6:11 am

Re: Full Site Integration

Post by Glenn I »

Noxwizard wrote: To show the user's name:

Code: Select all

echo "Welcome back " . $user->data['username'];   
I tried to add this to a sidebar to say "welcome back *username here*" but it won't work. What is the code to have the user's name show?
User avatar
Noxwizard
Support Team Leader
Support Team Leader
Posts: 10552
Joined: Mon Jun 27, 2005 8:41 pm
Location: Texas, USA
Name: Patrick Webster
Contact:

Re: Full Site Integration

Post by Noxwizard »

Did you include this in your file?

Code: Select all

define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();  
[Support Template] - [Read Before Posting] - [phpBB Knowledge Base]
Do not contact me for private support, please share the question in our forums.
Glenn I
Registered User
Posts: 172
Joined: Wed Apr 20, 2005 6:11 am

Re: Full Site Integration

Post by Glenn I »

Noxwizard wrote:Did you include this in your file?

Code: Select all

define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();   
No, what file does that go in?
User avatar
Darkelarious
Registered User
Posts: 267
Joined: Mon May 28, 2007 9:56 pm
Location: Zeist, the Netherlands
Contact:

Re: Full Site Integration

Post by Darkelarious »

swaymedia wrote:sorry dude

EDIT: F'k i didnt mean to bump it again.. I need some redbull
Just for your information, darcie is female. ;)
Glenn I wrote:
Noxwizard wrote:Did you include this in your file?

Code: Select all

define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();    
No, what file does that go in?
In the new php file you have created, then it uses the database and connects to phpbb
goethe
Registered User
Posts: 162
Joined: Fri May 11, 2007 8:26 pm

Re: Full Site Integration

Post by goethe »

How would you make the Logout and Login replace eachother when the user is logged in or out?
This is the same thing that I am interested in, thanks for starting this topic!
I can translate German in both directions:
German to English
English to German
If you want a translation, drop me a PM.
Glenn I
Registered User
Posts: 172
Joined: Wed Apr 20, 2005 6:11 am

Re: Full Site Integration

Post by Glenn I »

It's actually going into a html file in a right handside sidebar.
User avatar
eruckus
Registered User
Posts: 14
Joined: Sat Jan 19, 2008 5:39 pm

Re: Full Site Integration

Post by eruckus »

alright, this is EXACTLY what im looking for...so i wrote this simple script to tell me if im logged in or not:

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = './forums/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

if($user->data['is_registered']){
   echo "logged in!";
}
else{
   echo "not logged in!";
}

?>

<html><body>

<a href="./forums/">to the forum!</a>

</body></html>
this script (ill call it tester.php from here on in) is located in my root directory, just outside of my forums directory. from what i've read in this thread this should work, but whenever i log in at my forum and then visit tester.php it says im not logged in. then when i go right back to the forum im not logged in there either.

i have also tried this script in my forum directory with no luck. and yes, i correctly changed php root path as well. can anyone tell me why am i getting logged out when i visit tester.php? what am i doing wrong?

many, MANY thanks in advance! :D :D
- e.ruckus
la la laaa...
Locked

Return to “[3.0.x] MOD Writers Discussion”