简体   繁体   中英

How can I change the header of my page when someone logs in?

I am making a website which allows users to login. I have a header design which have login and password fields in it. I have included it in all other pages. Now when someone logs in, the page header should display the welcome message and logout button etc.

I have a header.php and loged_header.php for the different headers.

Use an if/else condition.

Because you are using PHP, you can use something called include .

For example:

 <div id="header">
 <?php
      if(loggedIn){
           include 'loged_header.php';
      }else{
           include 'header.php';
      }
 ?>
 </div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM