- table_section_title(_("Version")." $version Build $build_version - "._("Login"));
- $value = $login_timeout ? $_SESSION['wa_current_user']->loginname : ($allow_demo_mode ? "demouser":"");
-
- text_row(_("User name"), "user_name_entry_field", $value, 20, 30);
-
- $password = $allow_demo_mode ? "password":"";
-
- echo "<tr><td>"._("Password")."</td><td><input type='password' name='password' value='$password' /></td></tr>\n";
-
- if ($login_timeout) {
- hidden('company_login_name', $_SESSION["wa_current_user"]->company);
- } else {
- if (isset($_SESSION['wa_current_user']->company))
- $coy = $_SESSION['wa_current_user']->company;
- else
- $coy = $def_coy;
- echo "<tr><td>"._("Company")."</td><td><select name='company_login_name'>\n";
- for ($i = 0; $i < count($db_connections); $i++)
- echo "<option value=$i ".($i==$coy ? 'selected':'') .">" . $db_connections[$i]["name"] . "</option>";
- echo "</select>\n";
- start_row();
- label_cell($demo_text, "colspan=2 align='center'");
- end_row();
- };
- end_table(1);
- echo "<center><input type='submit' value='"._("Login -->")."' name='SubmitUser' onclick='set_fullmode();' /></center>\n";
- end_form(1);
+ table_section_title(_("Version")." $version Build ".$SysPrefs->build_version." - "._("Login"));
+
+ $value = $login_timeout ? $_SESSION['wa_current_user']->loginname : ($SysPrefs->allow_demo_mode ? "demouser":"");
+
+ $allow = SECURE_ONLY !== true ? true : (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_NAME'] === "localhost";
+
+ if ($allow) {
+
+ text_row(_("User name"), "user_name_entry_field", $value, 20, 30);
+
+ $password = $SysPrefs->allow_demo_mode ? "password":"";
+
+ password_row(_("Password:"), 'password', $password);