start.php3 1.38 KB
Newer Older
1
2
3
4
<?php
#
# Beware empty spaces (cookies)!
#
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# The point of this mess is to redirect people from the top level 
# index page (ie: no page specified) to the most appropriate page.
#
# 1. If no UID cookie comes in from the browser, just redirect to the
#    to the index page, maintaining secure/insecure mode. That is, if the
#    page was accessed via https, use https when redirecting to the index
#    page.
#
# 2. If a UID cookie comes in, check to see if the user is logged in. If
#    so, redirect to his user information page. If the user is logged in,
#    but came in with http, then we cannot actually confirm it (MAYBEVALID),
#    since the hash cookie will not be sent along, so we redirect back using
#    https so that we can confirm it (hash cookie sent). If it turns out that
#    the user is not logged in, fall back to #1 above.
19
20
21
# 
require("defs.php3");

22
if (($uid = GETUID())) {
23
    $check_status = CHECKLOGIN($uid) & CHECKLOGIN_STATUSMASK;
24

25
    if ($check_status == CHECKLOGIN_LOGGEDIN) {
26
27
28
29
30
	$LOC = "$TBBASE/showuser.php3?target_uid=$uid";
    }
    elseif (isset($SSL_PROTOCOL)) {
	$LOC = "$TBBASE/index.php3";
    }
31
32
33
    elseif ($check_status == CHECKLOGIN_MAYBEVALID) {
	$LOC = "$TBBASE/start.php3";
    }
34
35
36
37
    else 
	$LOC = "$TBDOCBASE/index.php3";
}
elseif (isset($SSL_PROTOCOL)) {
38
39
40
41
42
    $LOC = "$TBBASE/index.php3";
}
else {
    $LOC = "$TBDOCBASE/index.php3";
}
43

44
45
header("Location: $LOC");
?>