if ($userdata['user_id'] == 123) { //display content for that user here }
if ($userdata['user_id'] == 123) { // <--- there, that decides who sees the content below, in this case the user with user ID 123
echo "This content can be seen only by the user with user ID 123!";
} elseif ($userdata['user_id'] == 1) { // <--- in this case the user with user ID 1
echo "This content can be seen only by the user with user ID 1!";
} else {
echo "This content can be seen by any user, being a member or guest! You could replace this with 'Sorry you have no access to this page' or whatever.";
}
Quote
Sorry but I just can't believe you asked that. How hard can it be to comprehend that line of code? Please, just try and learn some basic PHP before getting into creating sites.
//determine userid by url
$show_my_data = empty($_GET['user_id']);
$userid = intval($show_my_data ? $userdata['user_id'] : $_GET['user_id']);
//get the information to show
$info = dbarray(dbquery("select * from table_for_individual_data where user_id = ".$userid);
$access = true;
if (!$show_my_data) {
//get the IDs of parents
$parentids = $info['parentids'] ? explode(',', $info['parentids']) : array();
if (!in_array($userdata['user_id'], $parentids)) {
//user want to see data of a user, but the user is not a parent
$access = false;
}
}
if ($access) {
//show data of user using variable $info
} else {
//show an error message
}
Quote
Of course we can not cover everything, but a lot.
- by Richard Ainz
Category Forum
Modifications and Requests - 8Labels
None yet
Statistics
3 participants
Notifications
You are not receiving notifications from this thread.
Related Questions