<?php
error_reporting(0);
global $db, $CcTvAi_com_userid;
close_browse();
if (!eregi($_SERVER['SERVER_NAME'], $_SERVER['HTTP_REFERER'])) {exit();}
$callback=SafeRequest("callback", "get");
if ($CcTvAi_com_userid) {
	$cd_id=SafeRequest("did", "get");
	if(!IsNumID($CcTvAi_com_userid)) {exit();}
	if(!IsNumID($cd_id)) {exit();}
	$row=$db->getrow("Select cd_uname,cd_id from " . tname('down') . " where cd_type='video' and cd_id='" . $cd_id . "'");
	if ($row['cd_uname']==$CcTvAi_com_username) {
		$db->query("delete from " . tname('down') . " where cd_type='video' and cd_uid='" . $CcTvAi_com_userid . "' and cd_id = '" . $cd_id . "'");
		exit($callback . '({"error":004})');
	} else {
		exit($callback . '({"error":003})');
	}
} else {
	exit($callback . '({"error":001})');
}
?>