瀏覽代碼

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

vbracco 16 年之前
父節點
當前提交
19b0087f52
共有 2 個文件被更改,包括 11 次插入4 次删除
  1. 2 1
      admin/bm.php
  2. 9 3
      login.php

+ 2 - 1
admin/bm.php 查看文件

@@ -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 查看文件

@@ -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>