当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Session stays active until page is update in Wordpress dashboard

问题描述:

Something very strange is happening. I am using sessions on my wordpress website and for some reason, a session stays active until I update the page in the Wordpress website.

I have build a template for a login page and a page that will be reached after succesfully logging in. The following occurs:

  • First I have updated the pages in Wordpress
  • I log in as John and i reach the secure page with John's information.
  • I log out as John and log in as Pete, but i still see John's information. Even if i log in from a completely different pc. Also, if I directly go to the secure page, without logging in, I still see John's information!
  • I update the secure page again in Wordpress and all information on the secure page is gone again and I can log in normally again.

How is this possible? Why is the session information of one user stored on the page for everyone to see? And why does it only disappear when I update the page in the Wordpress dashboard?

If it would help, I can post my code.

code of secured page:

 <div id="primary">

<div id="content" role="main">

<?php

session_start();

$periodarray = array('januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december');

if(date("d") > 10){$maand1 = date("m");}else{$maand1 = date("m") - 1;}

if(isset($_GET['periode'])){$periode = $_GET['periode'];}else{$periode=$periodarray[$maand1-1];}

if(isset($_GET['jaar'])){$jaar = $_GET['jaar'];}else{$jaar = date("Y");}

if(isset($_SESSION['rhptarief'])){$rhptarief = $_SESSION['rhptarief'];}

if (isset($_SESSION['username']))

{

$hdmsg = "Welkom ".$_SESSION['name'];?><body>

<?php }else{?>

<body>

<div>

U bent niet ingelogd.

<input type="button" style="background-color:#F90;" value="Inloggen" onClick="LogIn()">

</div>

</body>

<?php } ?>

</div><!-- #content -->

</div><!-- #primary -->

Edit: It only seems to be happening with Internet Explorer (I use 11) and not with Google Chrome.

分享给朋友:
您可能感兴趣的文章:
随机阅读: