亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP development enterprise website tutorial - exit

After successful login, we enter the main.php page and enter the management page

Let’s take a look at the following top.php page

<?php
    session_start();
?>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8">
    <style type="text/css">
            body{margin-top:50px;text-align:center;}
            a{text-decoration:none;float:right;margin-right:15px;color:red;}
    </style>
</head>
<body>
    <h1>合肥領(lǐng)航環(huán)??萍脊竞笈_(tái)管理系統(tǒng)</h1>
    <?php
        if(!empty($_SESSION['username'])){
    ?>
    <a href="loginout.php?act=loginout" target="_top">退出</a>
    <?php
        }
    ?>
    
</body>
</html>

We also need to open the session first. After successful login before, we The form information has been stored in the session. Now we will judge the username in the session on this page. If the username in the session has a value

we will display the exit on the top page

Let’s look at the following exit Function code

Exit and submit to loginout.php

Let’s look at the code:

<?php
session_start();
if($ _GET['act'] == 'loginout'){
unset($_SESSION);
echo "<script>location.href='log.php';</script>";
}
?
?>

In this way we have completed the exit function

Continuing Learning
||
<?php session_start(); ?> <!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8"> <style type="text/css"> body{margin-top:50px;text-align:center;} a{text-decoration:none;float:right;margin-right:15px;color:red;} </style> </head> <body> <h1>合肥領(lǐng)航環(huán)保科技公司后臺(tái)管理系統(tǒng)</h1> <?php if(!empty($_SESSION['username'])){ ?> <a href="loginout.php?act=loginout" target="_top">退出</a> <?php } ?> </body> </html>
submitReset Code