1

Topic: Guest forced login, should be simple, please help

I just want my site to be closed to guests. All I want them to be able to view is login.php. Is this possible? If so, please feel free to help me out. Thanks so much. I have come to using this board from IPB. So simple and clean. Thanks for all that you guys do.

2

Re: Guest forced login, should be simple, please help

go to admin, forums,
edit each forum you want,
then, allow guest to do nothing
really simple,

Ludo,

3

Re: Guest forced login, should be simple, please help

Ok, say I didn't want them to be able to view ANYTHING but the login form. Meaning going to *.php ===> login.php for all guests. Sorry for the inconvenience, I should have been more clear. Thanks for your response.

4

Re: Guest forced login, should be simple, please help

what do guest see (when they are not allowed) that could anoy you ?

Ludo,

5

Re: Guest forced login, should be simple, please help

:-P, The site is an child of a very exclusive web community. It's tradition to only allow guests to see a customary login page. It's been used for years. I appreciate your understanding and attention to my little problem.

6

Re: Guest forced login, should be simple, please help

Funny.

Exactly the same thing has been asked by somebody else today.
And I tried to answer it, I do hope the code works but I still haven't tested myself.
Very minor change to so anyway:

http://punbb.org/forums/viewtopic.php?id=8298

The German PunBB Site:
PunBB-forum.de

7

Re: Guest forced login, should be simple, please help

Ah, thank you very much. The last bit of code did well to redirect to login.php. But, I am presented with this now

"There is no valid language pack '' installed. Please reinstall a language of that name."

I have changed no language files, only the edit that was instructed. What went wrong?

Thanks for your help, both of you.

8

Re: Guest forced login, should be simple, please help

What went wrong was that I forgot that you have to set the cookie first... sad
I don't know if set_default_user() before the Header() statement works but I'll find out.
Since it is getting very late down here I'll give it to you tomorrow. Sorry.

The German PunBB Site:
PunBB-forum.de

9

Re: Guest forced login, should be simple, please help

I'll try that. Thanks again for your help and I will hear from you tomorrow. Good night m8!

10

Re: Guest forced login, should be simple, please help

If anyone else could help while Tobi is taking a nap, It would be much appreciated. Thanks.

11

Re: Guest forced login, should be simple, please help

OK,
sleeping helps.

I tested this and it works:

include/functions.php, line 137 (on my install, might sightly differ due to installed mods)

Find

    $pun_user['is_guest'] = true;
}

Replace with:

    $pun_user['is_guest'] = true;
  if(!ereg('login\.php', $_SERVER['SCRIPT_FILENAME']) && !ereg('register\.php', $_SERVER['SCRIPT_FILENAME']))  
    Header('Location:'.PUN_ROOT.'login.php'); 
}

Notes:
You can leave out the part

 && !ereg('register\.php', $_SERVER['SCRIPT_FILENAME'])

but then nobody can register on your site anymore

Instead of

Header('Location:'.PUN_ROOT.'login.php');

of course you can put any url you like.

The German PunBB Site:
PunBB-forum.de

Re: Guest forced login, should be simple, please help

hi, i'm doeing the exact same here. since Tobi solved the code issues i can tell you how to lose everything around loginbox. 

in login.php row 199 or somewhere near is

require PUN_ROOT.'header.php';

replace it:

require PUN_ROOT.'header_login.php';

then open header.php and FIND

else
    $tpl_main = file_get_contents(PUN_ROOT.'include/template/main.tpl');

and replace width:

else
    $tpl_main = file_get_contents(PUN_ROOT.'include/template/login.tpl');

and Save As header_login.php

then open include/template/main.tpl and edit it as you like, afterwards Save As login.tpl

There might be a better way to do it and probably there are some bugs, but it works for me...

Re: Guest forced login, should be simple, please help

login.tpl may be like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html dir="<pun_content_direction>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />
<pun_head>
<style type="text/css">
    #left {
        width: 120px;
        float: left;
    }
    #main {
        margin-left: 5px;
        width: 350px;
        vertical-align: middle;

    }
    #container {
    width: 100%;
    float: right;
   
    }
</style>
</head>
<body>

<div id="punwrap">
<div id="pun<pun_page>" class="pun">



<div id="container">
    <div id="main">
   
        <pun_announcement>
   
        <pun_main>
       
    </div>   
</div>



<div class="clearer"></div>



</div>
</div>

</body>
</html>

14 (edited by magnus0c 2005-08-03 12:12)

Re: Guest forced login, should be simple, please help

if you also would like to "forget password" form to be similar to the login form you should edit login.php even more:

FIND(row 163 or close to it):

require PUN_ROOT.'header.php';

REPLACE with:

require PUN_ROOT.'header_login.php';

and since my login.tpl login division is too short then :

FIND(row 175 or close to it):

<input id="req_email" type="text" name="req_email" size="50" maxlength="50" />

REPLACE:

<input id="req_email" type="text" name="req_email" size="30" maxlength="50" />

thats it... Good luck...

15

Re: Guest forced login, should be simple, please help

I love this BB system, I love this site, I love this board, and I love all of you. If I had good tokens, you would all have a permagood token. :-)

16

Re: Guest forced login, should be simple, please help

Hmmm... Now, that I think about it, is there a way to display a special page for banned users? Same principle right?

17

Re: Guest forced login, should be simple, please help

For some reason none of the changes in login.tpl are showing. What am I doing wrong here? Edits all done as instructed. Login page shows as default, but I want a very plain page with this essentially. I'm running the Frontpage mod. Would like to edit the page to show a plain white blank form. Hopefully this can be done, but if not, I can be nothing but content. Thanks so much.

18 (edited by magnus0c 2005-08-04 06:12)

Re: Guest forced login, should be simple, please help

hmm, i cant understand why its not working... mine is up at http://www.rahvaliit.ee/intranet/
this is how you wanted it, right?

Re: Guest forced login, should be simple, please help

p.s. are you sure you saved header_login.php as a new file and did not overwrite header.php? Same deal with login.tpl instead of main.tpl... Old files must stay too, you knew it, right?

20 (edited by vek 2005-08-05 00:43)

Re: Guest forced login, should be simple, please help

Yes. New files where created. Maybe it's not working because I have installed the FronPage mod.

That is exactly what I want. Thanks for taking extra time on this magnus. I appreciate it.

My board is installed @ http://www.antitrend.org

Re: Guest forced login, should be simple, please help

Why mod the forums when it's a feature already present? Go to admin/user groups, edit the Guests group and "Read board" to No.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

22

Re: Guest forced login, should be simple, please help

It's not that, Rickard. He just doesn't want guests to see anything BUT the login form, the registration form and the lost pass form.

hi luelinkers

Re: Guest forced login, should be simple, please help

That's what the feature I spoke of does? If you set "Read board" to "No", guests cannot do anything except login, register and request a new password.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

24

Re: Guest forced login, should be simple, please help

I think it's more a design question.
The function you are talking about still shows all the punBB framework.
I think he just wants a blank page with a login form.

The German PunBB Site:
PunBB-forum.de

Re: Guest forced login, should be simple, please help

Aha

"Programming is like sex: one mistake and you have to support it for the rest of your life."