Created
December 8, 2017 22:20
-
-
Save Rejkowicz/e70499cf15cf5f126da9873b2793cf4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mvdir($oldfolder, $newfolder) | |
{ | |
$files = scandir($oldfolder); | |
$oldfolder = "$oldfolder/"; | |
$newfolder = "$newfolder/"; | |
foreach($files as $fname) { | |
if($fname != '.' && $fname != '..' && "$fname/" != $newfolder) { | |
rename($oldfolder.$fname, $newfolder.$fname); | |
} | |
} | |
} | |
if ($_SERVER['REQUEST_METHOD'] === 'POST') | |
{ | |
unlink(__FILE__); | |
$backup = '_backup2'; | |
mkdir($backup); | |
mvdir('.', $backup); | |
rename($backup, '_backup'); | |
file_put_contents("latest.zip", fopen("https://wordpress.org/latest.zip", 'r')); | |
$zip = new ZipArchive; | |
$res = $zip->open('latest.zip'); | |
if ($res === TRUE) | |
{ | |
$zip->extractTo('.'); | |
$zip->close(); | |
mvdir('wordpress', '.'); | |
unlink('latest.zip'); | |
rmdir('wordpress'); | |
header("Location: wp-admin/setup-config.php"); | |
} | |
else | |
{ | |
echo phpinfo(); | |
} | |
die(); | |
} | |
?> | |
<html> | |
<head> | |
</head> | |
<body> | |
<form action="<?php echo basename(__FILE__); ?>" method="post"> | |
<button name="go">Instaluj</button> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment