Odyssey
broker.prg
1 <?php
2 
3  /*
4  * File: broker
5  *
6  * Purpose: This script will analyze the URL and include the correct script to execute.
7  * It will do a simple include
8  *
9  *
10  */
11 
12 
13  try {
14  /*
15  * **************************
16  * SET ENVIRONMENT VARIABLES
17  * **************************
18  */
19  // ** File System Path to the PHP Banking Scripts to be included
20  $_HOMEBANKING_INC_PATH = "/home/httpd/banking/includes/";
21 
22  // ** File System Path to the PHP Banking Library Scripts
23  $_HOMEBANKING_LIB_PATH = "/home/httpd/library/";
24 
25 
26 
27  /*
28  * *******************************
29  * Determine the script to load *
30  * *******************************
31  */
32  if ($_SERVER['SCRIPT_NAME'] != $_SERVER['PHP_SELF']) {
33  // *** ONLY STRIP OFF END IF they are different. The reason is they are blank so it will later set the default
34  $remainDir = str_ireplace($_SERVER['SCRIPT_NAME'] . '/', '', $_SERVER['PHP_SELF']);
35  }
36  // remainDir - this is now all the text after loaded script, however, I need to remove anything after '/'
37  $loadScript = substr($remainDir, 0, (strpos($remainDir, '/') ? strpos($remainDir, '/') : strlen($remainDir)));
38  $loadScript = ($loadScript == '' ? 'hcuLogin' : $loadScript);
39  /*
40  * END
41  */
42 
43 
44  /*
45  * Following variables will now be set
46  *
47  * brokerScript - This is the actual script that will be loaded
48  *
49  *
50  */
51  $brokerScript = '';
52 
53  switch ($loadScript) {
54  case 'hcuLogin':
55  $brokerScript = 'hcuLogin';
56  }
57 
58 
59  if ($brokerScript != '') {
60  $fileToInclude = $_HOMEBANKING_INC_PATH . $brokerScript;
61  if (is_readable($fileToInclude)) {
62  include($fileToInclude);
63  } else {
64  throw new ErrorException('unable to read the file ');
65  }
66  }
67 
68  } catch (Throwable $t) {
69 
70  } catch (Error $e) {
71  // Error Object - catches most PHP 5.x fatal or recoverable errors
72 
73  } catch (Exception $e) {
74 
75 
76  // } finally { // *this will be executed before normal operation resumes
77  }