简体   繁体   中英

How to show user specific features when they are logged in?

I am trying to write code for a site for my consulting practice. I know how to have a database and how to manage users on the site. But now I want to charge users for custom features they want me to build from ground up. (eg they want an option to upload pictures or ability to get certain reports via 3rd party API, which for purposes of this example is unique) So, my question is when they log in with their ID, how do i write a php code that shows only that particular option/features/page for that particular user?

How do you track the logged in user, in a session? You could do something simple like:

<?php
if ($_SESSION['userid'] == 4) {
     include('special_feature.php');
} ?>

To embed a certain block of code only for a certain user (or pull that user list from the database)...

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