-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
144 lines (120 loc) · 5.22 KB
/
index.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php require_once "libs/auth.php"; ?>
<?php require_once "libs/functions.php"; ?>
<?php require_once "libs/contacts.php"; ?>
<?php
$new_message = array();
$dir_flag = 0; //0 = left & 1 = right
if ($new_message = prepareMessageData(100)) {
// echo "<pre>";
// var_dump($new_message);
// echo "</pre>";
saveToFile($new_message, "files/chats.txt");
}
$history = convertFileContentToArray("files/chats.txt");
?>
<html>
<head>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container">
<br>
<h3>Welcome "<?php echo $_SESSION['username'] ?>". You are In: <a href="index.php">Home</a> » <a href="index.php">Public Room</a></h3> <br>
<div class="messaging">
<div class="inbox_msg">
<div class="inbox_people">
<div class="headind_srch">
<div class="recent_heading">
<h4>Contacts:</h4>
</div>
<div class="srch_bar">
<div class="stylish-input-group">
<form action="" method="post">
<input type="search" name="search" id="search" class="search-bar" placeholder="User or Email">
<span class="input-group-addon">
<button type="submit" style="cursor: pointer;"> <i class="fa fa-search" aria-hidden="true"></i> </button>
</span>
<!-- <span class="input-group-addon">
<button type="button"> <i class="fa fa-search" aria-hidden="true"></i> </button>
</span> -->
</form>
</div>
</div>
</div>
<div class="inbox_chat">
<?php for ($i = 0; $i < count($records); $i++) { ?>
<div class="chat_list active_chat">
<div class="chat_people">
<div class="chat_img">
<img src="img/user-profile.png" alt="sunil">
</div>
<div class="chat_ib">
<h5>
<a href="<?php echo makePrivateLink($current_user, $records[$i]['username']); ?>">
<?php echo $records[$i]['name']; ?>
</a>
</h5>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="mesgs">
<div class="msg_history">
<?php if ($history_chats = showHistoryChat($history, 100)) :
for ($i = 0; $i < count($history_chats); $i++) {
if (($i != 0) &&
($history_chats[$i]['sender'] != $history_chats[$i - 1]['sender'])
) {
if ($dir_flag == 1)
$dir_flag = 0;
else
$dir_flag = 1;
}
if ($dir_flag == 1) : ?>
<div class="incoming_msg">
<div class="incoming_msg_img"> <img src="img/user-profile.png" alt="sunil"> </div>
<div class="received_msg">
<div class="received_withd_msg">
<p><?php echo $history_chats[$i]['message']; ?></p>
<span class="time_date">
<?php echo 'from <strong>' . $history_chats[$i]['sender'] . '</strong> |'; ?>
<?php echo $history_chats[$i]['date']; ?>
</span>
</div>
</div>
</div>
<?php else : ?>
<div class="outgoing_msg">
<div class="sent_msg">
<p><?php echo $history_chats[$i]['message'] ?></p>
<span class="time_date">
<?php echo 'from <strong>' . $history_chats[$i]['sender'] . '</strong> |'; ?>
<?php echo $history_chats[$i]['date']; ?>
</span>
</div>
</div>
<?php endif; ?>
<?php } ?>
<?php else :
echo "There is'nt any Chat.";
endif; ?>
</div>
<div class="type_msg">
<form action="" method="post">
<div class="input_msg_write">
<input type="text" class="write_msg" name="message" id="message" placeholder="Type a message" />
<button class="msg_send_btn" type="submit" value="submit"><i class="fa fa-paper-plane-o" aria-hidden="true"></i></button>
</div>
</form>
</div>
</div>
</div>
<p class="text-center top_spac"> Developed by <a target="_blank" href="https://www.linkedin.com/in/sunil-rajput-nattho-singh/">Sajjad Shahrabi</a></p>
</div>
</div>
</body>
</html>