If the user is not logged redirect after login to the correct edition screen.

master
vbracco 2008-10-24 23:19:31 +00:00
parent 25f1c98695
commit 19b0087f52
2 changed files with 11 additions and 4 deletions

View File

@ -222,6 +222,7 @@ if ($user->isAdmin()) {
</html> </html>
<?php <?php
} else { } else {
header("Location: ".$conf->urlGelato."/login.php"); $target = (isset($_GET["url"]))? "/login.php?redirect_url=".$_GET["url"]."&sel=".$_GET["sel"] : "/login.php";
header("Location: ".$conf->urlGelato.$target);
} }
?> ?>

View File

@ -22,8 +22,13 @@ if ($user->isAuthenticated()) {
} else { } else {
if (isset($_POST["pass"]) && isset($_POST["login"])) { if (isset($_POST["pass"]) && isset($_POST["login"])) {
if ($user->validateUser($_POST['login'], md5($_POST['pass']))) { if ($user->validateUser($_POST['login'], md5($_POST['pass']))) {
if(isset($_POST["url_redirect"])){
header("Location: ".$conf->urlGelato."/admin/bm.php?url=".$_POST["url_redirect"]."&sel=".$_POST["sel"]);
exit();
} else {
header("Location: ".$conf->urlGelato."/admin/index.php"); header("Location: ".$conf->urlGelato."/admin/index.php");
exit(); exit();
}
} else { } else {
header("Location: ".$conf->urlGelato."/login.php?error=1"); header("Location: ".$conf->urlGelato."/login.php?error=1");
exit(); exit();
@ -82,6 +87,7 @@ if ($user->isAuthenticated()) {
<div class="tabla"> <div class="tabla">
<form action="login.php" method="post" id="valida" autocomplete="off" class="newpost"> <form action="login.php" method="post" id="valida" autocomplete="off" class="newpost">
<?php echo (isset($_GET['redirect_url']))? "<input type=\"hidden\" name=\"url_redirect\" value=\"".$_GET['redirect_url']."\" /><input type=\"hidden\" name=\"sel\" value=\"".$_GET['sel']."\" />" : ""; ?>
<fieldset> <fieldset>
<ul> <ul>
<li><label for="login"><?php echo __("User:")?></label> <li><label for="login"><?php echo __("User:")?></label>