3 $NEL_SETUP_SESSION = true;
4 if (file_exists( '../config.php')) {
6 if ((!isset($_SESSION['nelSetupAuthenticated'])) ||
$_SESSION['nelSetupAuthenticated'] != 1) {
7 if (basename($_SERVER["SCRIPT_NAME"]) != "auth.php") {
8 header("Cache-Control: max-age=1");
9 header('Location: auth.php', true, 303);
10 throw new SystemExit();
13 } else if (basename($_SERVER["SCRIPT_NAME"]) != "install.php") {
14 header("Cache-Control: max-age=1");
15 header('Location: install.php', true, 303);
16 throw new SystemExit();
22 <meta charset
="utf-8">
23 <meta http
-equiv
="X-UA-Compatible" content
="IE=edge">
24 <meta name
="viewport" content
="width=device-width, initial-scale=1">
25 <title
>Ryzom Core |
<?php
print(htmlentities($pageTitle)); ?
></title
>
26 <link href
="css/bootstrap.min.css" rel
="stylesheet">
30 function printalert($type, $message) {
31 print '<div class="alert alert-' . $type . '" role="alert">';
35 function is__writable($path) {
36 if ($path[strlen($path) - 1] == '/' ||
$path[strlen($path) - 1] == '\\') {
37 return is__writable($path.uniqid(mt_rand()).'.tmp');
40 if (file_exists($path)) {
41 if (!($f = @fopen
($path, 'r+'))) {
48 if (!($f = @fopen
($path, 'w'))) {
55 function validate_writable($continue, $path) {
56 if (!is__writable($path)) {
57 printalert("danger", "Failed to get write permissions on " . htmlentities($path));
62 function create_use_database($continue_r, $con, $database) {
63 $continue = $continue_r;
65 $sql = "CREATE DATABASE `" . mysqli_real_escape_string($con, $database) . "` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;";
66 if (mysqli_query($con, $sql)) {
67 printalert("success", "Database <em>" . $database . "</em> created");
69 printalert("danger", "Error creating <em>" . $database . "</em> database: " . mysqli_error($con));
74 $sql = "USE `" . mysqli_real_escape_string($con, $database) . "`;";
75 if (mysqli_query($con, $sql)) {
76 printalert("success", "Database <em>" . $database . "</em> selected");
78 printalert("danger", "Error selecting <em>" . $database . "</em> database: " . mysqli_error($con));
84 function update_database_structure($continue_r, $con, $file) {
85 $continue = $continue_r;
86 global $PRIVATE_PHP_PATH;
88 $sql = file_get_contents($PRIVATE_PHP_PATH . "/setup/sql/" . $file);
90 printalert("danger", "Cannot read <em>" . $file . "</em>");
93 if (mysqli_multi_query($con, $sql)) {
94 printalert("success", "Database structure updated using <em>" . $file . "</em>");
95 while (mysqli_more_results($con) && mysqli_next_result($con)) {
99 printalert("danger", "Error updating database using <em>" . $file . "</em>: " . mysqli_error($con));
109 <div style
="margin-left: auto; margin-right: auto; padding-left: 24px; padding-right: 24px; padding-bottom: 24px; max-width: 1024px;">
111 <div
class="page-header">
112 <h1
>Ryzom Core
<small
><?php
print(htmlentities($pageTitle)); ?
></small
></h1
>
119 // Change to root directory
121 printalert("danger", "Cannot change to public PHP root directory");
127 <!-- --------------------------------------------------------------- -->