<?php
/*
'**************************************************************************************************
' 程序名称: CCTVAI开源音乐管理系统
' 官方网站: http://www.cctvai.com
' 联系 Q Q: 1542367792
' QQ交流群：136687984
' 版本：(终结版)
' 备注：未经书面授权，不得向任何第三方提供本软件系统！
' 功能，模板，插件，扩展，定制请联系QQ：1542367792
'**************************************************************************************************
*/
error_reporting(0);
if(!eregi($_SERVER['SERVER_NAME'], $_SERVER['HTTP_REFERER'])) {
	exit('0');
}
include 'cctvai.conn.php';
$CD_type=SafeRequest('ac', 'get');
$CD_ID=SafeRequest('id', 'get');
if(!IsNumID($CD_ID)) {
	exit('0');
}
global $db;
if($CD_type=="news") { //文章
	$sql='Select CD_Hits from ' . tname('news') . " where CD_ID='" . $CD_ID . "'";
	$row=$db->getrow($sql);
	if($row) {
		$db->query('update ' . tname('news') . " set CD_Hits=CD_Hits+1 where CD_ID='" . $CD_ID . "'");
		echo "document.write('" . bqwhits($row['CD_Hits']) . "');";
	}
} elseif($CD_type=="dj") { //单曲
	$sql='Select CD_Hits from ' . tname('dj') . " where CD_ID='" . $CD_ID . "'";
	$row=$db->getrow($sql);
	if($row) {
		$db->query('update ' . tname('dj') . " set CD_DayHits=CD_DayHits+1,CD_WeekHits=CD_WeekHits+1,CD_MonthHits=CD_MonthHits+1,CD_Hits=CD_Hits+1 where CD_ID='" . $CD_ID . "'");
		echo "document.write('" . bqwhits($row['CD_Hits']) . "');";
	}
} elseif($CD_type=="video") { //视频
	$sql='Select CD_Hits from ' . tname('video') . " where CD_ID='" . $CD_ID . "'";
	$row=$db->getrow($sql);
	if($row) {
		$db->query('update ' . tname('video') . " set CD_DayHits=CD_DayHits+1,CD_WeekHits=CD_WeekHits+1,CD_MonthHits=CD_MonthHits+1,CD_Hits=CD_Hits+1 where CD_ID='" . $CD_ID . "'");
		echo "document.write('" . bqwhits($row['CD_Hits']) . "');";
	}
} elseif($CD_type=="singer") { //歌手
	$sql='Select CD_Hits from ' . tname('singer') . " where CD_ID='" . $CD_ID . "'";
	$row=$db->getrow($sql);
	if($row) {
		$db->query('update ' . tname('singer') . " set CD_Hits=CD_Hits+1 where CD_ID='" . $CD_ID . "'");
		echo "document.write('" . bqwhits($row['CD_Hits']) . "');";
	}
} elseif($CD_type=="malbum") { //音乐专辑
	$sql='Select CD_Hits from ' . tname('malbum') . " where CD_ID='" . $CD_ID . "'";
	$row=$db->getrow($sql);
	if($row) {
		$db->query('update ' . tname('malbum') . " set CD_Hits=CD_Hits+1 where CD_ID='" . $CD_ID . "'");
		echo "document.write('" . bqwhits($row['CD_Hits']) . "');";
	}
} elseif($CD_type=="valbum") { //视频专辑
	$sql='Select CD_Hits from ' . tname('valbum') . " where CD_ID='" . $CD_ID . "'";
	$row=$db->getrow($sql);
	if($row) {
		$db->query('update ' . tname('valbum') . " set CD_Hits=CD_Hits+1 where CD_ID='" . $CD_ID . "'");
		echo "document.write('" . bqwhits($row['CD_Hits']) . "');";
	}
} else {
	exit('参数错误');
}
?>