2 /*--------------------------------------------------\
4 |---------------------------------------------------|
6 | http://open-accounting.sourceforge.net/ |
7 | by KylieTech Consulting |
8 | http://frontaccounting.com/ |
9 | by Joe Hunt Consulting |
10 \--------------------------------------------------*/
12 function output_html($text)
15 return in_ajax() ? fmt_errors() : ($before_box.fmt_errors().$text);
18 if (!isset($path_to_root))
23 include_once($path_to_root . "/includes/current_user.inc");
26 // Make sure this directory exists and is writable!
27 $session_save_path = dirname(__FILE__).'/tmp/';
30 $session_save_path = session_save_path();
31 if (strpos($session_save_path, ";") !== false)
32 $session_save_path = substr($session_save_path, strpos($session_save_path, ";") + 1);
34 if (isset($session_save_path))
36 session_save_path($session_save_path);
37 unset($session_save_path);
39 if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_to_root']))
40 die("Restricted access");
41 include_once($path_to_root . "/includes/lang/language.php");
42 include_once($path_to_root . "/config_db.php");
43 include_once($path_to_root . "/config.php");
46 include_once($path_to_root . "/includes/main.inc");
48 //----------------------------------------------------------------------------------------
56 //----------------------------------------------------------------------------------------
60 echo "<center><br><br><font size='5' color='red'><b>" . _("Incorrect Password") . "<b></font><br><br>";
61 echo "<b>" . _("The user and password combination is not valid for the system.") . "<b><br><br>";
63 echo _("If you are not an authorized user, please contact your system administrator to obtain an account to enable you to use the system.");
64 echo "<br><a href='javascript:history.go(-1)'>" . _("Back") . "</a>";
71 //----------------------------------------------------------------------------------------
73 function check_page_security($page_security)
75 if (!$_SESSION["wa_current_user"]->check_user_access())
77 echo "<br><br><br><center>";
78 echo "<b>" . _("Security settings have not been defined for your user account.");
79 echo "<br>" . _("Please contact your system administrator.") . "</b>";
85 if (!$_SESSION["wa_current_user"]->can_access_page($page_security))
87 page(_("Access denied"));
88 echo "<center><br><br><br><b>";
89 echo _("The security settings on your account do not permit you to access this function");
91 echo "<br><br><a href='javascript:history.go(-1)'>" . _("Back") . "</a>";
92 echo "<br><br><br><br>";
93 //echo '<script type="text/javascript">';
94 //echo 'alert("' . _("The security settings on your account do not permit you to access this function") . '");';
95 //echo 'history.go(-1)';
103 //----------------------------------------------------------------------------------------
104 if (!isset($_SESSION["wa_current_user"]) ||
105 (isset($_SESSION["wa_current_user"]) && !$_SESSION["wa_current_user"]->logged_in()))
108 $_SESSION["wa_current_user"] = new current_user();
111 if (!isset($_POST["user_name_entry_field"]) or $_POST["user_name_entry_field"] == "")
113 include($path_to_root . "/access/login.php");
117 include_once("ajax.inc");
119 // intercept all output to destroy it in case of ajax call
120 register_shutdown_function('ob_end_flush');
121 ob_start('output_html',0);
122 // colect all error msgs
123 set_error_handler('error_handler' /*, errtypes */);
125 if (isset($_POST["user_name_entry_field"]))
127 $succeed = $_SESSION["wa_current_user"]->login($_POST["company_login_name"],
128 $_POST["user_name_entry_field"],
129 md5($_POST["password"]));
133 // Incorrect password
138 // Run with debugging messages for the system administrator(s) but not anyone else
139 /*if (in_array(15, $security_groups[$_SESSION["AccessLevel"]])) {
145 //----------------------------------------------------------------------------------------
147 check_page_security($page_security);