-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathverify.php
More file actions
34 lines (32 loc) · 1.3 KB
/
verify.php
File metadata and controls
34 lines (32 loc) · 1.3 KB
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
<html>
<?php include "header.php"; ?>
<body>
<br>
<?php
if(!SECURE)
echo '<center><div style="color:red;"><b>Warning:</b> Development mode is enabled. Unless you know what you are doing, it may not be safe for you to login.</div></center><br>';
if(!isSignedIn()) {
if($_SERVER['REQUEST_METHOD'] == "GET") { // HTTP GET
if(isset($_REQUEST['token']) && isset($_REQUEST['id'])) { // second visit after clicking the email link
if(validToken($_REQUEST['id'], 2, $_REQUEST['token'])) {
$id = $_GET['id'];
$token = $_GET['token'];
$user = getUser($id);
invalidateToken($id);
setVerified($id, true);
login($user['username'], $token, true);
echo 'Your account has been verified. Ready to see <a href="/profile/">your profile</a>?';
} else {
echo "Error: Either the verification link expired, or it never existed.";
}
} else { // first visit
echo "Error: `token` or `id` not set.";
}
}
} else {
echo '<center>You\'re already signed in! <a href="/">Go home</a>.</center>';
}
?>
<?php include "footer.php"; ?>
</body>
</html>