FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


How can i make anonymous need to registered to before...





Philip
How can i make anonymous need to registered to before view member's page, faq page, and all page ?

i mean to redirect the user in all phpbb pages to register first.

thanks,
TomS
open overall_header.tpl
in root/templates/subSilber/ (replace subSilber with template name)

Find the code
Code:
<a href="{U_MEMBERLIST}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_members.gif" width="12" height="13" border="0" alt="{L_MEMBERLIST}" hspace="3" />{L_MEMBERLIST}</a>


Add before:
Code:
<!-- BEGIN switch_user_logged_in-->


Add after:
Code:
<!-- END switch_user_logged_in -->

<!-- BEGIN switch_user_logged_out-->
<a href="{U_REGISTER}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_register.gif" width="12" height="13" border="0" alt="{L_MEMBERLIST}" hspace="3" />{L_MEMBERLIST}</a>
<!-- END switch_user_logged_out -->


So if you're logged out and klick on Memberlist you'll come to the register site. If logged in, you'll see the memberlist.

Do that for every link, you want to leed to register-site if not logged in.
Philip
glek that will make many2x code change, isn;t that a easy way ?
and if using that a user still can copy link http://www.frihost.com/forums/memberlist.php
to url and go for it --"

it;'s not securely enough yet i think ..
SlowWalkere
I'm not familiar with the phpbb code, so I wouldn't know exactly how to implement it, but there is an easier way to do it in theory...

On my site I have a .php file that I include at the top of every page. It initializes sessions, checks if the user is logged in, and does other initialization stuff. When the user logs in successfully, I store his user id in a session variable. If that variable is unset (i.e. he hasn't logged in yet that session), I set it to 0 and a uid of 0 is anonymous/guest.

So if I wanted to re-direct the anonymous user to the log-in page whenever he accessed any page on the site, I would go to that include file, go to where the script checks if the user is logged in.

Normally, I have...
Code:
if (!isset($_SESSION['uid']))
    $_SESSION['uid'] = 0;


To add the redirect I would simply add the line...
Code:
header("Location: login.php");

in that if statement. Everytime a page loads, if the user is not logged in he will be redirected to login.php (or whatever the login page is).

If you want to put that into your phpbb, it's up to you or someone else to figure out that part Wink

- Walkere
Philip
yes indeed i know how to using that,
but since there;s many phpbb pages, there should be easy way,
doesn't someone here know to use phpbb ? Razz

i wasn;t try to using phpbb.com support yet, since here it's more easyly for chit chat about php Razz
and although that i need point here huahua lolz *joke, i hope this forum moderator don;t get mad with me hehe Razz*
Related topics
Q: about selling domains
pHOTO PLEASE
Google Analytics
Post and get A LOT OF FRIH$
Register for 18 Frih$ Re-registering allowed!!!! First 5 !
Register for 40 FRIH$!!!
Hosting Package Information
Rampant Insanity - Crits Wanted!
attention to firhost.com
==(Sign Up to A New Bookmarking Site for Frih$)==
30FRIH$ to join forum :: Now Higher Price Paid!
Site Staff Members and MediaWiki Editors Wanted
UK Co2 emissions tax
Has you been banned from a site you never registered?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.