Welcome to Geeklog, Anonymous Tuesday, May 21 2024 @ 12:50 am EDT

Geeklog Forums

force login


Status: offline

gotascii

Forum User
Newbie
Registered: 10/11/04
Posts: 3
Ive searched the forum with every possible keyword combo, and Im sure that I still managed to miss the post that already covers this...but here goes...

I am using Gl as an intranet. I need to force every user to login before they can access ANY GL content. Is this possible and where should I start? Any hints or direction would be greatly appriciated. Thanks.
 Quote

Status: offline

gotascii

Forum User
Newbie
Registered: 10/11/04
Posts: 3
Ok I figured out a way to make this work but it seems like it needs some work. I have a feeling the general direction is right.

Add the following to the bottom of lib-common.php:
Text Formatted Code

$subject = $_CONF['site_url'] . '/users.php';
$pattern = '/(http://[^/]*)(/.*)/';
preg_match($pattern, $subject, $matches);

if ((!isset($_USER['uid'])) && ($HTTP_SERVER_VARS['REQUEST_URI'] != $matches[2])) {
        header('Location: ' . $_CONF['site_url'] . '/users.php');
}

 


This essentially restricts access to any php that includes lib-common (all of the docs in GL? ) except users.php. Any comments or suggestions?
 Quote

Status: offline

ScurvyDawg

Forum User
Full Member
Registered: 11/06/02
Posts: 523
Why not just use permissions?

GL has *nix style permissions, I would just utilize those rather than start a custom hack.

Good luck

 Quote

Status: offline

gotascii

Forum User
Newbie
Registered: 10/11/04
Posts: 3
Even if you set every object to only viewable you still get a blank looking index.php. Also, one can access calendar (even though it will be blank) and also the contacts page (with no contacts), etc. etc.. Those factors are not acceptable IMO when using the site as an intranet. My goal is to eventually point the redirect to a custom login page that shows only username & password prompt. SHouldn't be to hard, just create a simple form that matches loginform.thtml and points to user.php. It will be much more intranet like that way...I think hehe.
 Quote

All times are EDT. The time is now 12:50 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