-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchat.php
More file actions
74 lines (68 loc) · 2.92 KB
/
chat.php
File metadata and controls
74 lines (68 loc) · 2.92 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scle=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Realtime chat app</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="emojionearea.min.css">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css"/>
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous"></script>
<script src="javascript/emojionearea.min.js"></script>
</head>
<!-- PHP to check session status, if invalid user redirected -->
<?php
session_start();
if (!isset($_SESSION['unique_ID'])){
header("location: login.php");
}
?>
<body>
<div id="logo">
<img src="php/images/logo.png" width = "200" height = "200">
</div>
<div class="wrapper">
<div class="containment">
<section class="chat-area">
<header>
<?php
include_once "php/config.php";
$user_ID = mysqli_real_escape_string($conn, $_GET['user_id']);
$sql_user_select = mysqli_query($conn, "SELECT * FROM users WHERE unique_ID = {$user_ID}");
if (mysqli_num_rows($sql_user_select) > 0)
{
$row_data = mysqli_fetch_assoc($sql_user_select);
}
?>
<a href="users.php" class="back-icon"><i class="fas fa-arrow-left"></i></a>
<img src="php/images/<?php echo $row_data['profile_img'] ?>" alt="">
<div class="details">
<span><?php echo $row_data['first_name']." ".$row_data['last_name'] ?></span>
<p><?php echo $row_data['status']?></p>
</div>
</header>
<div class="chat-box">
</div>
<form action="#" class="typing-area" autocomplete="off">
<input type="text" name="outgoing_user_ID" value="<?php echo $_SESSION['unique_ID']; ?>" hidden>
<input type="text" name="incoming_user_ID" value="<?php echo $user_ID; ?>" hidden>
<input type="text" name="message" id="myTextarea" class="input-field" placeholder="Enter message...">
<button><i class="fab fa-telegram-plane"></i></button>
</form>
</section>
</div>
</div>
<script src="javascript/chat.js"></script>
<script>
$(document).ready(function() {
$("#myTextarea").emojioneArea({
pickerPosition: "bottom"
});
})
</script>
</body>
</html>