<?php
/*
		[FuShow.cn] (C) 2013-2014 HXWY Inc.
		FuShow Friend V3.0				Id: magic_detector.php
		Email <service@fushow.cn>		http://fushow.cn/
*/

if(!defined('IN_FUSHOW')) {
	exit('Access Denied');
}

$magic['custom']['maxdetect'] = $magic['custom']['maxdetect'] ? intval($magic['custom']['maxdetect']) : 10;

//探测灯
if(submitcheck("usesubmit")) {

	magic_use($mid, array(), true);
	
	$op = 'show';
	$limit = $magic['custom']['maxdetect'] + 20;//多取20个
	$query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('magicuselog')." WHERE uid != '$_SGLOBAL[supe_uid]' AND mid = 'gift' LIMIT $limit");
	$list = array();
	$max = 1;
	while($value = $_SGLOBAL['db']->fetch_array($query)) {
		$value['data'] = unserialize($value['data']);
		if($value['data']['left'] && 
			(empty($value['data']['receiver']) || 
				!in_array($_SGLOBAL['supe_uid'], $value['data']['receiver']))) {
					
			realname_set($value['uid'], $value['username']);
			$list[] = $value;
			if(++$max > $magic['custom']['maxdetect'])	break;
		}
	}
	realname_get();
}

?>