How to kill a session after logging out using php

前端 未结 2 1529
礼貌的吻别
礼貌的吻别 2021-01-29 02:34

I have seen the following question and tried to adapt part of the answer but to no luck: \'How can i disable the back browser button after user press logout and destroy session?

2条回答
  •  天涯浪人
    2021-01-29 02:53

    login page:

    checkUser($Username,$Password,$User_Type);
             if ($rowsCount!=0)
             {
                  $_SESSION['user'] = $Username;
                  header("Location:LoginViewController.php");
    
             } else {
                  echo 'Bad user';
             }
        } else {
             echo 'Please, fill all inputs';
        }
    } else {
        echo 'Bad form sent';
    }
    ?>
     
    // inputs

    LoginViewController.php :

    
    

    And add the headers to force the browser to revalidate the pages :

    logout.php :

    
    

提交回复
热议问题