opensmtpdadmin/setup.php

47 lines
2.0 KiB
PHP

<?php
/**
* OpenSMTPD Admin Refactor
* by Jeroen Janssen <jeroen at laylo dot io>
* Copyright (c) 2022 LAYLO
*/
// Check whether the configuration file exists - bail if that is the case
if (file_exists(realpath("./conf.php"))) {
print 'It seems that conf.php is already configured. Please delete setup.php to continue.';
die();
}
// Define the app specifics
DEFINE('APP_NAME', 'OpenSMTPD Admin Setup Checker');
DEFINE('VERSION', '1.1');
// Start generating the HTML output
$html = '<html>';
$html .= '<head>';
$html .= '<title></title>';
$html .= '</head>';
$html .= '<body>';
$html .= '<img id="login_header_logo" src="images/postbox.png" />';
$html .= '<img id="login_header_logo" height="30px" src="images/opensmtpdadmin.png" />';
$html .= '<h1>' . APP_NAME . ' v' . VERSION . '</h1>';
$html .= '<p>It seems that you are running this version of OpenSMTPD Admin for the first time.</p>';
$html .= '<table>';
$html .= '<tr>';
$html .= '<td><strong>PHP version:</strong></td>';
$html .= (version_compare(PHP_VERSION, '7.4.0') >= 0) ? '<td><span style="color:green;">' . phpversion() . '</td>' : '<td><span style="color:red;">' . phpversion() . '</span></td>';
$html .= '</tr><tr>';
$html .= '<td><strong>SQL support:</strong></td>';
$html .= (extension_loaded('mysqli')) ? '<td><span style="color:green;">MySQL/MariaDB</span>' : '<td><span style="color:red;">MySQL/MariaDB</span>';
$html .= '</tr><tr>';
$html .= '<td><strong>Functions:</strong></td>';
$html .= (extension_loaded('pcre')) ? '<td><span style="color:green;">pcre</span>' : '<td><span style="color:red;">pcre</span>';
$html .= (function_exists('get_magic_quotes_gpc')) ? ' - <span style="color:green;">get_magic_quotes_gpc</span>' : ' - <span style="color:red;">get_magic_quotes_gpc</span>';
$html .= (function_exists('session_start')) ? ' - <span style="color:green;">session_start</span></td>' : ' - <span style="color:red;">session_start</span></td>';
$html .= '</tr>';
$html .= '</table>';
$html .= '</body>';
$html .= '</html>';
print $html;
die();
?>