<?php
require_once(dirname(__FILE__).'/../../config.php');
require_once(DIR_SYSTEM.'/admin/class.session.php');

$t	=	$prepare->sanitize( $_GET['t'], 'input');


if ( $t == 'give' ) {
//*** advertisers_deposits ***//
$prepare->sanitize($_POST['name'],'input');

$adv_deposits_user_id	=	$prepare->sanitize( $_POST['user'], 'input');
$adv_deposits_type		=	'0';//type 0 = admin modification
$adv_deposits_email		=	'';
$adv_deposits_amount	=	$prepare->sanitize( $_POST['bonus'], 'input');
$adv_deposits_details	=	$prepare->sanitize( $_POST['details'], 'input');
$adv_deposits_date		=	strtotime( "now" );
$adv_deposits_status	=	'1';

$insert = $db->NoQuery("INSERT INTO advertisers_deposits VALUES(NULL,?,?,?,?,?,?,?)","sssssss",$adv_deposits_user_id,$adv_deposits_type,$adv_deposits_email,$adv_deposits_amount,$adv_deposits_details,$adv_deposits_date,$adv_deposits_status);

	if ( $insert ) {
		if ( $adv_deposits_amount > 0 ) {
			$update = $db->NoQuery("update advertisers_profiles set adv_profile_deposits=adv_profile_deposits+". $adv_deposits_amount ." where adv_profile_user_id=?","i",$adv_deposits_user_id);
		} else {
			$update = $db->NoQuery("update advertisers_profiles set adv_profile_deposits=adv_profile_deposits". $adv_deposits_amount ." where adv_profile_user_id=?","i",$adv_deposits_user_id);
		}
		echo '<div id="mode">1</div><div id="message">'.$LANG["WBS_ADMIN_GIVE_GET_MONEY_ALLOCATED"].'</div>';
	} else {
		echo '<div id="mode">2</div><div id="message">'.$LANG["WBS_ADMIN_GIVE_GET_MONEY_ERROR"].'</div>';
	}


}


?>