forked from xHENAI/Mononoke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
75 lines (64 loc) · 2.28 KB
/
index.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
<?php
require("config.example.php");
require("user.php");
if(isset($_GET["install"])) {
// Install altest archive
$latest = file_get_contents("https://cdn.henai.eu/Mononoke/version.txt");
$url = "https://cdn.henai.eu/Mononoke/versions/$latest/Mononoke-$latest.zip";
$file_name = basename($url);
if (file_put_contents($file_name, file_get_contents($url))) {
echo "File downloaded successfully!\n";
} else {
echo "File downloading failed...\n";
}
// Unzip it
$zip = new ZipArchive;
if ($zip->open("Mononoke-$latest.zip")===TRUE) {
$zip->extractTo('./');
$zip->close();
echo "Unzipped Process Successful!\n";
} else {
echo "Unzipped Process failed\n";
}
// Rename edited config
rename("config.example.php", "./core/config.php");
rename("wp6600355.jpg", "./assets/images/lain.jpg");
// Esthablish MySQL Connection
require("./core/config.php");
$conn = new mysqli($slave["host"], $slave["user"], $slave["pass"], $slave["tale"]);
if ($conn -> connect_errno) {
echo "Failed to rock MySQL: " . $conn -> connect_error;
exit();
}
// Import Database - https://stackoverflow.com/questions/19751354/how-do-i-import-a-sql-file-in-mysql-database-using-php Thx!
$filename = 'streamanime.sql';
$templine = '';
$lines = file($filename);
foreach ($lines as $line) {
if (substr($line, 0, 2) == '--' || $line == '')continue;
$templine .= $line;
if (substr(trim($line), -1, 1) == ';') {
$conn->query($templine);
$templine = '';
}
}
// Create Admin Account
$password = password_hash($admin_password, PASSWORD_BCRYPT);
$conn->query("INSERT INTO `user`(`username`,`password`,`image`,`level`,`banned`) VALUES('$admin_username','$password','https://cdn.henai.eu/assets/images/avatar.png','0','0')");
// Cleanup
unlink("streamanime.sql");
unlink("Mononoke-$latest.zip");
unlink("readme.txt");
unlink("LICENSE");
unlink("user.php");
header("location: ./mnt/login");
}
?>
<style>
body {
padding: 0;
margin: 0;
overflow: hidden;
}
</style>
<a href="?install" style=""><img src="wp6600355.jpg" style="width:100%; height:100%;"></a>