48ca29c559ffb13e92957e616ae364289b2d8a9b
[citadel.git] / ctdlphp / ctdlheader.php
1 <?PHP
2
3 // $Id$
4 //
5 // Header and footer code to be included on every page.  Not only does it
6 // contain some common markup, but it also includes some code glue that holds
7 // the session together.
8 //
9 // Copyright (c) 2003 by Art Cancro <ajc@uncensored.citadel.org>
10 // This program is released under the terms of the GNU General Public License.
11
12 include "ctdlsession.php";
13 include "ctdlprotocol.php";
14
15 function bbs_page_header() {
16         global $session;
17
18         if (strcmp('4.3.0', phpversion()) > 0) {
19                 die("This program requires PHP 4.3.0 or newer.");
20         }
21
22         establish_citadel_session();
23
24         // If the user is trying to call up any page other than
25         // login.php logout.php do_login.php,
26         // and the session is not logged in, redirect to login.php
27         //
28         if ($_SESSION["logged_in"] != 1) {
29                 $filename = basename(getenv('SCRIPT_NAME'));
30                 if (    (strcmp($filename, "login.php"))
31                    &&   (strcmp($filename, "logout.php"))
32                    &&   (strcmp($filename, "do_login.php"))
33                 ) {
34                         header("Location: login.php");
35                         exit(0);
36                 }
37         }
38
39         echo <<<LITERAL
40
41 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
42 <html>
43 <head>
44         <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
45         <meta name="Description" content="Citadel BBS">
46         <meta name="Keywords" content="citadel,bbs">
47         <meta name="MSSmartTagsPreventParsing" content="TRUE">
48         <title>
49 LITERAL;
50
51         if ($_SESSION["serv_humannode"]) {
52                 echo $_SESSION["serv_humannode"] ;
53         }
54         else {
55                 echo "BBS powered by Citadel" ;
56         }
57
58         echo <<<LITERAL
59 </title>
60 </head>
61
62 <body
63         text="#000000"
64         bgcolor="#FFFFFF"
65         link="#0000FF"
66         vlink="#990066"
67         alink="#DD0000"
68 >
69
70 LITERAL;
71
72         echo "Your session ID is ", $session, "<BR>\n";
73         echo "<A HREF=\"logout.php\">Log out</A><HR>";
74         // flush();
75         // test_for_echo();
76 }
77
78
79 function bbs_page_footer() {
80         echo "<HR>";
81         echo "Powered by Citadel.  And a few cups of coffee.<BR>\n";
82         echo "</BODY></HTML>\n";
83 }
84
85 ?>