mirror of
https://github.com/Nino85Whitman/OSMW-OpenSim-Manager-Web.git
synced 2026-08-14 00:57:48 +00:00
Update installer
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
-- --------------------------------------------------------
|
||||
-- Hôte: 127.0.0.1
|
||||
-- Version du serveur: 8.0.30 - MySQL Community Server - GPL
|
||||
-- SE du serveur: Win64
|
||||
-- HeidiSQL Version: 12.1.0.6537
|
||||
-- --------------------------------------------------------
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!50503 SET NAMES utf8mb4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
|
||||
-- Listage de la structure de la base pour osmw
|
||||
CREATE DATABASE IF NOT EXISTS `osmw` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
|
||||
USE `osmw`;
|
||||
|
||||
-- Listage de la structure de table osmw. config
|
||||
CREATE TABLE IF NOT EXISTS `config` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`cheminAppli` varchar(50) NOT NULL,
|
||||
`destinataire` varchar(50) NOT NULL,
|
||||
`Autorized` int NOT NULL,
|
||||
`NbAutorized` int NOT NULL,
|
||||
`VersionOSMW` varchar(50) NOT NULL,
|
||||
`urlOSMW` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
|
||||
|
||||
-- Listage des données de la table osmw.config : 1 rows
|
||||
/*!40000 ALTER TABLE `config` DISABLE KEYS */;
|
||||
INSERT INTO `config` (`id`, `cheminAppli`, `destinataire`, `Autorized`, `NbAutorized`, `VersionOSMW`, `urlOSMW`) VALUES
|
||||
(1, '/OSMW/', 'mymail@domain.com', 1, 4, 'Version 24.11', 'https://www.domain.com/');
|
||||
/*!40000 ALTER TABLE `config` ENABLE KEYS */;
|
||||
|
||||
-- Listage de la structure de table osmw. moteurs
|
||||
CREATE TABLE IF NOT EXISTS `moteurs` (
|
||||
`osAutorise` tinyint NOT NULL AUTO_INCREMENT,
|
||||
`id_os` varchar(50) NOT NULL,
|
||||
`name` varchar(50) NOT NULL,
|
||||
`version` varchar(50) NOT NULL,
|
||||
`address` varchar(50) NOT NULL,
|
||||
`DB_OS` varchar(50) NOT NULL,
|
||||
`hypergrid` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`osAutorise`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
|
||||
|
||||
-- Listage des données de la table osmw.moteurs : 1 rows
|
||||
/*!40000 ALTER TABLE `moteurs` DISABLE KEYS */;
|
||||
INSERT INTO `moteurs` (`osAutorise`, `id_os`, `name`, `version`, `address`, `DB_OS`, `hypergrid`) VALUES
|
||||
(1, 'Simulateur_1', 'Whitman Corporation', 'Opensim 0.9.3', 'C:/OPENSIM/', 'addon-modules/osgrid/config/osgrid.ini', 'hg.osgrid.org:80');
|
||||
/*!40000 ALTER TABLE `moteurs` ENABLE KEYS */;
|
||||
|
||||
-- Listage de la structure de table osmw. users
|
||||
CREATE TABLE IF NOT EXISTS `users` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`firstname` varchar(15) NOT NULL,
|
||||
`lastname` varchar(15) NOT NULL,
|
||||
`password` text NOT NULL,
|
||||
`privilege` int NOT NULL,
|
||||
`osAutorise` varchar(50) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
|
||||
|
||||
-- Listage des données de la table osmw.users : 2 rows
|
||||
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
|
||||
INSERT INTO `users` (`id`, `firstname`, `lastname`, `password`, `privilege`, `osAutorise`) VALUES
|
||||
(1, 'Super', 'Admin', 'dc79f6a0f51567c820d0535f0c72a77cc5152258', 4, '');
|
||||
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
|
||||
|
||||
/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */;
|
||||
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
|
||||
@@ -1 +0,0 @@
|
||||
No direct access ...
|
||||
+77
-41
@@ -25,6 +25,13 @@
|
||||
<form class="form-horizontal" action="" method="post">
|
||||
<input type="hidden" name="etape" value="1" />
|
||||
|
||||
<div class="form-group">
|
||||
<label for="hote" class="col-sm-2 control-label">IP server Host :</label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" type="text" name="server" maxlength="40" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="hote" class="col-sm-2 control-label">Database Host :</label>
|
||||
<div class="col-sm-4">
|
||||
@@ -52,14 +59,6 @@
|
||||
<input class="form-control" type="text" name="base" maxlength="40" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="base" class="col-sm-2 control-label">DNS Name Server :</label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" type="text" name="domaine" maxlength="40" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="base" class="col-sm-2 control-label">Username SSH :</label>
|
||||
@@ -93,8 +92,10 @@
|
||||
?>
|
||||
|
||||
<?php
|
||||
/*
|
||||
foreach($_POST as $key => $val) echo '$_POST["'.$key.'"]='.$val.'<br />';
|
||||
foreach($_GET as $key => $val) echo '$_GET["'.$key.'"]='.$val.'<br />';
|
||||
*/
|
||||
if (isset($_POST['etape']) AND $_POST['etape'] == 1)
|
||||
{
|
||||
// on crée une constante dont on se servira plus tard
|
||||
@@ -109,40 +110,38 @@ if (isset($_POST['etape']) AND $_POST['etape'] == 1)
|
||||
}
|
||||
|
||||
// on crée nos variables, et au passage on retire les éventuels espaces
|
||||
$server = trim($_POST['server']);
|
||||
$hote = trim($_POST['hote']);
|
||||
$login = trim($_POST['login']);
|
||||
$pass = trim($_POST['mdp']);
|
||||
$base = trim($_POST['base']);
|
||||
$domaine = trim($_POST['domaine']);
|
||||
if(isset($_POST['ussh'])){$ussh = $_POST['ussh'];}
|
||||
if(isset($_POST['pssh'])){$pssh = $_POST['pssh'];}
|
||||
|
||||
// on vérifie la connectivité avec le serveur avant d'aller plus loin
|
||||
try{ $bdd = new PDO('mysql:host='.$hote.';dbname='.$base.';charset=utf8', $login, $pass); }
|
||||
catch (Exception $e){ die('Erreur : ' . $e->getMessage()); }
|
||||
|
||||
$a = str_replace("-","",implode('-', str_split(substr(strtolower(md5(microtime().rand(1000, 9999))), 0, 40), 10)));
|
||||
$b = str_replace("-","",implode('-', str_split(substr(strtolower(md5(microtime().rand(1000, 9999))), 0, 40), 10)));
|
||||
echo $api_key = $a.$b;
|
||||
$a = str_replace("-","",implode('-', str_split(substr(strtolower(md5(microtime().rand(1000, 9999))), 0, 40), 10)));
|
||||
$b = str_replace("-","",implode('-', str_split(substr(strtolower(md5(microtime().rand(1000, 9999))), 0, 40), 10)));
|
||||
$api_key = $a.$b;
|
||||
|
||||
// le texte que l'on va mettre dans le config.php
|
||||
$texte = '
|
||||
<?php
|
||||
$hostname = "'.$domaine.'"; // Url of server
|
||||
$hostnameBDD = "'. $hote .'"; // IP of Bdd
|
||||
$userBDD = "'. $login .'"; // login
|
||||
$passBDD = "'. $pass .'"; // password
|
||||
$database = "'. $base .'"; // Name of BDD
|
||||
<?php
|
||||
$hostname = "'. $server .'"; // IP of server
|
||||
$hostnameBDD = "'. $hote .'"; // IP of Bdd
|
||||
$userBDD = "'. $login .'"; // login
|
||||
$passBDD = "'. $pass .'"; // password
|
||||
$database = "'. $base .'"; // Name of BDD
|
||||
|
||||
//FOR LINUX HOST SIMULATOR
|
||||
$usernameSSH = "'.$ussh.'";
|
||||
$passwordSSH = "'.$pssh.'";
|
||||
//FOR LINUX HOST SIMULATOR
|
||||
$usernameSSH = "'.$ussh.'";
|
||||
$passwordSSH = "'.$pssh.'";
|
||||
|
||||
$api_key="'.$api_key.'";
|
||||
$api_key="'.$api_key.'";
|
||||
|
||||
// Languages
|
||||
// fr / en /it
|
||||
$lang = "fr";
|
||||
// Languages
|
||||
// fr / en /it
|
||||
$lang = "fr";
|
||||
|
||||
?>';
|
||||
?>';
|
||||
|
||||
if (!$ouvrir = fopen($fichier, 'w'))
|
||||
{
|
||||
@@ -157,17 +156,54 @@ $lang = "fr";
|
||||
echo '<div class="alert alert-success">Creation of effected configuration file with success ...</div>';
|
||||
fclose($ouvrir);
|
||||
|
||||
// on vérifie la connectivité avec le serveur avant d'aller plus loin
|
||||
try{ $bdd = new PDO('mysql:host='.$hote.';charset=utf8', $login, $pass); }
|
||||
catch (Exception $e){ die('Erreur : ' . $e->getMessage()); }
|
||||
|
||||
$reponse = $bdd->query("CREATE DATABASE IF NOT EXISTS `".$base."`;");
|
||||
$reponse = $bdd->query("USE `".$base."`;");
|
||||
|
||||
$reponse = $bdd->query("CREATE TABLE IF NOT EXISTS `config` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`cheminAppli` varchar(50) NOT NULL,
|
||||
`destinataire` varchar(50) NOT NULL,
|
||||
`Autorized` int NOT NULL,
|
||||
`NbAutorized` int NOT NULL,
|
||||
`VersionOSMW` varchar(50) NOT NULL,
|
||||
`urlOSMW` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;");
|
||||
|
||||
$reponse = $bdd->query("INSERT INTO `config` (`id`, `cheminAppli`, `destinataire`, `Autorized`, `NbAutorized`, `VersionOSMW`, `urlOSMW`) VALUES
|
||||
(1, '/OSMW/', 'mymail@domain.com', 1, 4, 'Version 24.11', 'https://www.domain.com/');");
|
||||
|
||||
$reponse = $bdd->query("CREATE TABLE IF NOT EXISTS `moteurs` (
|
||||
`osAutorise` tinyint NOT NULL AUTO_INCREMENT,
|
||||
`id_os` varchar(50) NOT NULL,
|
||||
`name` varchar(50) NOT NULL,
|
||||
`version` varchar(50) NOT NULL,
|
||||
`address` varchar(50) NOT NULL,
|
||||
`DB_OS` varchar(50) NOT NULL,
|
||||
`hypergrid` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`osAutorise`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;");
|
||||
|
||||
$reponse = $bdd->query("INSERT INTO `moteurs` (`osAutorise`, `id_os`, `name`, `version`, `address`, `DB_OS`, `hypergrid`) VALUES
|
||||
(1, 'Simulateur_1_Exemple', 'Whitman Corporation', 'Opensim 0.9.3', 'C:/OPENSIM/', 'addon-modules/osgrid/config/osgrid.ini', 'hg.osgrid.org:80');");
|
||||
|
||||
$reponse = $bdd->query("CREATE TABLE IF NOT EXISTS `users` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`firstname` varchar(15) NOT NULL,
|
||||
`lastname` varchar(15) NOT NULL,
|
||||
`password` text NOT NULL,
|
||||
`privilege` int NOT NULL,
|
||||
`osAutorise` varchar(50) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;");
|
||||
|
||||
$reponse = $bdd->query("INSERT INTO `users` (`id`, `firstname`, `lastname`, `password`, `privilege`, `osAutorise`) VALUES
|
||||
(1, 'Super', 'Admin', 'dc79f6a0f51567c820d0535f0c72a77cc5152258', 4, '');");
|
||||
|
||||
$requetes = '';
|
||||
$sql = file('./inc/config/sql/database.sql');
|
||||
foreach($sql as $lecture)
|
||||
{
|
||||
if (substr(trim($lecture), 0, 2) != '--')
|
||||
{
|
||||
$requetes .= $lecture;
|
||||
}
|
||||
}
|
||||
$reponse = $bdd->query($requetes);
|
||||
|
||||
echo '<div class="alert alert-success">Installing the database tables of data effected with success...</div>';
|
||||
echo '<div class="alert alert-warning">Please delete the file <strong>install.php</strong> of server ...</div>';
|
||||
@@ -184,7 +220,7 @@ $lang = "fr";
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<footer class="footer">
|
||||
<p><CENTER>Open Simulator Manager Web Intaller <?php echo date(Y); ?></CENTER></p>
|
||||
<p><CENTER>Open Simulator Manager Web Intaller <?php echo date('Y'); ?></CENTER></p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user