';
$toid = $db->intcast($_REQUEST['toid']);
// login check
if(isset($_SESSION['loggedin']) || $_SESSION['loggedin'] != '') {
$uid = $db->intcast($_SESSION['uid']);
} else {
header("Location: ../");
exit;
}
// get and set a proper token for our instance.
if(!isset($_SESSION['token']) || empty($_SESSION['token']) ) {
$csrf = $db->getToken();
$_SESSION['token'] = $csrf;
} else {
$csrf = $db->clean($_SESSION['token'],'encode');
}
$friend_list = '';
$profile_friend = $db->query("SELECT id,username,photo FROM profile WHERE id = '".$db->intcast($toid)."'");
$friend_name = $profile_friend[0]["username"];
$friend_list .= "";
$friend_list .= "
";
$friend_list .= "clean($profile_friend[0]['username'],'encode'))."\" title=\"".ucfirst($db->clean($profile_friend[0]['username'],'encode'))."\" style=\"background:url('".$host.$db->clean($profile_friend[0]['photo'],'encode')."') !important; background-size: cover!important;\">";
$friend_list .= "
";
$selectfriends = $db->query("SELECT * FROM friends WHERE uid = '".$db->intcast($uid)."' and fid != '".$db->intcast($profile_friend[0]['id'])."' and blk != '1' LIMIT 4");
$countfriends = count($selectfriends);
if($countfriends >=1) {
for($j=0; $j<$countfriends; $j++) {
$userprofiles = $db->query("SELECT id,username,photo FROM profile WHERE id = '".$db->intcast($selectfriends[$j]['fid'])."'");
$count = count($userprofiles);
if($count >=1) {
for($i=0;$i<$count;$i++) {
$active = '';
if($toid == $userprofiles[$i]['id']) {
$active = '-active';
}
$friend_list .= "";
$friend_list .= "
";
$friend_list .= "clean($userprofiles[$i]['username'],'encode'))."\" title=\"".ucfirst($db->clean($userprofiles[$i]['username'],'encode'))."\" style=\"background:url('".$host.$db->clean($userprofiles[$i]['photo'],'encode')."') !important; background-size: cover!important;\">";
$friend_list .= "
";
}
}
}
} else {
$friend_list .= "
No friends yet, start making new friends.
";
}
$profile = $db->query("SELECT id,username,photo FROM profile WHERE id = '".$db->intcast($uid)."'");
?>
Twigpage - Social Timelines.
prepare("SELECT * FROM messenger where toid = ? and uid = ?");
$stmt->bind_param("ii", $uid, $toid);
$stmt->execute();
$query = $stmt->get_result();
while($row = $query->fetch_array(MYSQLI_ASSOC)) {
$flaggedlist = $db->query("SELECT * FROM flagged where flaggedby = '".$db->intcast($uid)."' and chatid = '".$row['id']."'");
if(count($flaggedlist) == 0) {
$messages[] = $row;
}
}
$stmt->close();
$stmt = $mysqli->prepare("SELECT * FROM messenger where uid = ? AND toid = ?");
$stmt->bind_param("ii", $uid,$toid);
$stmt->execute();
$query = $stmt->get_result();
while($row = $query->fetch_array(MYSQLI_ASSOC)) {
$flaggedlist = $db->query("SELECT * FROM flagged where flaggedby = '".$db->intcast($uid)."' and chatid = '".$row['id']."'");
if(count($flaggedlist) == 0) {
$messages[] = $row;
}
}
$stmt->close();
array_multisort(
array_column($messages, 'id'),
$messages
);
for($i=0; $i < count($messages); $i++) {
if($messages[$i]['uid'] != $uid) {
$friend_uid = $db->intcast($messages[$i]['uid']);
$friend_toid = $db->intcast($messages[$i]['toid']);
$friend_photo = '/'.$db->clean($profile_friend[0]["photo"],'encode');
$photo = $db->clean($profile_friend[0]["photo"],'encode');
} else {
$photo = $db->clean($profile[0]["photo"],'encode');
}
?>
- hide this chat
- flag this chat
- block this user
prepare("UPDATE messenger SET readit = ? WHERE id = ?");
$read = 1;
$readid = $messages[$i]['id'];
$stmt->bind_param("ii", $read, $readid);
$stmt->execute();
$stmt->close();
}
}
?>
');" name="submit" value="" id="messenger-send" />