Redirect the wrong access to the root pf the folder as index.php are in place
[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
26 function is_logged_in () {
27 global $squirrelmail_language, $frame_top, $base_uri;
28
29 if ( session_is_registered('user_is_logged_in') ) {
30 return;
31 } else {
32
33 if (!isset($frame_top) || $frame_top == '' ) {
34 $frame_top = '_top';
35 }
36
37 set_up_language($squirrelmail_language, true);
38
39 displayHtmlHeader( _("You must be logged in to access this page.") );
40
41 echo "<body bgcolor=\"ffffff\">\n" .
42 '&nbsp;<p><center><b>' .
43 _("You must be logged in to access this page.").'</b><br><br>' .
44 '<a href="' . $base_uri . '" target="' . $frame_top . '">' .
45 _("Go to the login page") . "</a>\n" .
46 "</center></body></html>\n";
47 exit;
48 }
49 }
50
51 ?>