<?php
error_reporting(0);
close_browse();
if (!eregi($_SERVER['SERVER_NAME'], $_SERVER['HTTP_REFERER'])) {exit();}
global $db, $CcTvAi_com_userid;
$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 * from " . tname('valbum') . " where CD_ID='" . $cd_id . "'");
	if ($row['CD_User']==$CcTvAi_com_username) {
		$db->query("delete from " . tname('feed') . " where cd_icon='valbum' and cd_dataid='" . $cd_id . "'");
		$db->query("delete from " . tname('valbum') . " where CD_User='" . $CcTvAi_com_username . "' and CD_ID = '" . $cd_id . "'");
		if (delunlink($row['CD_Pic'])==true) {@unlink(_cctvai_root_ . $row['CD_Pic']);}
		exit($callback . '({"error":004})');
	} else {
		exit($callback . '({"error":003})');
	}
} else {
	exit($callback . '({"error":001})');
}
?>