-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopen_inbox_script.php
44 lines (44 loc) · 1.89 KB
/
open_inbox_script.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
require('functions/functions.php');
session_start();
$conn = connect();
// echo "From: ".$from."<BR>To: ".$reci."<BR>";
$active_user=0;
$get_user_list_sql = "SELECT Q1.chat_to, CONCAT(Q2.user_firstname,' ',Q2.user_lastname), Q1.CNT FNAME FROM (SELECT chat_to,SUM(CNT) CNT FROM ( SELECT DISTINCT chat_to,0 cnt FROM user_chat WHERE chat_from=".$_SESSION['user_id']."
UNION
SELECT chat_from,SUM(1) cnt FROM user_chat WHERE red_by_admin=0 AND chat_to=".$_SESSION['user_id']." GROUP BY chat_from) A GROUP BY chat_to
";
$get_user_list_sql.=") Q1 INNER JOIN USERS Q2 ON Q2.user_id = Q1.chat_to";
//echo $get_user_list_sql;
$get_user_res = mysqli_query($conn,$get_user_list_sql);
//echo $from." ".$reci;
?>
<table width="100%">
<tr>
<td width="20%" rowspan="2" style="vertical-align: top;padding-bottom: 2pt">
<div id="user_list">
<?php
while($get_user_row = mysqli_fetch_array($get_user_res)){
?>
<div style="color:#2A4AAA;background-color:#CCC;padding:5pt;border-bottom:solid #888 1px;cursor:pointer" class="user_lists" onclick="load_chat(this,<?php echo $get_user_row[0].",'".$get_user_row[1]?>')">
<h4><?php echo $get_user_row[1];
if($get_user_row[2]>0)
echo " - <i>".$get_user_row[2]."</i>";
?>
</div>
<?php
}
?>
</div>
</td>
<td width="100%">
<div style="height: 49vh;overflow-y: scroll" id="chat_display"></div>
</td>
</tr>
<tr>
<td style="border-top:solid 0px #FFF;">
<div id="msgtxtbox" style="opacity:0">
<input type='text' id='msgbox' onkeypress="check_to_send(event)" placeholder='Message text here' max-length=750 style='width:85%;font-size:12pt;padding: 3pt' autofocus> <button onclick="post_message()" class="btn btn-default" style="background-color:#2A4AAA; color:#EEE">Send</button></div>
</td>
</tr>
</table>