⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 notify_daily.inc.php

📁 一个完整的论坛系统(包括后台管理和数据库)
💻 PHP
字号:
<?php

/*
	[Discuz!] (C)2001-2007 Comsenz Inc.
	This is NOT a freeware, use is subject to license terms

	$Id: notify_daily.inc.php 9806 2007-08-15 06:04:37Z cnteacher $
*/

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

$subscriptions = array();
$query = $db->query("SELECT t.tid, t.subject, t.author, t.lastpost, t.lastposter, t.views, t.replies, m.username, m.email
	FROM {$tablepre}subscriptions s, {$tablepre}members m, {$tablepre}threads t
	WHERE s.lastpost>s.lastnotify AND m.uid=s.uid AND t.tid=s.tid");

while($sub = $db->fetch_array($query)) {
	if(empty($subscriptions[$sub['tid']])) {
		$subscriptions[$sub['tid']] = array
			(
			'thread' => array
				(
				'tid'		=> $sub['tid'],
				'subject'	=> $sub['subject'],
				'author'	=> ($sub['author'] ? $sub['author'] : 'Guest'),
				'lastpost'	=> gmdate($_DCACHE['settings']['dateformat'].' '.$_DCACHE['settings']['timeformat'], $sub['lastpost'] + $_DCACHE['settings']['timeoffset'] * 3600),
				'lastposter'	=> ($sub['lastposter'] ? $sub['lastposter'] : 'Guest'),
				'views'		=> $sub['views'],
				'replies'	=> $sub['replies']
				),
			'emails' => array("$sub[username] <$sub[email]>")
			);
	} else {
		$subscriptions[$sub['tid']]['emails'][] = $sub['email'];
	}
}


foreach($subscriptions as $sub) {
	$thread = $sub['thread'];
	sendmail(implode(',', $sub['emails']), 'email_notify_subject', 'email_notify_message');
}

$db->query("UPDATE {$tablepre}subscriptions SET lastnotify='$timestamp' WHERE lastpost>lastnotify");

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -