$users_count = $req->rowCount(); // redirect to register page if no users are in the database if ($users_count === 0) { header('Location: ../register.php'); } else { $message = 'It looks like eLabFTW is already installed. Delete the config file if you wish to reinstall it.'; display_message('error_nocross', $message); custom_die(); } } ?> <h3>Preliminary checks</h3> <?php // CHECK WE ARE WITH HTTPS if (!\Elabftw\Elabftw\Tools::usingSsl()) { // get the url to display a link to click (without the port) $url = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']; $message = "eLabFTW works only in HTTPS. Please enable HTTPS on your server. Or click this link : <a href='{$url}'>{$url}</a>"; display_message('error_nocross', $message); custom_die(); } // CHECK PHP version if (!function_exists('version_compare') || version_compare(PHP_VERSION, '5.5', '<')) { $message = "Your version of PHP isn't recent enough. Please update your php version to at least 5.5"; display_message('error_nocross', $message); $errflag = true; } // Check for hash function if (!function_exists('hash')) { $message = "You don't have the hash function. On Freebsd it's in /usr/ports/security/php5-hash.";
* Login page * */ use Elabftw\Elabftw\Tools; require_once 'inc/common.php'; $page_title = _('Login'); $selected_menu = null; // Check if already logged in if (isset($_SESSION['auth']) && $_SESSION['auth'] === 1) { header('Location: experiments.php'); exit; } require_once 'inc/head.php'; $formKey = new \Elabftw\Elabftw\FormKey(); // if we are not in https, die saying we work only in https if (!Tools::usingSsl()) { // get the url to display a link to click (without the port) $url = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']; $message = "eLabFTW works only in HTTPS. Please enable HTTPS on your server. Or click this link : <a href='{$url}'>{$url}</a>"; display_message('error', $message); require_once 'inc/footer.php'; exit; } // Check if we are banned after too much failed login attempts $sql = "SELECT user_infos FROM banned_users WHERE time > :ban_time"; $req = $pdo->prepare($sql); $req->execute(array(':ban_time' => date("Y-m-d H:i:s", strtotime('-' . get_config('ban_time') . ' minutes')))); $banned_users_arr = array(); while ($banned_users = $req->fetch()) { $banned_users_arr[] = $banned_users['user_infos']; }