Make sure base_uri is correct (submitted by James Lewis)
[squirrelmail.git] / functions / auth.php
CommitLineData
3c13b9fb 1<?php
2
35586184 3/**
4 * auth.php
5 *
15e6162e 6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
35586184 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
35586184 14require_once( '../functions/page_header.php' );
1026ec43 15
27e0f2b6 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
20if (! isset($base_uri)) {
21 ereg ('(^.*/)[^/]+/[^/]+$', $PHP_SELF, $regs);
22 $base_uri = $regs[1];
23}
24
e110c214 25function is_logged_in () {
88cb1b4d 26 global $squirrelmail_language, $frame_top, $base_uri;
2d367c68 27
e110c214 28 if ( session_is_registered('user_is_logged_in') ) {
29 return;
30 }
2d367c68 31
88cb1b4d 32 if (!isset($frame_top) || $frame_top == '' ) {
d03f3582 33 $frame_top = '_top';
34 }
35
e110c214 36 set_up_language($squirrelmail_language, true);
2d367c68 37
e110c214 38 displayHtmlHeader( 'SquirrelMail', '', FALSE );
2ba13803 39
e110c214 40 echo "<body bgcolor=\"ffffff\">\n" .
41 '<br><br><center><b>' .
42 _("You must be logged in to access this page.").'</b><br><br>' .
2fa4a9b7 43 "<a href=\"$base_uri" . "src/login.php\" target=\"$frame_top\">"._("Go to the login page")."</a>\n" .
e110c214 44 "</center></body></html>\n";
45 exit;
46}
3c13b9fb 47
80e86e94 48?>