25 lines
676 B
PHP
25 lines
676 B
PHP
<?php
|
|
require_once "config.php";
|
|
$pdo = new PDO(DSN, MYSQL_USER, MYSQL_PASSWORD);
|
|
$key = $pdo->prepare("SELECT loginkey FROM ".MYBB_PREFIX."users WHERE email = :email");
|
|
$loginkey = $_GET['key'];
|
|
$email = $_GET['email'];
|
|
if (empty($loginkey) || empty($email)) {
|
|
echo "Not enough parameters.";
|
|
var_dump($_GET);
|
|
return;
|
|
}
|
|
$key->execute([
|
|
'email' => $email
|
|
]);
|
|
$key = $key->fetch()['loginkey'];
|
|
if ($key === $loginkey) {
|
|
$key = $pdo->prepare('UPDATE '.MYBB_PREFIX."users SET isSubscribed = 0 WHERE email = :email");
|
|
$key->execute([
|
|
'email' => $email
|
|
]);
|
|
echo "You were unsubscribed. Close this window.";
|
|
} else {
|
|
echo "Key is incorrect. No action made.";
|
|
}
|