Topic: Integrating logins

I'm trying to integrate punBB into my own site, and it is going well, howver I do not wish to have two seperate registrations and logins.  I was wondering if anyone else out there has had experience with integrating their own registrations and logins with punBB.  Has anyone developed a mod for something like this?

Thanks!
-Geoff

Re: Integrating logins

Well ive been trying that also and its hard. I just zwitched to this login en use i across my whole site i'm also gonna try to modificate additional scripts so they work on the punnbb login

3 (edited by MutantSurvivor 2005-03-25 10:33)

Re: Integrating logins

I had just come on here to post a similar question.

Oh well. Will have to try it out and see what happens.

I have a site that is login only. I don't people to have to log in to the forum as well. That should be automatic.

I think I will have to nick loads of bits from the register page and insert them into my own register script. Especially the sql bits and just use the punBB user table rather than the one I already had (or maybe cobble the two together)

Any suggestions.

I'll report back on how I am getting on over the next week (or so).

4 (edited by chris9902 2005-04-03 16:51)

Re: Integrating logins

If you look at login.php you can get what you need.

You could also use PunBB's register page as your register script then have the login box on your page... like so,

include this on everypage you want to use PunBB cookies.

<?php
$punbb_path = $_SERVER['SCRIPT_FILENAME'];
$punbb_split = explode('/',$punbb_path);
$punbb_page = end($punbb_split);
$punbb_count = substr_count($punbb_path,'/')-2;
$punbb_path = str_repeat('../',$punbb_count).'./forum/';

define('PUN_ROOT', "$punbb_path");
require PUN_ROOT.'include/common.php';

define('PUN_TURN_OFF_MAINT', 1); // if forums go down the site will not
define('PUN_QUIET_VISIT', 0); // update last visit when outside of the forums
?>

The first 5 lines is something i made. Becuase the path has to be relative and my site spans lots of pages in lots of folders i take the current filename, do some PHP magic and then it gets the relative path to PUNBB... cool huh?

NOTE: my forum is in /forum/ is yours is different change './forum/' like this './<PATH_TO_MY_FORUM>/'

for the login form you can do this.

<form id="login" method="post" action="/forum/login.php?action=in" onsubmit="return process_form(this)">
<input type="hidden" name="form_sent" value="1" />
<input type="hidden" name="redirect_url" value="<?php echo $_SERVER['SCRIPT_NAME'] ?>" />
<input type="text" name="req_username" size="25" maxlength="25" />
<input type="password" name="req_password" size="16" maxlength="16" />
<input type="submit" name="login" value="Login" />
</form>

Change

action="/forum/login.php?action=in"

to the location of you script.

Also note,

<input type="hidden" name="redirect_url" value="<?php echo $_SERVER['SCRIPT_NAME'] ?>" />

This will redirect you to the page you were on and not to the forum index. you can remove this if you want.

You can also check you settings using

<pre>
<?php print_r($pun_user)?>
</pre>

This will print the $pun_user array so you can see what settings to use.

EXAMPLE:

if user is logged in display welcome message else display login form

if($pun_user['id'] > 1)
{
  echo "Welcome Message";
}
else
{
  echo "Login Form";
}
?>

Since guests use 1 as there ID you can use >1 to see if there not a guest.


Anyway, hope that helped.

_Chris

Re: Integrating logins

Many thanks Chris.

Not got time to look at all that right now but will do very soon.

Ta

6

Re: Integrating logins

same "question/problem" for me smile

i've my own login system and i would like to improve it in order to automatically create their forum accounts for my members.

there is the description of the `users` table at http://punbb.org/docs/dev.html#dbtables (hope it's still up to date)

my idea is simply to send a sql insert query when someone register ? what do you think ?

now what about the features like :
- Newest registered user
- Total number of registered users

is there a script i've to run to update these values ?

thank you

When you look long into an abyss,
the abyss also looks into you.
--Friedrich Nietzche

7 (edited by Orpheus 2005-04-10 22:49)

Re: Integrating logins

Gre3n wrote:

same "question/problem" for me smile

i've my own login system and i would like to improve it in order to automatically create their forum accounts for my members.

there is the description of the `users` table at http://punbb.org/docs/dev.html#dbtables (hope it's still up to date)

my idea is simply to send a sql insert query when someone register ? what do you think ?

now what about the features like :
- Newest registered user
- Total number of registered users

is there a script i've to run to update these values ?

thank you

use the same sql query as used in register.php of punBB and you will be fine.

For the features you should take a look at extern.php of punBB. with the correct call you can get the forum stats.
These stats will show total members and the newest member.

8

Re: Integrating logins

thanks! smile

When you look long into an abyss,
the abyss also looks into you.
--Friedrich Nietzche

Re: Integrating logins

hi chris9902

any chance you could get me some help with this? im trying ot make the punbb login work for all my site.

i have made a test page but im getting some errors

http://www.strictlyleft.co.uk/testlogin.php

Re: Integrating logins

if you have PUN_ROOT set to ../.././forum/ try changing it to

'/home/strictly/public_html/forum/'

11 (edited by miowpro 2005-04-20 07:32)

Re: Integrating logins

ok is this rite?

$punbb_path = str_repeat('../',$punbb_count).'/home/strictly/public_html/forum/';

or

$punbb_path = '/home/strictly/public_html/forum/';

Re: Integrating logins

ok got it working i think big_smile

sorry for going on with out trying harder first, am not that good with php yet tongue

13 (edited by miowpro 2005-04-22 18:32)

Re: Integrating logins

ok i have intergrated the login as you can see on the top right on my site

my problem is when i login on with the forum login page it does not show you logged in on my home page till you refresh the page. but when you login using the home page login it works fine.

i have made a test account so you can see for your self and help if you can

username: test
password: test

http://www.strictlyleft.co.uk

try logging in from the forum login and then from my home page login.

the same things also happends when you logout.

so some reason where ever you come from the forum to my home page is not picking up the cookie or something

please can anyone help

Re: Integrating logins

It looks like you got it working now.

Nice site BTW

15

Re: Integrating logins

In my site,Registration and login pages are there.I registerd with my registration page and i logged in my site.After that there is a menu for different activities.One of that menu is FORUM.I want to do that with my registration page,when someone register then after that he click on forum of the menu he will go the index page after logged in.

Can anyone tell me how to do that?
Please help me

16 (edited by tommi 2009-10-24 10:38)

Re: Integrating logins

So, as you guys describe it above is too complicated! I tried and tried to get it to work. But impossible!  Then I checked on this page and then I got it to work on the first try.

http://punbb.informer.com/wiki/punbb13/integration