Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 10:21 am EDT
Geeklog Forums
Redirecting Anonymous Users
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?
In a world without walls and fences, who needs Windows and Gates?
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?
7
10
Quote
Status: offline
Tony
Site Admin
Admin
Registered: 12/17/01
Posts: 405
Location:Urbandale, Iowa
Add this to the top of your PHP file you want to protect after your include of lib-common.php:
The reason people blame things on previous generations is that there's only one other choice.
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.
8
5
Quote
All times are EDT. The time is now 10:21 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content