<?
include_once 'сюда абсолютный путь к корню сайта/engine/config.php'; /// подключение к бд

	$bonus_temp = mysql_query( "SELECT * FROM user WHERE paid >= '".$config['refBonusPay']."' AND serf_view >= '".$config['refBonusLink']."' AND tasks_view >= '".$config['refBonusTask']."' AND refbonusend = '0' " );
	if ( mysql_num_rows( $bonus_temp ) > 0 ) {
		while ( $bonus_temp_row = mysql_fetch_array( $bonus_temp ) ) {
			
			mysql_query( "UPDATE user SET money = money + '".$config['refBonusPrice']."' WHERE id = '".$bonus_temp_row['referer']."' and activate = '1'" );	
			mysql_query( "UPDATE user SET refbonusend = '1' WHERE id = '".$bonus_temp_row['id']."'" );	
				
		}
	}

?>