| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,48 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * Copyright (C) 2022, 2024 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 |
+session_start(); |
|
| 11 |
+ |
|
| 12 |
+ // header('Set-Cookie: PHPSESSID= ' . session_id() . '; SameSite=strict; Secure=true; HttpOnly=true;');
|
|
| 13 |
+ |
|
| 14 |
+$retrievedToken = $_GET['token']; |
|
| 15 |
+$retrievedEmail = $_GET['newemail']; |
|
| 16 |
+ |
|
| 17 |
+if (($retrievedToken != '') && (strlen($retrievedToken) == 55)) {
|
|
| 18 |
+ |
|
| 19 |
+ define('ACCESSCONST', TRUE);
|
|
| 20 |
+ |
|
| 21 |
+ require('db-connect.php');
|
|
| 22 |
+ |
|
| 23 |
+ // Find the user who has the token identical with the one retrieved from the link that has been clicked |
|
| 24 |
+ $registered = 1; |
|
| 25 |
+ $enabled = 1; |
|
| 26 |
+ $query0 = $mysqli->prepare("SELECT id, username, registered, token, enabled FROM app_users WHERE registered = ? AND token = ? AND enabled = ?");
|
|
| 27 |
+ $query0->bind_param("isi", $registered, $retrievedToken, $enabled);
|
|
| 28 |
+ $query0->execute(); |
|
| 29 |
+ $fetcheddbdata = $query0->get_result()->fetch_assoc(); |
|
| 30 |
+ |
|
| 31 |
+ if (!$fetcheddbdata) {
|
|
| 32 |
+ |
|
| 33 |
+ exit("Error !");
|
|
| 34 |
+ |
|
| 35 |
+ } else {
|
|
| 36 |
+ |
|
| 37 |
+ $userName = $fetcheddbdata['username']; |
|
| 38 |
+ |
|
| 39 |
+ $crtoken = ''; |
|
| 40 |
+ $queryupemailandtoken = $mysqli->prepare("UPDATE app_users SET emailaddress = ?, token = ? WHERE username = ?");
|
|
| 41 |
+ $queryupemailandtoken->bind_param("sss", $retrievedEmail, $crtoken, $userName);
|
|
| 42 |
+ $queryupemailandtoken->execute(); |
|
| 43 |
+ |
|
| 44 |
+ header("Location: email-address-changed.php");
|
|
| 45 |
+ } |
|
| 46 |
+} |
|
| 47 |
+ |
|
| 48 |
+?> |