-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathWordPress için harici PHP dosyasında şifre güncelleme.php
More file actions
42 lines (34 loc) · 1.39 KB
/
WordPress için harici PHP dosyasında şifre güncelleme.php
File metadata and controls
42 lines (34 loc) · 1.39 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
<?php
// Eğer form gönderildiyse
if (isset($_POST['change_password'])) {
$old_password = $_POST['old_password'];
$new_password = $_POST['new_password'];
$confirm_new_password = $_POST['confirm_new_password'];
// Mevcut kullanıcıyı al
$user = wp_get_current_user();
// Eski şifreyi kontrol et
if (wp_check_password($old_password, $user->user_pass, $user->ID)) {
// Yeni şifreler eşleşiyor mu?
if ($new_password === $confirm_new_password) {
// Şifreyi güncelle
wp_set_password($new_password, $user->ID);
// Başarı mesajı
echo "Şifreniz başarıyla değiştirildi.";
} else {
echo "Yeni şifreler eşleşmiyor.";
}
} else {
echo "Eski şifre yanlış.";
}
}
echo '<!-- Şifre değiştirme formu -->
<form action="" method="POST">
<label for="old_password">Eski Şifre:</label>
<input type="password" name="old_password" required><br>
<label for="new_password">Yeni Şifre:</label>
<input type="password" name="new_password" required><br>
<label for="confirm_new_password">Yeni Şifreyi Tekrar Girin:</label>
<input type="password" name="confirm_new_password" required><br>';
wp_nonce_field('password_change_action', 'password_change_nonce');
echo '<input type="submit" name="change_password" value="Şifreyi Değiştir">
</form>';