Status: offline

squatty

Forum User
Full Member
Registered: 01/21/02
Posts: 269
What's the best way to determine if a user is anonymous vs. logged in?

I have some pages on my site (pages, not blocks) that I would like to only make accessible to registered users. If a user is not logged in they would be redirected to the registration page or a please register to see this page. If a user is logged in they would then get the page they requested.

Can anyone point me at the Geeklog code that would help with the above scenario?

Thanks,
Danny


In a world without walls and fences, who needs Windows and Gates?

Status: offline

Tony

Site Admin
Admin
Registered: 12/17/01
Posts: 405
Add this to the top of your PHP file you want to protect after your include of lib-common.php:

if (!($_USER['uid'] > 1)) {
   echo COM_refresh('url_to_some_other_page');
}

-----
The reason people blame things on previous generations is that there's only one other choice.


The reason people blame things on previous generations is that there's only one other choice.

Status: offline

squatty

Forum User
Full Member
Registered: 01/21/02
Posts: 269
Thanks! Sometimes it's the simplest things that make Geeklog so great!
In a world without walls and fences, who needs Windows and Gates?