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
 	</html>
222
 	</html>
223
 <?php
223
 <?php
224
 } else {
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
 	header("Location: ".$conf->urlGelato."/admin/index.php");
21
 	header("Location: ".$conf->urlGelato."/admin/index.php");
22
 } else {
22
 } else {
23
 	if (isset($_POST["pass"]) && isset($_POST["login"])) {		
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
 		} else {			
32
 		} else {			
28
 			header("Location: ".$conf->urlGelato."/login.php?error=1");
33
 			header("Location: ".$conf->urlGelato."/login.php?error=1");
29
 			exit();
34
 			exit();
82
 					<div class="tabla">
87
 					<div class="tabla">
83
 
88
 
84
 								<form action="login.php" method="post" id="valida" autocomplete="off" class="newpost">
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
 									<fieldset>
91
 									<fieldset>
86
 									<ul>
92
 									<ul>
87
 										<li><label for="login"><?php echo __("User:")?></label>
93
 										<li><label for="login"><?php echo __("User:")?></label>