-
Notifications
You must be signed in to change notification settings - Fork 0
/
vanilla.php
217 lines (179 loc) · 8.57 KB
/
vanilla.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?php
/*
This file is part of McWebPanel.
Copyright (C) 2020-2024 DEV-MCWEBPANEL
McWebPanel is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
McWebPanel is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with McWebPanel. If not, see <https://www.gnu.org/licenses/>.
*/
require_once "template/session.php";
require_once "template/errorreport.php";
require_once "config/confopciones.php";
require_once "template/header.php";
function test_input($data)
{
if (isset($data)) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
}
?>
<!-- Custom styles for this template-->
<?php
if (isset($_SESSION['CONFIGUSER']['psystemconftemaweb'])) {
if ($_SESSION['CONFIGUSER']['psystemconftemaweb'] == 2) {
echo '<link href="css/dark.css" rel="stylesheet">';
} else {
echo '<link href="css/light.css" rel="stylesheet">';
}
} else {
echo '<link href="css/light.css" rel="stylesheet">';
}
?>
<link href="css/consola.css" rel="stylesheet">
</head>
<body id="page-top">
<?php
$expulsar = 0;
//COMPROBAR SI SESSION EXISTE SINO CREARLA CON NO
if (!isset($_SESSION['VALIDADO']) || !isset($_SESSION['KEYSECRETA'])) {
$_SESSION['VALIDADO'] = "NO";
$_SESSION['KEYSECRETA'] = "0";
header("location:index.php");
exit;
}
//COMPROBAR SI ES EL SUPERADMIN O ADMIN
if (array_key_exists('rango', $_SESSION['CONFIGUSER'])) {
if ($_SESSION['CONFIGUSER']['rango'] == 1 || $_SESSION['CONFIGUSER']['rango'] == 2 || array_key_exists('ppagedownserver', $_SESSION['CONFIGUSER']) && $_SESSION['CONFIGUSER']['ppagedownserver'] == 1) {
$expulsar++;
}
}
if (array_key_exists('rango', $_SESSION['CONFIGUSER'])) {
if ($_SESSION['CONFIGUSER']['rango'] == 1 || $_SESSION['CONFIGUSER']['rango'] == 2 || array_key_exists('ppagedownvanilla', $_SESSION['CONFIGUSER']) && $_SESSION['CONFIGUSER']['ppagedownvanilla'] == 1) {
$expulsar++;
}
}
if ($expulsar != 2) {
header("location:index.php");
exit;
}
//VALIDAMOS SESSION SINO ERROR
if ($_SESSION['VALIDADO'] == $_SESSION['KEYSECRETA']) {
$elindexarray = 0;
$elerror = 0;
$retorno = "";
$url = "https://launchermeta.mojang.com/mc/game/version_manifest.json";
$context = stream_context_create(
array(
"http" => array(
"timeout" => 10,
"header" => "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
)
)
);
$contenido = @file_get_contents($url, false, $context);
if ($contenido === FALSE) {
$elerror = 1;
$retorno = "timeoutmanifest";
} else {
$versiones = json_decode($contenido, true);
$versiones = $versiones['versions'];
}
?>
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<?php
require_once "template/menu.php";
?>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Begin Page Content -->
<div class="container-fluid">
<div class="col-md-12">
<div class="card border-left-primary shadow h-100">
<div class="card-body">
<div class="py-1">
<div class="container">
<h1 class="mb-5">Descargar Servidor Vanilla</h1>
<div class="py-2">
<div class="container">
<div class="row">
<div class="col-md-6">
<label for="serselectver">Selecciona Versión Vanilla:</label>
<select id="serselectver" name="serselectver" class="form-control" required="required">
<?php
for ($i = 0; $i < count($versiones); $i++) {
echo '<option value="' . $versiones[$i]['id'] . '">Vanilla ' . $versiones[$i]['id'] . '</option>';
$elindexarray++;
}
?>
</select>
<br>
<?php
if ($elerror == 0) {
if ($elindexarray == 0) {
$retorno = "No se pudo obtener las versiones Vanilla de la pagina de Minecraft";
echo '<p>Error: ' . $retorno . '</p>';
}
}
if ($elerror == 0) {
?>
<button class="btn btn-primary btn-block mt-2" id="descargar" name="descargar" type="button">Descargar Servidor Vanilla</button>
<?php
} else {
echo '<p>Error: ' . $retorno . '</p>';
}
?>
</div>
<div class="col-md-6">
<img class="" src="img/loading.gif" id="gifloading" alt="loading">
</div>
</div>
</div>
</div>
<div class="py-2">
<div class="container">
<div class="row">
<div class="col-md-6">
<p class="lead" id="textoretorno"></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<script src="js/vanilla.js"></script>
</div>
<?php
//FINAL VALIDAR SESSION
} else {
header("location:index.php");
}
?>
</body>
</html>