-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathverify.php
More file actions
98 lines (84 loc) · 3.59 KB
/
Copy pathverify.php
File metadata and controls
98 lines (84 loc) · 3.59 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
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
$nonce = base64_encode(random_bytes(16));
header("Content-Security-Policy: default-src 'self'; script-src 'self' 'nonce-$nonce'; style-src 'self' 'nonce-$nonce'; img-src 'self' 'nonce-$nonce' data:; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none';");
require_once 'utilities.php';
$alertMessage = "";
$alertMessage_Type = "";
$conn = get_db_connection();
// Check if the token parameter is set
if (filter_input(INPUT_GET, 'token') !== null) {
$token = filter_input(INPUT_GET, 'token');
// Query to check if the token exists in the database
$sql = "SELECT id FROM users WHERE verification_token=?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $token);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
// Update the seller's status to verified
$update_sql = "UPDATE users SET user_verified=1, verification_token=NULL WHERE verification_token=?";
$update_stmt = $conn->prepare($update_sql);
$update_stmt->bind_param("s", $token);
if ($update_stmt->execute()) {
$alertMessage = "Dein Konto wurde erfolgreich verifiziert. Du wirst in wenigen Sekunden weitergeleitet...";
$alertMessage_Type = 'success';
header("Refresh: 3; url=login.php");
} else {
$alertMessage = "Fehler beim Aktivieren des Kontos.";
$alertMessage_Type = 'danger';
}
$update_stmt->close();
} else {
$alertMessage = "Ungültiger oder abgelaufener Token.";
$alertMessage_Type = 'danger';
}
$stmt->close();
} else {
$alertMessage = "Ungültiger oder abgelaufener Token.";
$alertMessage_Type = 'danger';
}
$conn->close();
// Display the message
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Konto Verifizierung</title>
<!-- Preload and link CSS files -->
<link rel="preload" href="css/bootstrap.min.css" as="style" id="bootstrap-css">
<link rel="preload" href="css/all.min.css" as="style" id="all-css">
<link rel="preload" href="css/style.css" as="style" id="style-css">
<noscript>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/all.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
</noscript>
<script nonce="<?php echo $nonce; ?>">
document.getElementById('bootstrap-css').rel = 'stylesheet';
document.getElementById('all-css').rel = 'stylesheet';
document.getElementById('style-css').rel = 'stylesheet';
</script>
</head>
<body>
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-12 col-sm-10 col-md-8 col-lg-6">
<?php if ($alertMessage): ?>
<div class="alert alert-<?php echo htmlspecialchars($alertMessage_Type); ?> text-center">
<?php echo htmlspecialchars($alertMessage); ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Schliessen">
<span aria-hidden="true">×</span>
</button>
</div>
<?php endif; ?>
</div>
</div>
</div>
<!-- Include JavaScript files -->
<script src="js/jquery-3.7.1.min.js" nonce="<?php echo $nonce; ?>"></script>
<script src="js/popper.min.js" nonce="<?php echo $nonce; ?>"></script>
<script src="js/bootstrap.min.js" nonce="<?php echo $nonce; ?>"></script>
</body>
</html>