Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrichblock committed Nov 4, 2017
1 parent 9d262f6 commit 5736b40
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
7 changes: 5 additions & 2 deletions login.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

if (isset($ui->server['HTTP_REFERER'])) {
$refstring = explode('/', substr(str_replace(array('http://' . $ui->domain('HTTP_HOST', 'server'), 'https://' . $ui->domain('HTTP_HOST', 'server'), '//'), array('', '', '/'), strtolower($ui->server['HTTP_REFERER'])), strlen($ewInstallPath)));
$referrer = (isset($refstring[1])) ? explode('?',$refstring[1]) : '';
$referrer = (isset($refstring[1])) ? explode('?', $refstring[1]) : '';
} else {
$referrer[0] = 'login.php';
}
Expand All @@ -101,9 +101,12 @@
redirect('admin.php');

} else {
$target = (isset($pageurl)) ? $pageurl . '/' . $ewInstallPath : $ewInstallPath;
$target .= (empty($target)) ? 'login.php' : '/login.php';

session_unset();
session_destroy();
redirect((isset($pageurl)) ? $pageurl . '/' . $ewInstallPath : $ewInstallPath);
redirect($target);
}

} else if ($ui->st('w', 'get') == 'ba') {
Expand Down
12 changes: 4 additions & 8 deletions stuff/methods/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,17 @@ function removeDoubleSlashes ($value) {

function redirect($value, $sendHTTP301 = false) {

$value = removeDoubleSlashes($value);
$target = removeDoubleSlashes($value);

if ($value == 'login.php') {
if (substr($target, -9) == 'login.php') {
if (session_status() === PHP_SESSION_ACTIVE) {
session_unset();
session_destroy();
}
}

if ($sendHTTP301 == true) {
header('HTTP/1.1 301 Moved Permanently');
}

header ('Location: ' . $value);
die('Please allow redirection settings');
header ('Location: ' . $target, true, ($sendHTTP301 == true) ? 301 : 302);
die('Please allow redirection or manually navigate to ' . $value);
}

function listDirs ($dir) {
Expand Down

0 comments on commit 5736b40

Please sign in to comment.