$_Session “complication” on login and logout php

后端 未结 1 1416
伪装坚强ぢ
伪装坚强ぢ 2021-01-18 22:45

I\'m doing a database project for university and I\'m strugling with a problem in here. I\'m trying to show \"log in\" when there\'s no session and \"log out\" when there is

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-18 23:10

    when your login is success on login page.

    session_start();
    $_SESSION['user_logged_in'] = true;
    

    in your logout page

    session_start();
    unset($_SESSION['user_logged_in']);   
    session_destroy();
    

    in your home page

    
       < a href='logout.php'>Logout
    
        < a href='login.php'>Login
     
    

    0 讨论(0)
提交回复
热议问题