-
Notifications
You must be signed in to change notification settings - Fork 0
/
reactive.php
127 lines (110 loc) · 4.47 KB
/
reactive.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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!-- reactive.php -->
<?php
session_start();
require 'db_connection.php';
if (!isset($_SESSION['user_id'])) {
header("Location: " . ($phpenable === 'true' ? $login_url . '.php' : $login_url));
exit;
}
$sql = "SELECT * FROM benutzer WHERE id = " . $_SESSION['user_id'];
$result = $conn->query($sql);
$user = $result->fetch_assoc();
$userId = $_SESSION['user_id'];
$sql = "SELECT gesperrt, name FROM benutzer WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $userId);
$stmt->execute();
$stmt->bind_result($isLocked, $userName);
$stmt->fetch();
$stmt->close();
if ($isLocked) {
session_destroy();
header("Location: " . ($phpenable === 'true' ? $login_url . '.php' : $login_url));
exit;
}
$userId = $_SESSION['user_id'];
$sql = "SELECT deleted FROM benutzer WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $userId);
$stmt->execute();
$stmt->bind_result($isDeleted);
$stmt->fetch();
$stmt->close();
if ($isDeleted == 1) {
} elseif ($isDeleted == 0) {
header("Location: " . ($phpenable === 'true' ? $siteurl . $dash_url . '.php' : $siteurl . $dash_url));
exit;
}
if (empty($userName)) {
session_destroy();
header("Location: " . ($phpenable === 'true' ? $login_url . '.php' : $login_url));
exit;
}
$creationDateQuery = "SELECT creation_date FROM queue WHERE user_id = ?";
$stmt = $conn->prepare($creationDateQuery);
$stmt->bind_param("i", $userId);
$stmt->execute();
$stmt->bind_result($creationDate);
$stmt->fetch();
$stmt->close();
// Berechne die verbleibenden Tage bis zur Löschung
$deleteDate = strtotime($creationDate) + (7 * 24 * 60 * 60); // Hinzufügen von 7 Tagen in Sekunden
$remainingDays = ceil(($deleteDate - time()) / (24 * 60 * 60)); // Berechne die verbleibenden Tage
?>
<?php
include 'settings/config.php';
include 'settings/head.php';
?>
<title>Reaktivieren —
<?= $name ?>
</title><br><br>
<br><br>
<div class="row justify-content-center">
<div class=col-lg-9>
<?php if (isset($_SESSION['success_message'])) { ?>
<div class="alert alert-success" role="alert">
<div class="alert-group-prepend">
<span class="alert-group-icon text-">
<i class="fa-solid fa-circle-check"></i>
</span>
<?php echo $_SESSION['success_message']; ?>
</div>
</div>
<?php unset($_SESSION['success_message']); // Lösche die Session-Variablen nach der Anzeige ?>
<?php } ?>
<div class="card mb-n7 position-relative zindex-100">
<h1 class="text-center mt-5"><?= ( $translations['reactive']['title']) ?></h1>
<div class="card-body px-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6 text-center">
<p class="text opacity-8">
<?= str_replace('{days}', '<strong>' . $remainingDays . '</strong>', str_replace('{username}', $userName, $translations['reactive']['text'])) ?>
</p>
<form method="post" action="actions/reactive_account.php" id="reactivateAccountForm">
<button type="submit" class="btn btn-success btn-icon hover-translate-y-n3">
<span class="btn-inner--icon">
<i class="fa-solid fa-recycle"></i>
</span>
<span class="btn-inner--text"><?= ( $translations['reactive']['button_reactive']) ?></span>
</button>
</form><br><br>
<p class="text opacity-8">
<?= ( $translations['reactive']['text_2']) ?>
</p>
<a href="<?= $logout_url ?>" class="btn btn-danger btn-icon hover-translate-y-n3">
<span class="btn-inner--icon">
<i class="fa-solid fa-right-from-bracket"></i>
</span>
<span class="btn-inner--text"><?= ( $translations['reactive']['button_logout']) ?></span>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div><br><br><br><br>
<?php
include 'settings/footer.php';
?>