[2.0.15] Redirect anonymous users to login

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
102
73%
Very Good
25
18%
Good
3
2%
Fair
1
1%
Poor
8
6%
 
Total votes: 139

D16
Registered User
Posts: 29
Joined: Mon Oct 08, 2007 10:22 pm

Re: [2.0.15] Redirect anonymous users to login

Post by D16 »

I've copied below, what appears to be the main body of the file where I get the error
"Parse error: syntax error, unexpected T_ELSE in /data/dart16.com/forum/profile.php on line 89"



if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
$mode = htmlspecialchars($mode);

if ( $mode == 'viewprofile' )
if ($userdata['user_id'] == ANONYMOUS)
{
redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=viewprofile&" . POST_USERS_URL . '=' . intval($HTTP_GET_VARS[POST_USERS_URL]), true));
}

{
include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
exit;
}
else if ( $mode == 'editprofile' || $mode == 'register' )
{
if ( !$userdata['session_logged_in'] && $mode == 'editprofile' )
{
redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true));
}

include($phpbb_root_path . 'includes/usercp_register.'.$phpEx);
exit;
}
else if ( $mode == 'confirm' )
{
// Visual Confirmation
if ( $userdata['session_logged_in'] )
{
exit;
}

include($phpbb_root_path . 'includes/usercp_confirm.'.$phpEx);
exit;
}
else if ( $mode == 'sendpassword' )
{
include($phpbb_root_path . 'includes/usercp_sendpasswd.'.$phpEx);
exit;
}
else if ( $mode == 'activate' )
{
include($phpbb_root_path . 'includes/usercp_activate.'.$phpEx);
exit;
}
else if ( $mode == 'email' )
{
include($phpbb_root_path . 'includes/usercp_email.'.$phpEx);
exit;
}
}

redirect(append_sid("index.$phpEx", true));
User avatar
RMcGirr83
Former Team Member
Posts: 22011
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [2.0.15] Redirect anonymous users to login

Post by RMcGirr83 »

this

Code: Select all

    if ( $mode == 'viewprofile' )

        if ($userdata['user_id'] == ANONYMOUS)
        {
        redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=viewprofile&" . POST_USERS_URL . '=' . intval($HTTP_GET_VARS[POST_USERS_URL]), true));
        }

    {
    include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
    exit;
    }
should be this

Code: Select all

    if ( $mode == 'viewprofile' )
    {
        if ($userdata['user_id'] == ANONYMOUS)
        {
            redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=viewprofile&" . POST_USERS_URL . '=' . intval($HTTP_GET_VARS[POST_USERS_URL]), true));
        }
        include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
        exit;
    }
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beer Image
Speedwright
Registered User
Posts: 2
Joined: Sun Jan 13, 2008 4:41 pm

Re: [2.0.15] Redirect anonymous users to login

Post by Speedwright »

Thanks for the great mod. Using 2.0.22.
Speedwright
spookybob
Registered User
Posts: 19
Joined: Sun Feb 17, 2008 8:11 pm

Re: [2.0.15] Redirect anonymous users to login

Post by spookybob »

any idea if this mod works with the latest version 2.0.23?
User avatar
Dogs and things
Registered User
Posts: 2114
Joined: Fri Sep 01, 2006 9:04 am
Location: Spain
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by Dogs and things »

Yes, it does. ;)
For phpBB2 support visit phpBB2refugees.
~Sentinel~
Registered User
Posts: 268
Joined: Tue Jun 03, 2003 3:19 pm

Re: [2.0.15] Redirect anonymous users to login

Post by ~Sentinel~ »

I checked a few pages back and saw no answer to this so I thought I would ask...

Is there any mod like this for phpbb version 3.0?

If not then is there any chance this mode would work in version 3?
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53379
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by Brf »

It isnt needed for phpBB3.
You can set the User permissions for the Guest group so they cannot see Profiles. That will keep them out of the Memberlist too.
~Sentinel~
Registered User
Posts: 268
Joined: Tue Jun 03, 2003 3:19 pm

Re: [2.0.15] Redirect anonymous users to login

Post by ~Sentinel~ »

Ah OK, thanks.
~Sentinel~
Registered User
Posts: 268
Joined: Tue Jun 03, 2003 3:19 pm

Re: [2.0.15] Redirect anonymous users to login

Post by ~Sentinel~ »

For those like me that are looking for exactly the same type of mod but for phpBB 3 then please read...

I have found out the following stuff. If all you want to do is keep people from seeing certain pages like the memberlist then this mod is indeed no longer needed in phpbb3. However, if like me you want to make your forum look very private and keep people from even seeing the index page unless they are logged in then read further.

I am sorry for posting here but I am getting no traction in the phpBB 3 mods request forum and I know there are coders in here that can figure this out in 2 seconds so here is the deal. In the phpBB 3 mods request forum I started the following topic... http://www.phpbb.com/community/viewtopi ... 2&t=896505

I think I found the answer but I need for some coder to look at it and tell me if this is good, bad or indifferent. Possibly even clean it up if needed. I'm sure it can be done better. I don't care who takes credit. All I want is to make sure that this works and is safe and done correctly. So any help is greatly appreciated.
User avatar
Ornette
Registered User
Posts: 56
Joined: Thu Mar 06, 2008 3:53 pm

Re: [2.0.15] Redirect anonymous users to login

Post by Ornette »

This mod *needs* to be 'cleaned up'

Esp. as it is linked from the Preventing SPAM - Bots and Humans thread...

Installing....
DJ Ornsman - Back To 93
Tuesday 9-11pm GMT on Stress Factor

http://www.stressfactor.co.uk
Robert Templeton
Registered User
Posts: 5
Joined: Wed Jul 20, 2005 6:28 am

Re: [2.0.15] Redirect anonymous users to login

Post by Robert Templeton »

Works like a charm! Thank you very much!

I may eventually update to phpBB3 but for such a modest board I'm not yet ready to invest the time and expected problems (using Attachment mod, some other mods, and a linked-in gallery - photoPost).
Post Reply

Return to “[2.0.x] MOD Database Cleanup”