zoukankan      html  css  js  c++  java
  • 页面刷新方式实时检测cookie是否失效

    在浏览器端每隔10秒钟刷新一次页面,可用于检查cookie值是否失效。

    在study.php文件中存在这样一条语句:

    <meta http-equiv="refresh" content="10;url=study.php">

    <?php
    session_start();
    if($_COOKIE['cookie1']!=''){	  
    ?>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta http-equiv="refresh" content="10;url=study.php">
    <title>使用COOKIE限制用户访问网站的时间</title>
    <style type="text/css">
    <!--
    .style1 {
    	font-size: 25px;
    	font-family: "华文行楷";
    }
    -->
    </style></head>
    
    <body>
    <table width="392" height="178" border="1" cellpadding="0" cellspacing="0" bgcolor="#FFFFCC">
      <tr>
        <td height="176" align="center">    
          <span class="style1">
        <p>用户您好</p></span>    <p>     您当前使用的是“试用版学习资源网”,主要应用COOKIE实现对网站访问时间的限制,当浏览者在网站中停留的时间超过网站规定的访问时间时,将自动跳转到登录页面,只有重新登录才可以继续访问 </p>      <p class="style1"> </p></td>
      </tr>
    </table>
    </body>
    </html>
    <?php
    }else{ 
    	echo "您在本网站停留的时间已经超过我们限制的时间,系统将在5秒钟后退出登录!!谢谢!请稍等...";
    	echo "<meta http-equiv="Refresh" content="5;url=index.php">";
    }
    ?>
    

      

    它的作用是,每隔10秒刷新一次当前页面。作用是:后续逻辑会检测cookie是否过期,只有通过不断刷新,才能完成对cookie的实时检测

  • 相关阅读:
    linux 学习笔记1
    IIS请求筛选模块被配置为拒绝超过请求内容长度的请求
    ipod锁定后的恢复
    HTTP报文
    数据仓库概念
    数据挖掘概念
    大数据处理工具
    eclipse 4.3 汉化
    在CentOS中安装输入法
    编译Hadoop1.1.2eclipse插件并测试
  • 原文地址:https://www.cnblogs.com/ioveNature/p/6918286.html
Copyright © 2011-2022 走看看