-
Notifications
You must be signed in to change notification settings - Fork 0
/
web-messages.php
183 lines (151 loc) · 5.27 KB
/
web-messages.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?php
require 'session.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Usmers'</title>
<link rel="shortcut icon" href="img/icon.png" >
<link rel="icon" href="img/icon.png" >
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="fonts/line-icons.css">
<link rel="stylesheet" type="text/css" href="css/slicknav.css">
<link rel="stylesheet" type="text/css" href="css/nivo-lightbox.css">
<link rel="stylesheet" type="text/css" href="css/animate.css">
<link rel="stylesheet" type="text/css" href="css/owl.carousel.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/responsive.css">
<link rel="stylesheet" type="text/css" href="css/messages.css">
</head>
<body>
<header id="header-wrap">
<?php
require_once 'config.php';
include 'navbar.php';
?>
</header>
<div class="page-header" style="background: url(img/banner1.jpg);">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="breadcrumb-wrapper">
<h2 class="product-title">Messages</h2>
<ol class="breadcrumb">
<li><a href="#">Home /</a></li>
<li class="current">Messages</li>
</ol>
</div>
</div>
</div>
</div>
</div>
<div id="content " class="section-padding ">
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-8 col-lg-12 inner-box ">
<div class="page-content ">
<div class=" row offers-messages">
<section class="users col-lg-4">
<div class="dashboardboxtitle">
<div class="search">
<span class="text">Select an user to start chat</span>
<input type="text" placeholder="Enter name to search...">
<button><i class="lni-search"></i></button>
</div>
</div>
<div class="users-list">
</div>
</section>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-8 chatBox">
<section class="chat-area">
<?php
if(isset($_GET['from'])) {
?>
<div class="dashboardboxtitle msgTitle">
<?php
$user_id = mysqli_real_escape_string($conn, $_GET['from']);
// if($user_id==null||$user_id==''||$user_id=='null') $user_id='0';
$sql = mysqli_query($conn, "SELECT * FROM user LEFT JOIN AVATAR ON (AVATAR.AVATAR_ID=USER.AVATAR_ID) WHERE USER_ID = {$user_id}");
if(mysqli_num_rows($sql) > 0){
$row = mysqli_fetch_assoc($sql);
$avatar=$row['AVATAR_NAME'];
if($avatar!=null){
$avatarLink="img/avatar/".$avatar;
}else{
$avatarLink="img/author/avatar.jpg";
}
if($row['USER_ID']===$_SESSION['userID']){
$name=$row['USER_NAME']." (me)";
}else{
$name=$row['USER_NAME'];
}
}else{
header("location: web/users.php");
}
?>
<a href="web-messages.php" class="back-icon"><i class="lni-chevron-left"></i></a>
<button class="msgUser" onclick="visitUser('<?php echo $row['USER_ID']; ?>')"><img src="<?php echo $avatarLink; ?>" alt=""></button>
<div class="details">
<button class="msgUser" onclick="visitUser('<?php echo $row['USER_ID']; ?>')"><span><?php echo $name; ?></span></button>
<p><?php echo 'ACTIVE'; ?></p>
</div>
</div>
<div class="chat-box">
</div>
<form action="#" class="typing-area">
<input type="text" class="incoming_id" name="incoming_id" value="<?php if($user_id==null||$user_id==''||$user_id=='null') echo $user_id='0'; else echo $user_id; ?>" hidden>
<input type="text" name="message" class="input-field" placeholder="Type a message here..." autocomplete="off">
<button><i class="lni-pointer icon-flip"></i></button>
</form>
</section>
<?php
}else{
echo '<div class="chat-box">
<div class="start-msg">
<div class="start-content"><i class="lni-comments"></i></div>
<div class="start-content">Start Chatting!</div>
</div>
</div>';
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include 'footer.php';
mysqli_close($conn);
?>
<a href="#" class="back-to-top">
<i class="lni-chevron-up"></i>
</a>
<div id="preloader">
<div class="loader" id="loader-1"></div>
</div>
<script>
function visitUser(id){
location.href = "profile.php?userID="+id;
}
</script>
<script src="js/jquery-min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.counterup.min.js"></script>
<script src="js/waypoints.min.js"></script>
<script src="js/wow.js"></script>
<script src="js/owl.carousel.min.js"></script>
<script src="js/nivo-lightbox.js"></script>
<script src="js/jquery.slicknav.js"></script>
<script src="js/main.js"></script>
<script src="js/form-validator.min.js"></script>
<script src="js/contact-form-script.min.js"></script>
<script src="js/summernote.js"></script>
<script src="web/js/users.js"></script>
<script src="web/js/chat.js"></script>
</body>
</html>