admin管理员组文章数量:1122846
I have tried numerous ways to prevent the browser's back button from allowing someone from using it to go back into a visitors logged out profile. The codes I used were supposed to prevent the browser from caching data from the last page visited after logout. They don't work. Wordpress logs the visitor out once they click the logged out button, yes this portion wors. Unfortunately, you can see the last page visited by the person who was logged on. The session is destroyed but the cache still holds the info for the last page visited. If you click any link on the profile page you will be brought back to the login page. You were not supposed to have been able to leave this login page without logging in. What code can use to force the browser to delete the data in the cache so the someone can not view info from a loggedout profile. Javascript would pose a security risk. Yes, I know that you can not delete the browser's history, but there must be a secure code for this. Wordpress comes with file that destroys the session but I can't find that file in the twenty sixteen code. Also, these codes do not work:
if(!isset($_SESSION['logged_in'])) :
header("Location: login.php");
unset($_SESSION['logged_in']);
session_destroy();
Can you Pleeease help!!!
I have tried numerous ways to prevent the browser's back button from allowing someone from using it to go back into a visitors logged out profile. The codes I used were supposed to prevent the browser from caching data from the last page visited after logout. They don't work. Wordpress logs the visitor out once they click the logged out button, yes this portion wors. Unfortunately, you can see the last page visited by the person who was logged on. The session is destroyed but the cache still holds the info for the last page visited. If you click any link on the profile page you will be brought back to the login page. You were not supposed to have been able to leave this login page without logging in. What code can use to force the browser to delete the data in the cache so the someone can not view info from a loggedout profile. Javascript would pose a security risk. Yes, I know that you can not delete the browser's history, but there must be a secure code for this. Wordpress comes with file that destroys the session but I can't find that file in the twenty sixteen code. Also, these codes do not work:
if(!isset($_SESSION['logged_in'])) :
header("Location: login.php");
unset($_SESSION['logged_in']);
session_destroy();
Can you Pleeease help!!!
Share Improve this question edited Apr 15, 2017 at 13:29 cjbj 15k16 gold badges42 silver badges89 bronze badges asked Apr 15, 2017 at 5:35 user117689user117689 112 bronze badges2 Answers
Reset to default 0You should use the built in WordPress function is_user_logged_in()
, as well as several other WordPress functions:
if ( !is_user_logged_in() ) {
wp_redirect( get_bloginfo( 'url' ) . '/index.php' );
exit;
}
wp_redirect()
handles the redirection for you. Please be aware that it does not exit automatically, so you should call it afterwards.
I also built in the WordPress Function for getting your URL - this may not be necessary in your case, as you just redirect to the front page.
Be sure that this function is called before any output is sent.
Not sure if this will help anyone.
But I was able to redirect my URL after logout in the URL parameters.
https://example.com/wp-login.php?action=logout&redirect_to=https://example.com/persona/
本文标签: redirectAfter logout browser39s back button into twenty sixteen theme profile
版权声明:本文标题:redirect - After logout browser's back button into twenty sixteen theme profile 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736288526a1928112.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论