pass query string and from page to login page to the bookmarklet works properly when not logged in
This commit is contained in:
parent
1b02ad896d
commit
11c9c5502e
4 changed files with 16 additions and 6 deletions
|
@ -20,7 +20,7 @@ $opt = $smarty->opt();
|
|||
|
||||
session_start();
|
||||
if (!isset($_SESSION["userid"])) {
|
||||
header("Location: " . getFullPath("login.php") . "?from=item.php");
|
||||
header("Location: " . getFullPath("login.php") . "?from=item.php&querystring=" . urlencode($_SERVER['QUERY_STRING']));
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -31,8 +31,14 @@ if (isset($_GET["action"])) {
|
|||
if (isset($_GET["from"])) {
|
||||
$from = filter_var(trim($_GET["from"], FILTER_SANITIZE_STRING));;
|
||||
$from = htmlspecialchars($from, ENT_QUOTES, 'UTF-8');
|
||||
} else {
|
||||
$from = "";
|
||||
}
|
||||
|
||||
if (isset($_GET["querystring"])) {
|
||||
$querystring = trim($_GET["querystring"]);
|
||||
} else
|
||||
$from = "";
|
||||
$querystring = "";
|
||||
|
||||
if (!empty($_POST["username"])) {
|
||||
$username = filter_var(strtolower(trim($_REQUEST["username"])), FILTER_SANITIZE_STRING);
|
||||
|
@ -53,10 +59,11 @@ if (!empty($_POST["username"])) {
|
|||
$_SESSION["show_helptext"] = $row["show_helptext"];
|
||||
$opt['show_helptext'] = $row["show_helptext"];
|
||||
|
||||
if (in_array($from, $pages))
|
||||
header("Location: " . getFullPath($from));
|
||||
else
|
||||
if (in_array($from, $pages)) {
|
||||
header("Location: " . getFullPath($from) . "?" . urldecode($querystring));
|
||||
} else {
|
||||
header("Location: " . getFullPath("index.php"));
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
@ -65,11 +72,13 @@ if (!empty($_POST["username"])) {
|
|||
}
|
||||
|
||||
$smarty->assign('from', $from);
|
||||
$smarty->assign('querystring', urlencode($querystring));
|
||||
$smarty->assign('username', $username);
|
||||
$smarty->display('login.tpl');
|
||||
}
|
||||
else {
|
||||
$smarty->assign('from', $from);
|
||||
$smarty->assign('querystring', urlencode($querystring));
|
||||
$smarty->display('login.tpl');
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -65,6 +65,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
}
|
||||
}
|
||||
appURL += '&bookmarklet=1';
|
||||
appURL += '&wishlist=1';
|
||||
window.open(appURL);
|
||||
})();
|
||||
">🎁 Add to Wishlist</a></p>
|
||||
|
|
|
@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
<div class="row justify-content-center">
|
||||
<div class="col-sm" style="max-width: 500px;">
|
||||
<div class="card mt-3">
|
||||
<form name="loginform" id="loginform" method="post" action="login.php{if isset($from)}?from={$from}{/if}" class="well form-horizontal">
|
||||
<form name="loginform" id="loginform" method="post" action="login.php{if isset($from)}?from={$from}{if isset($querystring)}&querystring={$querystring}{/if}{/if}" class="well form-horizontal">
|
||||
<div class="card-header"><h1>Gift Registry</h1></div>
|
||||
<div class="card-body">
|
||||
{if isset($username)}
|
||||
|
|
Loading…
Add table
Reference in a new issue