Browse code

Created repository.

DoubleBastionAdmin authored on 26/01/2022 20:32:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,36 @@
1
+<?php
2
+/**
3
+ *  Copyright (C) 2021  Double Bastion LLC
4
+ *
5
+ *  This file is part of Roundpin, which is licensed under the
6
+ *  GNU Affero General Public License Version 3.0. The license terms
7
+ *  are detailed in the "LICENSE.txt" file located in the root directory.
8
+ */
9
+
10
+$retrieved = $_GET['key'];
11
+
12
+if (($retrieved != '') && (strlen($retrieved) == 50)) {
13
+
14
+  define('ACCESSCONST', TRUE);
15
+
16
+  require('db-connect.php');
17
+
18
+    // Find the user who has a token identical with the one retrieved from the link that has been clicked
19
+    $registereduser = '0';
20
+    $enabled = 1;
21
+    $query0 = $mysqli->prepare("SELECT id, registered, token, enabled FROM app_users WHERE registered=? AND token=? AND enabled=?");
22
+    $query0->bind_param("ssi", $registereduser, $retrieved, $enabled);
23
+    $query0->execute();
24
+    $fetchdata = $query0->get_result()->fetch_assoc();
25
+
26
+    if (!$fetchdata) {
27
+        $query0->close();
28
+        exit("Error !");
29
+    } else {
30
+        $ID = $fetchdata['id'];
31
+        $query1 = $mysqli->query("UPDATE app_users SET registered = '1', token = ''  WHERE id = '$ID'");
32
+        header("Location: registration-success.php");
33
+    }
34
+}
35
+
36
+?>