This repository has been archived on 2024-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
mybb-digest/digest.php

23 lines
667 B
PHP
Raw Normal View History

2017-05-04 09:11:59 +03:00
<?php
require_once "vendor/autoload.php";
require_once "activethreads.php";
2017-05-04 09:39:07 +03:00
require_once "email.php";
2017-05-04 09:11:59 +03:00
define("MYBB_ROOT", "../");
define("MYBB_PREFIX", "mybb_");
define("FORUM_ID", 0);// 0 means all forums
$dsn = 'mysql:host=localhost;dbname=mybb;charset=utf8';
$usr = 'root';
$pwd = '123456';
2017-05-04 09:59:49 +03:00
$pdo = new PDO($dsn, $usr, $pwd);
2017-05-04 09:11:59 +03:00
$threads = getLatestActiveThreads(FORUM_ID, 100, true);
2017-05-04 09:59:49 +03:00
$users = $pdo->prepare("SELECT email, username FROM ".MYBB_PREFIX."users
WHERE usergroup = 4
AND isSubscribed = 1");
$users->execute();
$users = $users->fetchAll();
2017-05-04 09:39:07 +03:00
foreach ($users as $user) {
$email = $user['email'];
print_email($user['username'], '/unsubscribe', $threads);
}