Browse Source

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

vbracco 16 years ago
parent
commit
19b0087f52
2 changed files with 11 additions and 4 deletions
  1. 2 1
      admin/bm.php
  2. 9 3
      login.php

+ 2 - 1
admin/bm.php View File

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

+ 9 - 3
login.php View File

@@ -21,9 +21,14 @@ if ($user->isAuthenticated()) {
21 21
 	header("Location: ".$conf->urlGelato."/admin/index.php");
22 22
 } else {
23 23
 	if (isset($_POST["pass"]) && isset($_POST["login"])) {		
24
-		if ($user->validateUser($_POST['login'], md5($_POST['pass']))) {			
25
-			header("Location: ".$conf->urlGelato."/admin/index.php");
26
-			exit();
24
+		if ($user->validateUser($_POST['login'], md5($_POST['pass']))) {
25
+			if(isset($_POST["url_redirect"])){
26
+				header("Location: ".$conf->urlGelato."/admin/bm.php?url=".$_POST["url_redirect"]."&sel=".$_POST["sel"]);
27
+				exit();
28
+			} else {
29
+				header("Location: ".$conf->urlGelato."/admin/index.php");
30
+				exit();
31
+			}
27 32
 		} else {			
28 33
 			header("Location: ".$conf->urlGelato."/login.php?error=1");
29 34
 			exit();
@@ -82,6 +87,7 @@ if ($user->isAuthenticated()) {
82 87
 					<div class="tabla">
83 88
 
84 89
 								<form action="login.php" method="post" id="valida" autocomplete="off" class="newpost">
90
+									<?php echo (isset($_GET['redirect_url']))? "<input type=\"hidden\" name=\"url_redirect\" value=\"".$_GET['redirect_url']."\" /><input type=\"hidden\" name=\"sel\" value=\"".$_GET['sel']."\" />" : ""; ?>
85 91
 									<fieldset>
86 92
 									<ul>
87 93
 										<li><label for="login"><?php echo __("User:")?></label>