Created
October 21, 2012 08:43
-
-
Save binjoo/3926379 to your computer and use it in GitHub Desktop.
PHP:TYPECHO:获得访客最近评论数
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//获得访客最近评论数 | |
function get_author_comments_num($email = "") { | |
if(empty($email)) return; | |
$commentsNum = Helper::options()->commentsNum; | |
$time = time() - (24 * 60 * 60 * $commentsNum); //当前时间戳减去30天的时间戳 | |
$db = Typecho_Db::get(); | |
$sql = $db->select('COUNT(mail) as emailnum')->from('table.comments') | |
->where('status = ?','approved') | |
->where('mail = ?',$email) | |
->where('created > ?',$time); | |
$result = $db->fetchAll($sql); | |
echo $result[0]['emailnum']; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment