diff options
author | Erik Dubbelboer <erik@dubbelboer.com> | 2019-09-27 23:10:43 +0300 |
---|---|---|
committer | Erik Dubbelboer <erik@dubbelboer.com> | 2019-09-27 23:10:50 +0300 |
commit | 0e8e4724be4016f75608aafd1c260b6f3350c490 (patch) | |
tree | 9771d66c5219127c15777545c2dcefaa4c854628 | |
parent | a858f60baea28405b0373ddf42fc77a56bc10820 (diff) |
Make all paths relative
-rw-r--r-- | edit.php | 2 | ||||
-rw-r--r-- | export.php | 2 | ||||
-rw-r--r-- | import.php | 2 | ||||
-rw-r--r-- | includes/functions.inc.php | 3 | ||||
-rw-r--r-- | logout.php | 4 | ||||
-rw-r--r-- | rename.php | 2 | ||||
-rw-r--r-- | ttl.php | 2 |
7 files changed, 9 insertions, 8 deletions
@@ -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> @@ -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> @@ -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)); +} @@ -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'); } - -?> @@ -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'])?>"> @@ -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> |