I am being redirected to login page after successful login. Please find below codes for vhost set up in wamp and post method 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 method loginaction.php
Tried with these three individually:
$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);
Remove or comment
$refererURL =$_SERVER["HTTP_REFERER"]
$refererURL ="http://localhost/aklc_portal/admin/index.php";
because your root directory is aklc_portal / admin /
you just have to point to the index and the third $refererURL
is overwriting the first and second
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.