duanlu7680 2015-02-03 09:05
浏览 125

如何在php中单击注销按钮后删除浏览器历史记录?

i php code which contains user login .if user logs in he can move to next page . on logout he can able to move to the index.php (which contains login.php). after logout the page should not move to previous page on click backbutton. how to create it ?

this is my logout.php

<?php
session_start();
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
$_SESSION = array();
session_destroy();
session_unset();  
    header("location:index.php");

?>

and my index.php page has

<html><head><script>$(document).ready(function(){
$("#check_user").click(function() {

        var userType=$("#userType").val();
        var userEmail = $("#log_user_email").val();
        var password = $("#log_password").val();
        if (userEmail=="" || password=="" || userType=="select"){
        alert("empty fields !!!");
        }
        else{
        var dataString = 'userEmail='+ userEmail + '&password=' + password +'&userType='+userType;
        $.ajax({
          type: "POST",
          url: "check.php",
          data: dataString,
            success: function(data) {
            //alert(data);
            if(data == "failure"){
                alert("user name or password not valid.");
                return false;
            }
            if(data == "success"){
                alert("successfuly logged in.");
                window.location='login.php';
                //location.reload();
            }
            if(data == "already logged in"){
            alert("already logged in");
                location.reload();
            }
          }
         });
    }
});

});
   function logout()
   {
   window.location='logout.php';
   }</script></head>
<body><label name="email"  >Email</label>
         <input type="email" id="log_user_email" placeholder="example@example.com" />
         <label name="password">Password</label>
         <input type="password" id="log_password" placeholder="*********"/>
         <input type="button" value="Login" id="check_user" onclick="check()" style="cursor:pointer;" />
         <input type="button" value="logout" onclick="logout();"></body></html> 
  • 写回答

2条回答 默认 最新

  • doushan5222 2015-02-03 09:10
    关注

    Here you can find a number of ways to try to disable the backbutton, but actually you have no guarantees that any of them will work: http://www.irt.org/script/311.htm

    You can't stop the backbutton, but you can try to make it harder to use it.

    评论

报告相同问题?

悬赏问题

  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用