]> code.citadel.org Git - citadel.git/blobdiff - ctdlphp/ctdlheader.php
* Firmed up the login/logout process
[citadel.git] / ctdlphp / ctdlheader.php
index d35a62f2f34fb117e99b80f2ea37121fb7f65547..48ca29c559ffb13e92957e616ae364289b2d8a9b 100644 (file)
@@ -1,14 +1,40 @@
 <?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();
 
+       // 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
 
@@ -19,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