]> code.citadel.org Git - citadel.git/blobdiff - ctdlphp/ctdlheader.php
* Cleaned up the pages in preparation for handing it off to the extremely
[citadel.git] / ctdlphp / ctdlheader.php
index 57e78cbad06b6759f0a0a6d1e455d2b16a2db552..512e6c9377b15a8dfc5a6a621be48333c13c33c9 100644 (file)
@@ -1,15 +1,42 @@
 <?PHP
 
+// $Id$
+//
+// Header and footer code to be included on every page.  Not only does it
+// contain some common markup, but it also includes some code glue that holds
+// the session together.
+//
+// Copyright (c) 2003 by Art Cancro <ajc@uncensored.citadel.org>
+// This program is released under the terms of the GNU General Public License.
+
 include "ctdlsession.php";
 include "ctdlprotocol.php";
 
 function bbs_page_header() {
-
        global $session;
 
+       if (strcmp('4.3.0', phpversion()) > 0) {
+               die("This program requires PHP 4.3.0 or newer.");
+       }
+
        establish_citadel_session();
 
-       echo <<<CITADEL_HEADER_DATA
+       // If the user is trying to call up any page other than
+       // login.php logout.php do_login.php,
+       // and the session is not logged in, redirect to login.php
+       //
+       if ($_SESSION["logged_in"] != 1) {
+               $filename = basename(getenv('SCRIPT_NAME'));
+               if (    (strcmp($filename, "login.php"))
+                  &&   (strcmp($filename, "logout.php"))
+                  &&   (strcmp($filename, "do_login.php"))
+               ) {
+                       header("Location: login.php");
+                       exit(0);
+               }
+       }
+
+       echo <<<LITERAL
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
@@ -18,7 +45,18 @@ function bbs_page_header() {
        <meta name="Description" content="Citadel BBS">
        <meta name="Keywords" content="citadel,bbs">
        <meta name="MSSmartTagsPreventParsing" content="TRUE">
-       <title>FIXME NAME BBS</title>
+       <title>
+LITERAL;
+
+       if ($_SESSION["serv_humannode"]) {
+               echo $_SESSION["serv_humannode"] ;
+       }
+       else {
+               echo "BBS powered by Citadel" ;
+       }
+
+       echo <<<LITERAL
+</title>
 </head>
 
 <body
@@ -29,22 +67,19 @@ function bbs_page_header() {
        alink="#DD0000"
 >
 
-Citadel test PHP thing.<BR>
-CITADEL_HEADER_DATA;
-
-echo "Your session ID is ", $session, "<BR>\n";
-echo "Dude, we're in ", `pwd`, "<BR>";
-echo "<A HREF=\"logout.php\">Log out</A><HR>";
-flush();
+<div align=right>
+<A HREF="logout.php">Log out</A>
+</div>
+<HR>
 
-test_for_echo();
+LITERAL;
 
 }
 
 
 function bbs_page_footer() {
        echo "<HR>";
-       echo "Copyright &copy; 2003 by The SCO Group.<BR>\n";
+       echo "Powered by Citadel.  And a few cups of coffee.<BR>\n";
        echo "</BODY></HTML>\n";
 }