Code: Select all
<?php
include('connection.php');
$id = (int) $_GET['id'];
$sql=mysqli_query($conn,"SELECT * FROM `user` WHERE id='" . $id . "' ");
$users=mysqli_fetch_assoc($sql);
?>
<?php echo $users['user_relationship'];?>
Code: Select all
<?php
include('connection.php');
$id = (int) $_GET['id'];
$sql=mysqli_query($conn,"SELECT * FROM `user` WHERE id='" . $id . "' ");
$users=mysqli_fetch_assoc($sql);
?>
<?php echo $users['user_relationship'];?>
Code: Select all
<?php
//get the ID of the owner-user of accessed page
$id_user_pg =2;
//get and store in Session an array with the IDs of the friends of current user ($id)
$id_friends =[1, 2, 8];
//if $id_user_pg is in $id_friends shows the page, else some message
if(in_array($id_user_pg, $id_friends)) echo 'page';
else echo 'Not allowed to see the content';
?>
Code: Select all
id context user_id friend_id friend_name
Code: Select all
id name email pass mobile gender
Code: Select all
//id of current user
$id =4;
//here you should get the ID of the owner-user of accessed page
$id_user_pg =2;
//check if current user ($id) is ftiend with $id_user_pg
$sql=mysqli_query($conn,"SELECT friend_id FROM member_access WHERE friend_id=$id_user_pg AND user_id=$id LIMIT 1");
$nr_rows = mysqli_num_rows($sql);
//if $id_user_pg is friend with $id shows the page, else some message
if($nr_rows >0) echo 'page';
else echo 'Not allowed to see the content';