成功登录后如何重定向到想要的页面?

时间:2013-08-21 04:55:03

标签: php redirect login

我已成功发送过期活动的提醒电子邮件。在电子邮件中,有一个链接可以让用户链接回特定的事件详细信息。如果用户尚未登录,则会重定向到登录页面。登录成功后,将返回主页。如果我想在登录后重定向到特定的活动页面?

     $contractid = $_REQUEST['Contract_ID'];
$contract_update_url = "contract_updates.php?id=".$contractid;
$MM_redirectLoginSuccess = "news_mgm.php";

if (isset($_SESSION['MM_Username'])){

header("Location: " . $MM_redirectLoginSuccess );}


if(!empty ($contactid))
       {       
            header("Location: " . $contract_update_url );

       }
       else{

      // header("Location: " . $MM_redirectLoginSuccess );
      header("Location: javascript://history.go(-1)");
       }
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }

1 个答案:

答案 0 :(得分:0)

首先,您必须将有关事件(例如,事件ID)的内容传递给电子邮件中的链接。

然后您可以在处理用户登录时保留此事件ID,如果可以,则按事件ID重定向到事件页面。