-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfirm.php
66 lines (55 loc) · 1.7 KB
/
confirm.php
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
<?php
include 'header.php';
?>
<!DOCTYPE html>
<html>
<head>
<?php if($theme == 'light'){?>
<link rel="stylesheet" href="style.css">
<?php } else { ?>
<link rel="stylesheet" href="styledark.css">
<?php } ?>
<title>Private Messaging System</title>
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
<script src="blogpost.js"></script>
<script type="text/javascript">
</script>
</head>
<body>
<?php if($theme == 'light'){?>
<a id="themeswitcher" href="switchtheme.php?theme=dark">Switch theme</a>
<?php } else {?>
<a id="themeswitcher" href="switchtheme.php?theme=light">Switch theme</a>
<?php } ?>
<div id="header">
</div>
<div id="body">
<?php
// Create a database connection
$conn = new mysqli($servernamesql, $usernamesql, $passwordsql, $databasesql);
// Check the connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Get the token from the URL
$token = trim($_GET["token"]);
// Verify the token and update user account
$sql = "UPDATE users SET is_confirmed = 1 WHERE confirmation_token = '$token'";
if ($conn->query($sql) === TRUE) {
echo "Email confirmation successful. You can now log in.";
echo '<a href="index.php">Go to OpenBook</a>';
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
</div>
<?php
include 'footer.php';
?>
</body>
</html>
<?php
// Close the database connection
$conn->close();
?>