Browse code

Created repository.

DoubleBastionAdmin authored on 29/11/2024 03:10:08
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,52 @@
1
+<?php
2
+
3
+/**
4
+ * @copyright 2024 Double Bastion LLC <www.doublebastion.com>
5
+ *
6
+ * @author Double Bastion LLC
7
+ *
8
+ * @license GNU AGPL version 3 or any later version
9
+ *
10
+ * This program is free software; you can redistribute it and/or
11
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
12
+ * License as published by the Free Software Foundation; either
13
+ * version 3 of the License, or any later version.
14
+ *
15
+ * This program is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
19
+ *
20
+ * You should have received a copy of the GNU Affero General Public
21
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
+ *
23
+ */
24
+
25
+$retrieved = $_GET['key'];
26
+
27
+if (($retrieved != '') && (strlen($retrieved) == 50)) {
28
+
29
+  define('ACCESSCONST', TRUE);
30
+
31
+  require('db-connect.php');
32
+
33
+    // Check if any user has a token identical with the one retrieved from the link that has been clicked
34
+    $registereduser = '0';
35
+    $query0 = $mysqli->prepare("SELECT id, registered, token FROM panelusers WHERE registered=? AND token=?");
36
+    $query0->bind_param("ss", $registereduser, $retrieved);
37
+    $query0->execute();
38
+    $fetchdata = $query0->get_result()->fetch_assoc();
39
+
40
+    if (!$fetchdata) {
41
+        $query0->close();
42
+        die("Error !");
43
+    } else {
44
+        $ID = $fetchdata['id'];
45
+        $query1 = $mysqli->query("UPDATE panelusers SET registered = '1', token = ''  WHERE id = '$ID'");
46
+        header("Location: registration-success.php");
47
+        $query1->close();
48
+        $query0->close();
49
+      }
50
+}
51
+
52
+?>