Skip to content

Commit b1e5851

Browse files
committed
Sorting fix
1 parent d3a5118 commit b1e5851

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/index.php

+11-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
$dir_path = __DIR__;
33
$dirs = glob($dir_path . '/*', GLOB_ONLYDIR);
44
if (count($dirs) > 0) {
5-
usort($dirs, function($a, $b) {
6-
return intval($a) - intval($b);
7-
});
8-
$largest_dir = end($dirs);
5+
natsort($dirs); // Сортировка папок по числовым значениям
6+
$largest_dir = end($dirs); // Получение наибольшей папки
97
$dirname = basename($largest_dir);
108
$current_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]" . $_SERVER['REQUEST_URI'] . '/' . $dirname;
119
$current_url = str_replace("index.php", "", $current_url);
@@ -16,7 +14,7 @@
1614
<head>
1715
<meta charset="UTF-8">
1816
<meta name="viewport" content="width=device-width, initial-scale=1.0">
19-
<title>Redirect</title>
17+
<title>Масоны-ДР (Masonry-AR)</title>
2018
<style>
2119
body, html {
2220
margin: 0;
@@ -32,6 +30,12 @@
3230
</style>
3331
</head>
3432
<body>
33+
<script>
34+
if (window.location.protocol === 'http:') {
35+
var newUrl = window.location.href.replace('http:', 'https:')
36+
window.location.assign(newUrl)
37+
}
38+
</script>
3539
<iframe src="<?php echo $current_url; ?>" frameborder="0"></iframe>
3640
</body>
3741
</html>
@@ -40,4 +44,5 @@
4044
exit;
4145
} else {
4246
echo "No numeric folder in script directory!";
43-
}
47+
}
48+
?>

0 commit comments

Comments
 (0)