1

Topic: Is it possible that you have to login in to enter the site?

Hi!

Tried to find this somewhere in the forum but without luck.

I have intergrated punBB into my website and built som memberstuff on the page that is only for forum members. But my question is, is it posible (or is there any mod for it) to make it so when a person goes to my site theres only showing a loginform, nothing else. And when they login they will go to the page. Is that possible?

By the way, fun to finaly have a try with punBB, its fantastic to work with! smile

Re: Is it possible that you have to login in to enter the site?

At the top in header.php, after common.php is loaded, put this:

if($pun_user['is_guest'])
header('Location: login.php');

I think that should do...

3

Re: Is it possible that you have to login in to enter the site?

Ohhh, nice and simple... smile

Many thanks for the fast answer!!

4

Re: Is it possible that you have to login in to enter the site?

Now i have tried it and it worked great. But i jumped on another problem. Now it is'nt possible to register as a new member because of that...

But i am going to try to move the register file outside the template and see what happends. I suppose thats the only solution? Or? smile

Re: Is it possible that you have to login in to enter the site?

Hrmm... didn't think of that tongue Maybe this will work (just a wild guess, but might work by looking at the code smile)

if($pun_user['is_guest'] && !isset($lang_register))
header('Location: login.php');

6

Re: Is it possible that you have to login in to enter the site?

Wow, your my man of the week... wink

Works great!!

7 (edited by pawe 2006-07-19 20:52)

Re: Is it possible that you have to login in to enter the site?

Sorry for this spam usage of the forum.. smile

But i remebered on more thing that would be nice if the logged out users could go to, and that is the forgot password page....

How can i change this so it also is possible to go to --> login.php?action=forget

if($pun_user['is_guest'] && !isset($lang_register))

Re: Is it possible that you have to login in to enter the site?

I'm not so sure about this one, but it might work:

if($pun_user['is_guest'] && !isset($lang_register) && ($page_title == pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_login['Request pass']))

9

Re: Is it possible that you have to login in to enter the site?

Did'nt work...i must try on my own then... smile

Thanks for all the help, dont waste your time on me anymore smile I'll come back if i really cant make it and ask for some help... smile

Re: Is it possible that you have to login in to enter the site?

Hrmmm... Try changing == to !=

11 (edited by pogenwurst 2006-07-19 21:50)

Re: Is it possible that you have to login in to enter the site?

What about:

if($pun_user['is_guest'] && !isset($lang_register) && $_GET['action'] != 'forget')
header('Location: login.php');

Does that work?

EDIT: Nvm what elbekko just said should work.

Looking for a certain modification for your forum? Please take a look here before posting.

Re: Is it possible that you have to login in to enter the site?

Maybe it's best to just check against $lang_login as was done for $lang_register, like this:

if($pun_user['is_guest'] && !isset($lang_register) && !isset($lang_login))
header('Location: login.php');

Else you wouldn't really be able to login... (yes, you can slap me)

13

Re: Is it possible that you have to login in to enter the site?

hehe smile

Once again, thanks for all the help! smile It all works like charm now... smile

I'll send you a pack of nice swedish chewinggums in my next life.. big_smile

14

Re: Is it possible that you have to login in to enter the site?

By the way, you don't know where in profile.php i could make a redirect on the user you clicked? (Hard to understand what i mean, i do another try....)

If i click on a members username in the forum i go to that users profile. But if i want to change that address (i have done an own profilepage)...but you should only go there if you click on another member, not when you click on yours.

I've done that to change the link in the forums (viewtopic.php) but there is alot of other places to change it and it would be much easier if i could all do it in one place in profile.php. I think all links goes to that page, am i correct?

Otherwise, ignore me... smile

Re: Is it possible that you have to login in to enter the site?

Try this:
Find ~line 922-927 in profile.php:

// View or edit?
if ($pun_user['id'] != $id &&
    ($pun_user['g_id'] > PUN_MOD ||
    ($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_edit_users'] == '0') ||
    ($pun_user['g_id'] == PUN_MOD && $user['g_id'] < PUN_GUEST)))
{

Add after:

header('Location: <yourpagecomeshere>.php');

16

Re: Is it possible that you have to login in to enter the site?

Thanks again! Works greater than great... smile

Re: Is it possible that you have to login in to enter the site?

*in a burns voice*
Excellent big_smile