3v4l.org

run code in 300+ PHP versions simultaneously
<?php // SpaceBoard - the board with support for spaces // Copyright (C) 2012 GlitchMr // We have to expect PHP 4.0.0 without extensions until end of the tests. // Hack protection if (file_exists('../storage/sql.php')) { die('Please delete <kbd>storage/sql.php</kbd> to continue.'); } @session_start(); if (!empty($_GET['ignore_errors'])) { $_SESSION['space_ignore_errors'] = true; } $errors = array(); // If version_compare doesn't exist then you're seriously screwed. if (!function_exists('version_compare') || version_compare(PHP_VERSION, '5.2.4', '<') ) { $errors[] = 'You\'re using PHP ' . htmlspecialchars(PHP_VERSION) . ' but you need at least PHP 5.2.4'; } if (!class_exists('mysqli')) { $errors[] = '<code>mysqli</code> not found, but it\'s required.'; } if (!function_exists('mb_strlen')) { $errors[] = 'Multibyte String for PHP is not installed. It\'s required.'; } if (!function_exists('preg_match')) { $errors[] = 'Your PHP installation doesn\'t have PCRE. It\'s required ' . 'for SpaceBoard to work.'; } if (ini_get('register_globals')) { $errors[] = 'Your server has <a href="http://www.php.net/manual/en/' . 'security.globals.php">register_globals</a> enabled. It\'s' . ' unsupported and attempting to continue may result your ' . 'board being hacked.'; } if (!file_exists('../storage/plugins')) { // Make basic file storage for tests @mkdir('../storage'); @mkdir('../storage/3rdparty'); @mkdir('../storage/3rdparty/twig'); @mkdir('../storage/plugins'); } // If it doesn't exist after creation something went wrong. if (!file_exists('../storage/plugins')) { $errors[] = 'Your filesystem isn\'t writable. Make <kbd>storage</kbd> ' . 'directory in main directory of your board and give it ' . 'read and write rights.'; } if ($errors && empty($_SESSION['space_ignore_errors'])) { echo '<!DOCTYPE html><title>Runtime error!</title>', '<div style="border-top: 5px solid red;', 'border-bottom: 5px solid red;', 'background: #FEE;', 'padding: 5px">', '<p>Sorry, but your server cannot run SpaceBoard.<ul>'; foreach ($errors as $error) { echo "<li>$error"; } echo '</ul><p>Or, if you really want to continue you may ', '<a href="?ignore_errors=1">continue</a>. You have been warned ', 'through. Don\'t complain if your installation won\'t work.</div>'; exit; } // If we are at this point that means everything should be fine. We may load // installer and write stuff without bothering about lack of compatibility. chdir('..'); require_once 'lib/basics.php'; require_once 'lib/twig.php'; require_once 'lib/i18n.php'; require_once 'lib/functions.php'; require_once 'lib/sql.php'; // Initialize $error variable. $error = null; // The board doesn't exist, but we should know the theme. $theme = 'spaceboard'; // Also, language should be set to English $lang = 'en'; $fields = array( 'dbserver' => array( 'name' => __('install_server'), 'hint' => __('install_server_hint'), 'type' => 'text', 'value' => issetor($_POST['dbserver'], 'localhost'), ), 'dbname' => array( 'name' => __('install_name'), 'type' => 'text', 'value' => issetor($_POST['dbname'], ''), ), 'dbuser' => array( 'name' => __('install_user'), 'type' => 'text', 'value' => issetor($_POST['dbuser'], ''), ), 'dbpass' => array( 'name' => __('install_password'), 'type' => 'password', 'value' => issetor($_POST['dbpass'], ''), ), 'dbprefix' => array( 'name' => __('install_prefix'), 'hint' => __('install_prefix_hint'), 'type' => 'text', 'value' => issetor($_POST['dbprefix'], 'space_'), ), 'dbport' => array( 'name' => __('install_port'), 'hint' => __('install_port_hint'), 'type' => 'number', 'value' => issetor($_POST['dbport'], 3306), ), 'submit' => array( 'name' => __('install_submit'), 'type' => 'submit', 'value' => __('install_submit_button'), ), );

preferences:
40.84 ms | 402 KiB | 5 Q