Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/erikdubbelboer/phpRedisAdmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Dubbelboer <erik@dubbelboer.com>2019-09-27 23:10:43 +0300
committerErik Dubbelboer <erik@dubbelboer.com>2019-09-27 23:10:50 +0300
commit0e8e4724be4016f75608aafd1c260b6f3350c490 (patch)
tree9771d66c5219127c15777545c2dcefaa4c854628
parenta858f60baea28405b0373ddf42fc77a56bc10820 (diff)
Make all paths relative
-rw-r--r--edit.php2
-rw-r--r--export.php2
-rw-r--r--import.php2
-rw-r--r--includes/functions.inc.php3
-rw-r--r--logout.php4
-rw-r--r--rename.php2
-rw-r--r--ttl.php2
7 files changed, 9 insertions, 8 deletions
diff --git a/edit.php b/edit.php
index 4842655..0940503 100644
--- a/edit.php
+++ b/edit.php
@@ -144,7 +144,7 @@ require 'includes/header.inc.php';
?>
<h2><?php echo $edit ? 'Edit' : 'Add'?></h2>
-<form action="<?php echo format_html($_SERVER['REQUEST_URI'])?>" method="post">
+<form action="<?php echo format_html(getRelativePath('edit.php'))?>" method="post">
<p>
<label for="type">Type:</label>
diff --git a/export.php b/export.php
index ae1f0c3..c886e46 100644
--- a/export.php
+++ b/export.php
@@ -186,7 +186,7 @@ require 'includes/header.inc.php';
?>
<h2>Export <?php echo isset($_GET['key']) ? format_html($_GET['key']) : ''?></h2>
-<form action="<?php echo format_html($_SERVER['REQUEST_URI'])?>" method="post">
+<form action="<?php echo format_html(getRelativePath('export.php'))?>" method="post">
<p>
<label for="type">Type:</label>
diff --git a/import.php b/import.php
index 9dbca76..1786164 100644
--- a/import.php
+++ b/import.php
@@ -91,7 +91,7 @@ require 'includes/header.inc.php';
?>
<h2>Import</h2>
-<form action="<?php echo format_html($_SERVER['REQUEST_URI'])?>" method="post">
+<form action="<?php echo format_html(getRelativePath('import.php'))?>" method="post">
<p>
<label for="commands">Commands:<br>
diff --git a/includes/functions.inc.php b/includes/functions.inc.php
index 10f8dcd..589d324 100644
--- a/includes/functions.inc.php
+++ b/includes/functions.inc.php
@@ -101,3 +101,6 @@ function encodeOrDecode($action, $key, $data) {
return $data;
}
+function getRelativePath($base) {
+ return substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $base));
+}
diff --git a/logout.php b/logout.php
index afede7e..44b1785 100644
--- a/logout.php
+++ b/logout.php
@@ -47,7 +47,5 @@ if (!empty($config['cookie_auth'])) {
}
- header('Location: '.substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'logout.php')));
+ header('Location: logout.php');
}
-
-?>
diff --git a/rename.php b/rename.php
index 1dd50d9..e5460a1 100644
--- a/rename.php
+++ b/rename.php
@@ -35,7 +35,7 @@ require 'includes/header.inc.php';
?>
<h2>Edit Name of <?php echo format_html($_GET['key'])?></h2>
-<form action="<?php echo format_html($_SERVER['REQUEST_URI'])?>" method="post">
+<form action="<?php echo format_html(getRelativePath('rename.php'))?>" method="post">
<input type="hidden" name="old" value="<?php echo format_html($_GET['key'])?>">
diff --git a/ttl.php b/ttl.php
index b326823..6db0cb2 100644
--- a/ttl.php
+++ b/ttl.php
@@ -26,7 +26,7 @@ require 'includes/header.inc.php';
?>
<h2>Edit TTL</h2>
-<form action="<?php echo format_html($_SERVER['REQUEST_URI'])?>" method="post">
+<form action="<?php echo format_html(getRelativePath('ttl.php'))?>" method="post">
<p>
<label for="key">Key:</label>