<?

/*
	[SupeSite/X-Space] (C)2001-2006 Comsenz Inc.
	留下腳印

	$RCSfile: batch.track.php,v $
	$Revision: 1.7 $
	$Date: 2006/11/01 01:52:11 $
*/

include_once('./include/main.inc.php');

$itemid = empty($_GET['itemid'])?0:intval($_GET['itemid']);
if(empty($itemid)) exit('Access Denied');

if(!empty($_GET['action'])) {
	getcookie(1);
	if(empty($_SGLOBAL['supe_uid'])) showxml('對不起，您需要登錄後才能進行本操作');
	$_SGLOBAL['db']->query('DELETE FROM '.tname('tracks').' WHERE uid=\''.$_SGLOBAL['supe_uid'].'\' AND itemid=\''.$itemid.'\'');
	showxml("恭喜，您留下的腳印被清除了\n\n請訪問其他頁面\n本頁面會在下次訪問時進行更新");
}

include_once(S_ROOT.'./include/common.inc.php');

dbconnect();
$trackarr = array();
$query = $_SGLOBAL['db']->query('SELECT u.*, tr.dateline, tr.uid FROM '.tname('tracks').' tr LEFT JOIN '.tname('userspaces').' u ON u.uid=tr.uid WHERE tr.itemid=\''.$itemid.'\'');
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
	$value['photo'] = getphoto($value['uid'], $value['photo']);
	if(empty($value['username'])) {
		$value['username'] = 'member';
		$value['url'] = B_URL.'/viewpro.php?uid='.$value['uid'];
	} else {
		$value['url'] = geturl("uid/$value[uid]/action/space/domain/$value[domain]");
	}
	$trackarr[] = $value;
}

$guidearr = array();
$guidearr[] = array('url' => S_URL.'/batch.track.php?itemid='.$itemid, 'name' => '查看腳印');
$channelmenu = $showmenu = array();

$title = '查看腳印';

include template('site_track');