| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,82 @@ |
| 1 |
+<?php |
|
| 2 |
+/** |
|
| 3 |
+ * @copyright 2024 Double Bastion LLC <www.doublebastion.com> |
|
| 4 |
+ * |
|
| 5 |
+ * @author Double Bastion LLC |
|
| 6 |
+ * |
|
| 7 |
+ * @license GNU AGPL version 3 or any later version |
|
| 8 |
+ * |
|
| 9 |
+ * This program is free software; you can redistribute it and/or |
|
| 10 |
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
| 11 |
+ * License as published by the Free Software Foundation; either |
|
| 12 |
+ * version 3 of the License, or any later version. |
|
| 13 |
+ * |
|
| 14 |
+ * This program is distributed in the hope that it will be useful, |
|
| 15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 17 |
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
|
| 18 |
+ * |
|
| 19 |
+ * You should have received a copy of the GNU Affero General Public |
|
| 20 |
+ * License along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 21 |
+ * |
|
| 22 |
+ */ |
|
| 23 |
+ |
|
| 24 |
+$retrievedToken = $_GET['token']; |
|
| 25 |
+ |
|
| 26 |
+if (($retrievedToken != '') && (strlen($retrievedToken) == 55)) {
|
|
| 27 |
+ |
|
| 28 |
+ define('ACCESSCONST', TRUE);
|
|
| 29 |
+ |
|
| 30 |
+ require('db-connect.php');
|
|
| 31 |
+ |
|
| 32 |
+ // Check if any user has a token identical with the one retrieved from the link that has been clicked |
|
| 33 |
+ $registered = '0'; |
|
| 34 |
+ $query0 = $mysqli->prepare("SELECT id, username, emailaddress, registered, token, temporary FROM panelusers WHERE registered=? AND token=?");
|
|
| 35 |
+ $query0->bind_param("ss", $registered, $retrievedToken);
|
|
| 36 |
+ $query0->execute(); |
|
| 37 |
+ $fetchedrow = $query0->get_result()->fetch_assoc(); |
|
| 38 |
+ |
|
| 39 |
+ if (!$fetchedrow) {
|
|
| 40 |
+ $query0->close(); |
|
| 41 |
+ die("Error !");
|
|
| 42 |
+ } else {
|
|
| 43 |
+ $userID = $fetchedrow['id']; |
|
| 44 |
+ $userName = $fetchedrow['username']; |
|
| 45 |
+ $tempPassword = $fetchedrow['temporary']; |
|
| 46 |
+ $useremail = $fetchedrow['emailaddress']; |
|
| 47 |
+ $query0->close(); |
|
| 48 |
+ |
|
| 49 |
+ $query1 = $mysqli->query("UPDATE panelusers SET registered = '1', token = '', temporary = '' WHERE id = '$userID'");
|
|
| 50 |
+ header("Location: new-email-message.php");
|
|
| 51 |
+ |
|
| 52 |
+ // Send the new email |
|
| 53 |
+ |
|
| 54 |
+ $domaininit = explode(".", $_SERVER['HTTP_HOST']);
|
|
| 55 |
+ array_shift($domaininit); |
|
| 56 |
+ $domain = implode(".", $domaininit);
|
|
| 57 |
+ $reqScheme = $_SERVER['REQUEST_SCHEME']; |
|
| 58 |
+ $reqHost = $_SERVER['HTTP_HOST']; |
|
| 59 |
+ |
|
| 60 |
+ // Mention the content-type, since it's an HTML email |
|
| 61 |
+ $headers = "MIME-Version: 1.0" . "\r\n"; |
|
| 62 |
+ $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n"; |
|
| 63 |
+ $headers .= "From: " . "no-reply@" . $domain . "\r\n"; |
|
| 64 |
+ |
|
| 65 |
+ $subject = "RED SCARF Suite Panel account access"; |
|
| 66 |
+ |
|
| 67 |
+ $message = "Hello, <br><br> |
|
| 68 |
+ You can log in to your RED SCARF Suite Panel account using the following credentials:<br><br> |
|
| 69 |
+ username: <b>".$userName."</b><br> |
|
| 70 |
+ password: <b>".$tempPassword."</b><br><br> |
|
| 71 |
+ We highly recommend to change the password provided in this email with a new strong password. After you access the |
|
| 72 |
+ <a href='" . $reqScheme . "://" . $reqHost . "/panel-login.php'>log in page</a>, go to 'Settings' > 'Change password' and choose a new |
|
| 73 |
+ password of at least 10 characters, containing at least one letter, one digit and one special character.<br><br> |
|
| 74 |
+ Thank you,<br> |
|
| 75 |
+ RED SCARF Suite Panel<br> |
|
| 76 |
+ Host: '" . $reqHost . "'"; |
|
| 77 |
+ |
|
| 78 |
+ mail($useremail, $subject, $message, $headers); |
|
| 79 |
+ } |
|
| 80 |
+} |
|
| 81 |
+ |
|
| 82 |
+?> |