Make sure base_uri is correct (submitted by James Lewis)
[squirrelmail.git] / functions / auth.php
1 <?php
2
3 /**
4 * auth.php
5 *
6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * Contains functions used to do authentication.
10 *
11 * $Id$
12 */
13
14 require_once( '../functions/page_header.php' );
15
16 /* If a user opens a new session then comes back to this one,
17 * $base_uri isn't set because it the session is invalid.
18 */
19
20 if (! isset($base_uri)) {
21 ereg ('(^.*/)[^/]+/[^/]+$', $PHP_SELF, $regs);
22 $base_uri = $regs[1];
23 }
24
25 function is_logged_in () {
26 global $squirrelmail_language, $frame_top, $base_uri;
27
28 if ( session_is_registered('user_is_logged_in') ) {
29 return;
30 }
31
32 if (!isset($frame_top) || $frame_top == '' ) {
33 $frame_top = '_top';
34 }
35
36 set_up_language($squirrelmail_language, true);
37
38 displayHtmlHeader( 'SquirrelMail', '', FALSE );
39
40 echo "<body bgcolor=\"ffffff\">\n" .
41 '<br><br><center><b>' .
42 _("You must be logged in to access this page.").'</b><br><br>' .
43 "<a href=\"$base_uri" . "src/login.php\" target=\"$frame_top\">"._("Go to the login page")."</a>\n" .
44 "</center></body></html>\n";
45 exit;
46 }
47
48 ?>