Beehive PHP Cross Reference Discussion Forums

Source: /logon.php - 127 lines - 4156 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /*======================================================================
   4  Copyright Project Beehive Forum 2002
   5  
   6  This file is part of Beehive Forum.
   7  
   8  Beehive Forum is free software; you can redistribute it and/or modify
   9  it under the terms of the GNU General Public License as published by
  10  the Free Software Foundation; either version 3 of the License, or
  11  (at your option) any later version.
  12  
  13  Beehive Forum is distributed in the hope that it will be useful,
  14  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16  GNU General Public License for more details.
  17  
  18  You should have received a copy of the GNU General Public License
  19  along with Beehive; if not, write to the Free Software
  20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  21  USA
  22  ======================================================================*/
  23  
  24  // Bootstrap
  25  require_once  'boot.php';
  26  
  27  // Required includes
  28  require_once  BH_INCLUDE_PATH . 'cache.inc.php';
  29  require_once  BH_INCLUDE_PATH . 'constants.inc.php';
  30  require_once  BH_INCLUDE_PATH . 'format.inc.php';
  31  require_once  BH_INCLUDE_PATH . 'header.inc.php';
  32  require_once  BH_INCLUDE_PATH . 'html.inc.php';
  33  require_once  BH_INCLUDE_PATH . 'logon.inc.php';
  34  require_once  BH_INCLUDE_PATH . 'messages.inc.php';
  35  require_once  BH_INCLUDE_PATH . 'server.inc.php';
  36  // End Required includes
  37  
  38  // Don't cache this page
  39  cache_disable();
  40  
  41  // Retrieve the final_uri request
  42  if (isset($_GET['final_uri']) && strlen(trim($_GET['final_uri'])) > 0) {
  43  
  44      $available_files_preg = implode("|^", array_map('preg_quote_callback', get_available_files()));
  45  
  46      if (preg_match("/^$available_files_preg/u", trim($_GET['final_uri'])) > 0) {
  47          $final_uri = href_cleanup_query_keys($_GET['final_uri']);
  48      }
  49  
  50  } else if (isset($_GET['msg']) && validate_msg($_GET['msg'])) {
  51  
  52      $final_uri = "discussion.php?webtag=$webtag&amp;msg=" . $_GET['msg'];
  53  
  54  } else if (isset($_GET['folder']) && is_numeric($_GET['folder'])) {
  55  
  56      $final_uri = "discussion.php?webtag=$webtag&amp;folder=" . $_GET['folder'];
  57  
  58  } else if (isset($_GET['pmid']) && is_numeric($_GET['pmid'])) {
  59  
  60      $final_uri = "pm.php?webtag=$webtag&amp;mid=" . $_GET['pmid'];
  61  }
  62  
  63  // Delete the user's cookie as requested and send them back to the login form.
  64  if (isset($_GET['delete_cookie']) && ($_GET['delete_cookie'] == 'yes')) {
  65  
  66      html_remove_all_cookies();
  67  
  68      if (isset($final_uri)) {
  69  
  70          $final_uri = rawurlencode($final_uri);
  71          header_redirect("index.php?webtag=$webtag&final_uri=$final_uri", gettext("Cookies successfully deleted"));
  72  
  73      } else {
  74  
  75          header_redirect("index.php?webtag=$webtag", gettext("Cookies successfully deleted"));
  76      }
  77  
  78  } else if (isset($_POST['logon']) || isset($_POST['guest_logon'])) {
  79  
  80      if (logon_perform(true)) {
  81  
  82          if (isset($final_uri)) {
  83  
  84              $final_uri = rawurlencode($final_uri);
  85              header_redirect("index.php?webtag=$webtag&final_uri=$final_uri", gettext("You logged in successfully."));
  86  
  87          } else {
  88  
  89              header_redirect("index.php?webtag=$webtag", gettext("You logged in successfully."));
  90          }
  91  
  92      } else {
  93  
  94          if (isset($final_uri)) {
  95  
  96              $final_uri = rawurlencode(sprintf("logon.php?webtag=$webtag&logon_failed=true&final_uri=%s", rawurlencode($final_uri)));
  97              header_redirect("index.php?webtag=$webtag&final_uri=$final_uri", gettext("The username or password you supplied is not valid."));
  98  
  99          } else {
 100  
 101              $final_uri = rawurlencode("logon.php?webtag=$webtag&logon_failed=true");
 102              header_redirect("index.php?webtag=$webtag&final_uri=$final_uri", gettext("The username or password you supplied is not valid."));
 103          }
 104      }
 105  
 106  } else if (isset($_POST['other_logon'])) {
 107  
 108      if (isset($final_uri)) {
 109  
 110          $final_uri = rawurlencode($final_uri);
 111          header_redirect("index.php?webtag=$webtag&other_logon=true&final_uri=$final_uri");
 112  
 113      } else {
 114  
 115          header_redirect("index.php?webtag=$webtag&other_logon=true");
 116      }
 117  }
 118  
 119  html_draw_top();
 120  
 121  echo "<div align=\"center\">\n";
 122  
 123  logon_draw_form(LOGON_FORM_DEFAULT);
 124  
 125  echo "</div>\n";
 126  
 127  html_draw_bottom();

title

Description

title

Description

title

Description

title

title

Body