make e2e run a bit more efficient; rather than always run 3 times, only do that if...
[openemr.git] / index.php
blobba6c24ce746eda76b4b94212206aa8e4d0cb008b
1 <?php
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
7 // Set the site ID if required. This must be done before any database
8 // access is attempted.
10 if (!empty($_GET['site'])) {
11 $site_id = $_GET['site'];
12 } elseif (is_dir("sites/" . $_SERVER['HTTP_HOST'] ?? '')) {
13 $site_id = $_SERVER['HTTP_HOST'] ?? '';
14 } else {
15 $site_id = 'default';
18 if (empty($site_id) || preg_match('/[^A-Za-z0-9\\-.]/', $site_id)) {
19 die("Site ID '" . htmlspecialchars($site_id, ENT_NOQUOTES) . "' contains invalid characters.");
22 require_once "sites/$site_id/sqlconf.php";
24 if ($config == 1) {
25 header("Location: interface/login/login.php?site=$site_id");
26 } else {
27 header("Location: setup.php?site=$site_id");