-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinv.php
More file actions
105 lines (88 loc) · 3.33 KB
/
inv.php
File metadata and controls
105 lines (88 loc) · 3.33 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
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
<?php
// SPDX-FileCopyrightText: 2021 Weymeirsch und Langer GbR
//
// SPDX-License-Identifier: AGPL-3.0-only
// read input
$ihash=$_GET['id'];
$ahash=$_GET['admin'];
$error=$_GET['error'];
// session information (time)
$ctim=strtotime("now");
// Load required configs
list($pwd) = preg_replace('/\/[^\/]+$/', "/", get_included_files());
$conf_path = $pwd . "conf/common.php";
include($conf_path);
// detect language
$lang_path = $pwd . "lib/language.php";
include($lang_path);
$lang=detect_language();
// Load i18n strings
$i18n_path = $pwd . "conf/i18n.php";
include($i18n_path);
// connect to database
$sqlcon = new mysqli($sqlhost, $sqluser, $sqlpass, $sqlname);
if ($sqlcon->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if ($ihash > 0) {
// check whether admin-id is legit (if provided)
if ($ahash > 0) {
// extract admin-id and room-id from given invite-id
$sqlque = "SELECT aid, rid FROM " . $sqltabl . " WHERE iid=" . $ihash . "";
$sqlres = $sqlcon->query($sqlque)->fetch_assoc();
// is given admin ID legit?
if ($sqlres["aid"] == $ahash) {
header("Location: /out.php?room=" . $sqlres["rid"] . "");
exit();
// if not, reload site with invite ID only.
} else {
header("Location: /inv.php?id=" . $ihash . "");
exit();
}
// if no admin ID is given, check whether the conference already started.
} else {
// extract conference date, time and room-id from given invite-id
$sqlque = "SELECT time, rid FROM " . $sqltabl . " WHERE iid=" . $ihash . "";
$sqlres = $sqlcon->query($sqlque)->fetch_assoc();
// if room exists
if ($sqlres) {
// if room is already open
if ($ctim >= $sqlres["time"]) {
header("Location: /out.php?room=" . $sqlres["rid"] . "");
exit();
} else {
// Load HTML functions
$html_path = $pwd . "lib/html.php";
include($html_path);
// Create HTML Content
$html_content="<meta http-equiv='refresh' content='30' >
<h1>" . $waith . "</h1>
<div class='justify-content-center'>
<p>" . $waitt . "</p><br>
<img src='/static/img/waiting.gif' alt='Waiting...' width='100px'>
</div>";
build_html($html_content, $inv_title, $inv_desc);
}
} else {
// if room does not exist
header("Location: /inv.php?error=true");
exit();
}
}
} else {
// Load HTML functions
$html_path = $pwd . "lib/html.php";
include($html_path);
// Create HTML Content
$html_content="<h1>" . $noidh . "</h1>
<div class='justify-content-center'>
<form action='/inv.php'>
<label for='id'><strong>" . $list4 . "</strong></label><br>
<input type='text' id='id' name='id'><br><br>
</form>
</div>";
build_html($html_content, $inv_title, $inv_desc);
}
// Close database connection
$sqlcon->close();
?>