-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
67 lines (61 loc) · 2.16 KB
/
index.php
File metadata and controls
67 lines (61 loc) · 2.16 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
<?php
if (!file_exists('config.php')) {
require_once 'maintenance.php';
exit;
}
require_once 'config.php';
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
if (isset($maintenance_mode) && $maintenance_mode === true) {
require_once 'maintenance.php';
exit;
}
if (!isset($_SESSION['user_id'])) {
try {
$conn = getDbConnection();
setupDatabase($conn);
$conn->close();
header("Location: login.html");
exit;
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "<br>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>InfinityChat</title>
<link rel="stylesheet" href="css/style.css">
<link rel="icon" type="image/ico" href="images/favicon.ico">
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32.png">
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16.png">
<script src="js/notifications.js"></script>
</head>
<body>
<div id="chat-container">
<div id="chat-header" class="aero-header">
<h2>InfinityChat</h2>
<p>Welcome, <strong><?php echo htmlspecialchars($_SESSION['username']); ?></strong>!</p>
</div>
<div id="chat-box">
</div>
<div id="upload-progress-container" style="display: none;">
<p style="margin: 0 0 5px;">Uploading <strong id="upload-filename"></strong>...</p>
<progress id="upload-progress" value="0" max="100"></progress>
</div>
<form id="chat-form" method="POST" enctype="multipart/form-data">
<textarea name="message" id="message-input" placeholder="Type a message..." rows="1"></textarea>
<input type="file" name="file" id="file-input" style="display: none;">
<button type="button" id="attach-file-btn" title="Attach File">📎</button>
<button type="submit" title="Send">➤</button>
</form>
<div id="file-preview-container"></div>
</div>
<script src="js/messager.js"></script>
<script src="js/main.js"></script>
</body>
</html>