为管理员和用户页面分隔PHP文件

I am a new PHP user, currently i am developing an online food order website for a school project. Basically there will be 2 roles, admin and normal user. I have two pages in my site, home and order food page. Both users will see the same home page, but the content in the order food page would be different for both roles.

My question is, is it necessary to create new files to take care of admin, or, can i just handle it in the same file?

Really appreciate your help!

Create session and store value in session.

session_start();

//For admin
$_SESSION['type'] = 'admin';

//For user
$_SESSION['type'] = 'user';

//if admin login we will check session and display admin content
if($_SESSION['type']=='admin'){
echo 'Admin content';
}

//if user login we will check session and display user content
if($_SESSION['type']=='user'){
echo 'User content';
}

Manage you content on basis of user role

You can do it like this...

$current_user = wp_get_current_user();
if ( !($current_user instanceof WP_User) )
   return;
$roles = $current_user->roles;

if (in_array('administrator',$roles) == 1){
    //content for admin
}else{
    //content for user
}