[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

jurjenh
Registered User
Posts: 17
Joined: Wed Feb 14, 2007 10:53 am
Location: Ede, Netherlands

Re: [2.0.15] Redirect anonymous users to login

Post by jurjenh » Mon Oct 22, 2007 11:02 am

I read this useful MOD is on the Cleanup list since it's not been updated for a long time.
Anyone taking any action? If not, what are the consequences for us humble users?
Is there an alternative if we want to set up a closed BB?

User avatar
alan081954
Registered User
Posts: 145
Joined: Sun Oct 01, 2006 8:22 pm
Location: Adams,Tn.
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by alan081954 » Tue Dec 25, 2007 4:06 pm

Why does this download as a "movie" file?

diabolic.bg
Registered User
Posts: 447
Joined: Mon Dec 11, 2006 3:41 pm
Location: Bulgaria, Sofia
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by diabolic.bg » Tue Dec 25, 2007 4:26 pm

alan081954 wrote:Why does this download as a "movie" file?
Open the "movie" file with notepad. :D

iwish.iwish
Registered User
Posts: 6
Joined: Fri Dec 28, 2007 11:29 am

Re: [2.0.15] Redirect anonymous users to login

Post by iwish.iwish » Fri Dec 28, 2007 11:40 am

hi
sorry but , where do i install this file to ?
and after i install , what are the changes tt i need to make ?

thanks :)

diabolic.bg
Registered User
Posts: 447
Joined: Mon Dec 11, 2006 3:41 pm
Location: Bulgaria, Sofia
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by diabolic.bg » Fri Dec 28, 2007 11:54 am

Read the install file...

Code: Select all

##############################################################
## MOD Title: Redirect anonymous users to login
## MOD Author: StefanKausL < stefan@kuhlins.de > (Stefan Kuhlins) http://kuhlins.de/
## MOD Description: This very simple MOD redirects anonymous
## users to the login page instead of showing member, groups,
## or profile pages. That way anonymous users can't see
## registered user's data.
## MOD Version: 1.0.8
##
## Installation Level:	Easy
## Installation Time:	1 Minute
## Files To Edit: 
		groupcp.php, 
		memberlist.php, 
		profile.php, 
		viewonline.php
##
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## To make this MOD work, the forums must be set to registered users only.
## Go to the "Forum Permissions Control" section and
## set "View", "Read", "Post", etc. to "REG".
## This stops guests from viewing, reading, and posting.
##
## Search engines did not see posts that are for registered users only,
## but you can set some forums open to all users including search engines.
## Go to "Forum Permissions Control" in the admin section and
## set "View" and "Read" to "ALL".
##
## Intentionally I didn't put the redirect on my index and search page,
## because I want some visible forums and topics,
## especially for the rules everybody should read before registering.
## But the code will work in the files index.php and search.php as well.
## Just insert the redirect code the same way as for memberlist.php and
## viewonline.php.
##
## CAUTION:
## Do not put the redirect code after init_userprefs($userdata); in
## profile.php, because that way nobody can register!
##
##############################################################
## MOD History:
##
##   2005-05-21 - Version 1.0.8
##	  - Security risk fixed: use values instead of QUERY_STRING for redirect.
##	    Thanks to pip and Shanana for pointing out this security risk.
##	  - Bug fix: & instead of & for session id in URLs.
##
##   2005-04-10 - Version 1.0.7
##	  - After log on redirect to the desired page instead of the index.
##
##   2005-04-02 - Version 1.0.6
##	  - Stopped access to groups with group id.
##
##   2005-04-02 - Version 1.0.5
##	  - Now, the anonymous redirect is included later on in group_cp.php.
##	    Thanks to blackpeter for this improvement.
##
##   2005-03-25 - Version 1.0.4
##	  - Reload because the old MOD link did not work.
##
##   2004-08-18 - Version 1.0.3
##	  - Updated for phpBB 2.0.10 (only the number of tabs was changed)
##	  - Added notes
##
##   2004-07-28 - Version 1.0.2
##	  - Now it follows phpBB's coding standards.
##
##   2004-07-12 - Version 1.0.1
##	  - Bug fix: Anonymous users could not register.
##	  - Improvement: Anonymous users should not see who's online.
##
##   2004-07-09 - Version 1.0.0
##	  - Initial version
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]---------------------------------------------
#
groupcp.php

#
#-----[ FIND ]---------------------------------------------
#
	if ( isset($HTTP_GET_VARS['validate']) )
	{
		if ( !$userdata['session_logged_in'] )
		{
			redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
		}
	}
#
#-----[ REPLACE WITH ]------------------------------------------
#
	if ( !$userdata['session_logged_in'] )
	{
		redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
	}

#
#-----[ FIND ]---------------------------------------------
#
			$s_member_groups = '<select name="' . POST_GROUPS_URL . '">' . $s_member_groups_opt . "</select>";
		}
	}

#
#-----[ AFTER, ADD ]---------------------------------------------
#
	else
	{
		redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx", true));
	}

#
#-----[ OPEN ]---------------------------------------------
#
memberlist.php

#
#-----[ FIND ]---------------------------------------------
#
init_userprefs($userdata);

#
#-----[ AFTER, ADD ]---------------------------------------------
#
if ($userdata['user_id'] == ANONYMOUS)
{
	redirect(append_sid("login.$phpEx?redirect=memberlist.$phpEx", true));
}

#
#-----[ OPEN ]---------------------------------------------
#
profile.php

#
#-----[ FIND ]---------------------------------------------
#
	if ( $mode == 'viewprofile' )
	{

#
#-----[ AFTER, ADD ]---------------------------------------------
#
		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));
		}

#
#-----[ OPEN ]---------------------------------------------
#
viewonline.php

#
#-----[ FIND ]---------------------------------------------
#
init_userprefs($userdata);

#
#-----[ AFTER, ADD ]---------------------------------------------
#
if ($userdata['user_id'] == ANONYMOUS)
{
	redirect(append_sid("login.$phpEx?redirect=viewonline.$phpEx", true));
}

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

iwish.iwish
Registered User
Posts: 6
Joined: Fri Dec 28, 2007 11:29 am

Re: [2.0.15] Redirect anonymous users to login

Post by iwish.iwish » Fri Dec 28, 2007 12:15 pm

yes, thanks alot!
i couldnt find this: groupcp.php


i have only: _infobody _pending _userbody all in .tpl

diabolic.bg
Registered User
Posts: 447
Joined: Mon Dec 11, 2006 3:41 pm
Location: Bulgaria, Sofia
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by diabolic.bg » Fri Dec 28, 2007 12:33 pm

All files - groupcp.php, memberlist.php, profile.php, viewonline.php - are in your root /phpbb2/ directory.
But what is _infobody _pending _userbody all in .tpl ? I never hear it before. Maybe your use another platform - not phpbb ? :?

iwish.iwish
Registered User
Posts: 6
Joined: Fri Dec 28, 2007 11:29 am

Re: [2.0.15] Redirect anonymous users to login

Post by iwish.iwish » Fri Dec 28, 2007 12:39 pm

i use phpbb. my style is the PurplePearl.
i don't have any in php but in tpl. whats wrong :shock:

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51185
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 » Fri Dec 28, 2007 12:42 pm

This is a mod to your php files. No tpl files are changed.

iwish.iwish
Registered User
Posts: 6
Joined: Fri Dec 28, 2007 11:29 am

Re: [2.0.15] Redirect anonymous users to login

Post by iwish.iwish » Fri Dec 28, 2007 12:43 pm

hmm i tink i know what wrong. found it.

tha nks! :lol:

diabolic.bg
Registered User
Posts: 447
Joined: Mon Dec 11, 2006 3:41 pm
Location: Bulgaria, Sofia
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by diabolic.bg » Fri Dec 28, 2007 12:45 pm

Maybe I guess - in your phpbb2 directory you see only names without .php extensions? It confuse you?

iwish.iwish
Registered User
Posts: 6
Joined: Fri Dec 28, 2007 11:29 am

Re: [2.0.15] Redirect anonymous users to login

Post by iwish.iwish » Fri Dec 28, 2007 12:57 pm

diabolic.bg wrote:Maybe I guess - in your phpbb2 directory you see only names without .php extensions? It confuse you?

ya!

& i don't have this part "if ( isset($HTTP_GET_VARS['validate']) )" also, i only have the bottom part of it.


continue changing & i get errors when i click on on Usergroups.
:?:

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 20810
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by RMcGirr83 » Mon Dec 31, 2007 4:06 pm

It's there....starts on line 395 of groupcp.php
else if ( $group_id )
{
//
// Did the group moderator get here through an email?
// If so, check to see if they are logged in.
//
if ( isset($HTTP_GET_VARS['validate']) )
{
if ( !$userdata['session_logged_in'] )
{
redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
}
}
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

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 » Thu Jan 10, 2008 10:25 pm

I have used this mod to redirect anonymous users. Works fine with one exception.

Regardless of whether the user is Registered or Anonymous, if you click on a user id to see their profile the following error message is displayed:
"Parse error: syntax error, unexpected T_ELSE in /data/dart16.com/forum/profile.php on line 89"

Does anyone know the fix?

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 20810
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by RMcGirr83 » Fri Jan 11, 2008 12:38 am

D16 wrote:I have used this mod to redirect anonymous users. Works fine with one exception.

Regardless of whether the user is Registered or Anonymous, if you click on a user id to see their profile the following error message is displayed:
"Parse error: syntax error, unexpected T_ELSE in /data/dart16.com/forum/profile.php on line 89"

Does anyone know the fix?
Post the 10 or so lines before and after that line in your file.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

Post Reply

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

Who is online

Users browsing this forum: No registered users and 3 guests