繁体   English   中英

成功登录后将重定向到登录页面

[英]Successful login redirects to login page

成功登录后,我将被重定向到登录页面。 请在wamp中找到以下用于vhost设置的代码,然后发布方法loginaction.php。

<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www/aklc_portal/admin"
  <Directory "${INSTALL_DIR}/www/aklc_portal/admin">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>

POST方法loginaction.php

分别尝试了以下三个:

$refererURL =$_SERVER["HTTP_REFERER"];
$refererURL ="/index.php";
$refererURL ="http://localhost/aklc_portal/admin/index.php";

if (isset($_POST['username']) && isset($_POST['password']))
  {
     //check DB
     //set cookie
  }

 else {
     //other logic. New reffererURL
}

//redirect

header("Location: ".$refererURL);

删除或评论

$refererURL =$_SERVER["HTTP_REFERER"]

$refererURL ="http://localhost/aklc_portal/admin/index.php";

因为您的根目录是aklc_portal / admin /您只需要指向索引,而第三个$refererURL会覆盖第一个和第二个

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM