// Copyright: Matthias Steffens and the file's // original author(s). // // This code is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY. Please see the GNU General Public // License for more details. // // File: ./error.php // Repository: $HeadURL: file:///svn/p/refbase/code/branches/bleeding-edge/error.php $ // Author(s): Matthias Steffens // // Created: 05-Jan-03, 16:35 // Modified: $Date: 2018-02-23 04:16:36 +0000 (Fri, 23 Feb 2018) $ // $Author: karnesky $ // $Revision: 1422 $ // This php script will display an error page // showing any error that did occur. It will display // a link to the previous search results page (if any) // Incorporate some include files: include 'initialize/db.inc.php'; // 'db.inc.php' is included to hide username and password include 'includes/header.inc.php'; // include header include 'includes/footer.inc.php'; // include footer include 'includes/include.inc.php'; // include common functions include 'initialize/ini.inc.php'; // include common variables // -------------------------------------------------------------------- // START A SESSION: // call the 'start_session()' function (from 'include.inc.php') which will also read out available session variables: start_session(false); // -------------------------------------------------------------------- // Initialize preferred display language: // (note that 'locales.inc.php' has to be included *after* the call to the 'start_session()' function) include 'includes/locales.inc.php'; // include the locales // -------------------------------------------------------------------- // [ Extract form variables sent through POST/GET by use of the '$_REQUEST' variable ] // [ !! NOTE !!: for details see & ] // Check if any error occurred while processing the database UPDATE/INSERT/DELETE // /referr if(!preg_match("/error.php/", $referer) && (strtolower(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST)) == strtolower($_SERVER['HTTP_HOST']))){ $errorNo = $_REQUEST['errorNo']; $errorMsg = $_REQUEST['errorMsg']; $errorMsg = stripSlashesIfMagicQuotes($errorMsg); // function 'stripSlashesIfMagicQuotes()' is defined in 'include.inc.php' // Extract the header message that was returned by originating script: $HeaderString = $_REQUEST['headerMsg']; $HeaderString = stripSlashesIfMagicQuotes($HeaderString); } else{ $errorMsg = "Unexpected Error."; $referer="/"; } // Extract the view type requested by the user (either 'Mobile', 'Print', 'Web' or ''): // ('' will produce the default 'Web' output style) if (isset($_REQUEST['viewType'])) $viewType = $_REQUEST['viewType']; else $viewType = ""; // Extract generic variables from the request: if (isset($_SESSION['oldQuery'])) $oldQuery = $_SESSION['oldQuery']; // get the query URL of the formerly displayed results page else $oldQuery = array(); // -------------------------------------------------------------------- // (4) DISPLAY HEADER & RESULTS // (NOTE: Since there's no need to query the database here, we won't perform any of the following: (1) OPEN CONNECTION, (2) SELECT DATABASE, (3) RUN QUERY, (5) CLOSE CONNECTION) // Show the login status: showLogin(); // (function 'showLogin()' is defined in 'include.inc.php') // (4a) DISPLAY header: // call the 'displayHTMLhead()' and 'showPageHeader()' functions (which are defined in 'header.inc.php'): displayHTMLhead(encodeHTML($officialDatabaseName) . " -- Error", "noindex,nofollow", "Feedback page that shows any error that occurred while using the " . encodeHTML($officialDatabaseName), "", false, "", $viewType, array()); showPageHeader($HeaderString); // Generate a 'search.php' URL that points to the formerly displayed results page: if (!empty($oldQuery)) $oldQueryURL = generateURL("search.php", "html", $oldQuery, true); // function 'generateURL()' is defined in 'include.inc.php' // Build appropriate links: $links = "\n" . "\n\t" . "\n\t\tChoose how to proceed:  "; // - provide a 'go back' link (the following would only work with javascript: Go Back") $links .= "\n\t\tGo Back"; // variable '$referer' is globally defined in function 'start_session()' in 'include.inc.php' // - provide a link to any previous search results: if (!empty($oldQuery)) $links .= "\n\t\t  -OR-  " . "\n\t\tDisplay previous search results"; // - we also include a link to the home page here: $links .= "\n\t\t  -OR-  " . "\n\t\tGoto " . encodeHTML($officialDatabaseName) . " Home" . "\n\t" . "\n"; // SHOW ERROR MESSAGE: echo "\n\n\n\t\n" . $links . "\n
Error " . encodeHTML($errorNo) . " : " . encodeHTML($errorMsg) . "" // function 'encodeHTML()' is defined in 'include.inc.php' . "
"; // -------------------------------------------------------------------- // DISPLAY THE HTML FOOTER: // call the 'showPageFooter()' and 'displayHTMLfoot()' functions (which are defined in 'footer.inc.php') showPageFooter($HeaderString); displayHTMLfoot(); // -------------------------------------------------------------------- exit; // die ?>