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

include_once('./common.php');

 if ($_GET['type'] == 'qq') {
 $reward = getreward('qq', 0);
	$sysrule = getreward('system', 0);
$_SGLOBAL['db']->query('UPDATE '.tname('space')." SET credit=credit-$reward[credit], experience=experience+$reward[experience] WHERE uid='{$_SGLOBAL['supe_uid']}'");
	$_SGLOBAL['db']->query('UPDATE '.tname('space')." SET credit=credit+$reward[credit]-$sysrule[credit] WHERE uid='{$_GET['uid']}'");
}
if ($_GET['type'] == 'mobile') {
 $reward = getreward('mobile', 0);
	 $sysrule = getreward('system', 0);
$_SGLOBAL['db']->query('UPDATE '.tname('space')." SET credit=credit-$reward[credit], experience=experience+$reward[experience] WHERE uid='{$_SGLOBAL['supe_uid']}'");
	$_SGLOBAL['db']->query('UPDATE '.tname('space')." SET credit=credit+$reward[credit]-$sysrule[credit] WHERE uid='{$_GET['uid']}'");
}
if ($_GET['type'] == 'email') {
 $reward = getreward('email', 0);
	 $sysrule = getreward('system', 0);
$_SGLOBAL['db']->query('UPDATE '.tname('space')." SET credit=credit-$reward[credit], experience=experience+$reward[experience] WHERE uid='{$_SGLOBAL['supe_uid']}'");
	$_SGLOBAL['db']->query('UPDATE '.tname('space')." SET credit=credit+$reward[credit]-$sysrule[credit] WHERE uid='{$_GET['uid']}'");
}
if ($_GET['type'] == 'mqq') {
 $mqquid=$_GET['uid'];
$_SGLOBAL['db']->query('UPDATE '.tname('show')." SET credit=credit-1 WHERE uid='$mqquid'");
}
//------------------------------------------------------
if($_GET['type']=='audio') {
	$query = $_SGLOBAL['db']->query("SELECT m.fee FROM ".tname('major')." m JOIN ".tname('collate')." c ON m.u_id=c.u_id WHERE c.collating=9 AND c.collated=1 AND m.u_id='{$_SGLOBAL['supe_uid']}'");
	$value = $_SGLOBAL['db']->fetch_array($query);
	$reward = getreward('audio', 0);
	if(empty($value)) {
		$sysrule = getreward('system', 0);
		$_SGLOBAL['db']->query('UPDATE '.tname('space')." SET credit=credit-$reward[credit], experience=experience+$reward[experience] WHERE uid='{$_GET['uid']}'");
		$_SGLOBAL['db']->query('UPDATE '.tname('space')." SET credit=credit+$reward[credit]-$sysrule[credit] WHERE uid='{$_SGLOBAL['supe_uid']}'");
	}else{
		$expr = getreward('expert', 0);
		$exprule =floor ($value['fee']  * (1- $expr['credit'] /100));
		$_SGLOBAL['db']->query('UPDATE '.tname('space')." SET credit=credit-$value[fee], experience=experience+$reward[experience] WHERE uid='{$_GET['uid']}'");
		$_SGLOBAL['db']->query('UPDATE '.tname('space')." SET credit=credit+$exprule  WHERE uid='{$_SGLOBAL['supe_uid']}'");
	}
}
if($_GET['type']=='video') {
	$query = $_SGLOBAL['db']->query("SELECT m.fee FROM ".tname('major')." m JOIN ".tname('collate')." c ON m.u_id=c.u_id WHERE c.collating=9 AND c.collated=1 AND m.u_id='{$_SGLOBAL['supe_uid']}'");
	$value = $_SGLOBAL['db']->fetch_array($query);
	$reward = getreward('video', 0);
	if(empty($value)) {
		$sysrule = getreward('system', 0);
		$_SGLOBAL['db']->query('UPDATE '.tname('space')." SET credit=credit-$reward[credit], experience=experience+$reward[experience] WHERE uid='{$_GET['uid']}'");
		$_SGLOBAL['db']->query('UPDATE '.tname('space')." SET credit=credit+$reward[credit]-$sysrule[credit] WHERE uid='{$_SGLOBAL['supe_uid']}'");
	}else{
		$expr = getreward('expert', 0);
		$exprule =floor ($value['fee']  * (1- $expr['credit'] /100));
		$_SGLOBAL['db']->query('UPDATE '.tname('space')." SET credit=credit-$value[fee], experience=experience+$reward[experience] WHERE uid='{$_GET['uid']}'");
		$_SGLOBAL['db']->query('UPDATE '.tname('space')." SET credit=credit+$exprule  WHERE uid='{$_SGLOBAL['supe_uid']}'");
	}
}
?>