<?php
///////////////////////////////////////////////////////////////////////////////////////////
///Script PHP/MYSQL of management of classifieds ads developed by Script PAG
///Script PAG all rights reserved. Use under license. http://www.script-pag.com
///////////////////////////////////////////////////////////////////////////////////////////

############################################################

require_once __DIR__.'/includes/all_fns.php';
require_once __DIR__.'/includes/calendar/fns_calendar.php';
require_once __DIR__.'/includes/functions/uploader/uploadManager.php';

///////////////////////////////////
//Check if deposit is not disable
//////////////////////////////////

if($param_gen['disable_deposit'] == 1)
redirect('index.php');

///////////////////////////////////
//Check state of accounts
//////////////////////////////////
	
if(($param_gen['active_acc'] == 2 || $param_gen['active_acc'] == 4 || $param_gen['active_acc'] == 5) && !isset($_SESSION['connect_id']))	
redirect('acc_connexion.php');

///////////////////////////////////
//Get all page slug language
//////////////////////////////////

$lang_slug = get_page_slugs('router_slug_deposit');

///////////////////////////////////
//Get connected account info
//////////////////////////////////

$pack = 0;
$display = 0;

if(isset($_SESSION['connect_id']) && (!isset($_GET['action']) || $_GET['action'] != 'SuccesDeposit'))
{	
	//Check that the personal information is full
	
	if(empty($member['address']))
	redirect('acc_data.php');
	
	//Check if there are packs and if the member has a valid pack
	
	$id_acc = (int) $member['id_acc'];
	$pack = (int) $member['pack'];
	$type_acc = (int) $member['type'];
	$nb_ads = ($member['limit_2'] > 0) ? (int) $member['nb_ads'] : 1;
	$display = 0;
	
	foreach($cache_packs_acc as $v)
	{
		if(!empty($v['id_pack_acc']) && $v['type'] == $type_acc)
		$display = 1;
	}
	
	if($display == 1 && (empty($pack) || $nb_ads == 0))
	redirect('purchase_pack_acc.php?id_acc='. $id_acc .'&type='. $type_acc);
}

///////////////////////////////////
//Validation of the region
//////////////////////////////////

if(!empty($_POST['reg']))
$reg = (int) $_POST['reg'];

elseif(isset($_SESSION['ad_reg']) && !isset($_POST['name']))
$reg = (int) $_SESSION['ad_reg'];

elseif(isset($_SESSION['connect_id']) && !empty($member['id_reg']))
$reg = (int) $member['id_reg'];
	
else $reg = 0;

///////////////////////////////////
//Validation of the county
//////////////////////////////////

if(!empty($_POST['county']))
$county = (int) $_POST['county'];

elseif(isset($_SESSION['ad_county']) && !isset($_POST['name']))
$county = (int) $_SESSION['ad_county'];

elseif(isset($_SESSION['connect_id']) && !empty($member['id_county']))
$county = (int) $member['id_county'];
	
else $county = 0;

///////////////////////////////////
//Validation of the category
//////////////////////////////////

if(!empty($_POST['cat']))
$cat = (int) $_POST['cat'];

elseif(isset($_SESSION['connect_id']) && !empty($member['id_cat']))
$cat = (int) $member['id_cat'];
	
else $cat = 0;

///////////////////////////////////
//Get info member
//////////////////////////////////

if(isset($_SESSION['connect_id']))
{
	$pack = 0;
	
	if(is_array($member))
	{
		$m_id_acc = (int) $member['id_acc'];
		$m_id_cat = (int) $member['id_cat'];
		$m_comp_name = stripslashes(htmlspecialchars($member['comp_name']));
		$m_comp_num = stripslashes(htmlspecialchars($member['comp_num']));
		$m_first_name = stripslashes(htmlspecialchars($member['first_name']));
		$m_address = stripslashes(htmlspecialchars($member['address']));
		$m_postcode = stripslashes(htmlspecialchars($member['postcode']));
		$m_city = stripslashes(htmlspecialchars($member['city']));
		$m_phone = stripslashes(htmlspecialchars($member['phone']));
		$m_email = stripslashes(htmlspecialchars($member['email']));
		$m_type = stripslashes(htmlspecialchars($member['type']));
		$m_name = $m_type == 1 ? ($member['pseudo_display'] == 1 ? $member['pseudo'] : stripslashes(htmlspecialchars($member['name']))) : $m_comp_name;
		$pack = (int) $member['pack'];
	}
}

///////////////////////////////////
//Check sessions
//////////////////////////////////

if(count($_POST) <= 0)
{
 	if(isset($_SESSION['cal_period']))
 	unset($_SESSION['cal_period']);
}
	
///////////////////////////////////
//Get Gtc and Politic Links
//////////////////////////////////

$url_gtc = isset($cache_pages[3]['name_page_'. $_SESSION['code_lang']]) ? rewriting($cache_pages[3]['name_page_'. $_SESSION['code_lang']]) : '';
$id_url_gtc = isset($cache_pages[3]['id_page']) ? $cache_pages[3]['id_page'] : '';
$url_politic = isset($cache_pages[5]['name_page_'. $_SESSION['code_lang']]) ? rewriting($cache_pages[5]['name_page_'. $_SESSION['code_lang']]) : '';
$id_url_url_politic = isset($cache_pages[5]['id_page']) ? $cache_pages[5]['id_page'] : '';

$link_gtc = isset($cache_pages[3]['name_page_'. $_SESSION['code_lang']]) ? '<a href="'. URL_DISPLAY .'/'. $language['router_slug_page'] .'/'. $url_gtc .'-'. $id_url_gtc .'" class="first-color bold" target="_blank">'. $cache_pages[3]['name_page_'. $_SESSION['code_lang']] .'</a>' : '';
$link_politic = isset($cache_pages[5]['name_page_'. $_SESSION['code_lang']]) ? '<a href="'. URL_DISPLAY .'/'. $language['router_slug_page'] .'/'. $url_politic .'-'. $id_url_url_politic .'" class="first-color bold" target="_blank">'. $cache_pages[5]['name_page_'. $_SESSION['code_lang']] .'</a>' : '';

///////////////////////////////////
//Check if there is a discount code
//////////////////////////////////
	
$display_discount_code = 0;
		
foreach($cache_discount_code as $v)
{
	if($v['val1'] == 1)
	{
		$display_discount_code = 1;
	}
}

///////////////////////////////////
//Initializing variable $error
//////////////////////////////////

$error = array();
$images = array();
$files = array();
	
///////////////////////////////////
//Validation of data
//////////////////////////////////

if(isset($_POST['name']))
{
	if(empty($_POST['reg']))
	$error['reg'] = 1;
	
	if(isset($_POST['county']) && empty($_POST['county']))
	$error['county'] = 1;
	
	if(empty($_POST['cat']))
	$error['cat'] = 1;
	
	if($cat != 0)
	{
		foreach($cache_search_digital as $row)
		{
			$id_cat = (int) $row['id_cat'];
			$id_cat_opt_digital = (int) $row['id_cat_opt'];
			$optional = 0;
			
			foreach($cache_cat_opts as $opt)
			{
				$id_cat_opt = (int) $opt['id_cat_opt'];
				$type_cat_opt = (int) $opt['type_cat_opt'];
				
				if($type_cat_opt != 1)
				continue;
				
				if($id_cat_opt_digital == $id_cat_opt)
				{
					$optional = (int) $opt['optional'];
					break;
				}
			}
		 
			if($optional == 0 && $id_cat == $cat)
			{
				if(empty($_POST['digital_'. $id_cat_opt_digital]) || !is_numeric($_POST['digital_'. $id_cat_opt_digital]))
				$error['digital_'. $id_cat_opt_digital] = 1;
			}
			elseif(!empty($_POST['digital_'. $id_cat_opt_digital]) && !is_numeric($_POST['digital_'. $id_cat_opt_digital]))
			$error['digital_'. $id_cat_opt_digital] = 1;
		}
	}

	if($cat != 0)
	{
		foreach($cache_val_data as $row)
		{
			$id_cat_opt_data = (int) $row['id_cat_opt'];
			$optional = 0;
			
			foreach($cache_cat_opts as $opt)
			{
				$id_cat_opt = (int) $opt['id_cat_opt'];
				$type_cat_opt = (int) $opt['type_cat_opt'];
				
				if($type_cat_opt != 2)
				continue;
				
				if($id_cat_opt_data == $id_cat_opt)
				{
					$optional = (int) $opt['optional'];
					break;
				}
			}
		 
			if($optional == 0)
			{
				if(isset($_POST['data_'. $id_cat_opt_data]) && empty($_POST['data_'. $id_cat_opt_data]))
				$error['data_'. $id_cat_opt_data] = 1;
			}
		}
	}
	
	foreach($cache_fields as $row)
	{
		$id_field = (int) $row['id_field'];
		$id_cat = (int) $row['id_cat'];
		$type = (int) $row['type'];
		$optional = $row['optional'];
		
		if($optional == 1)
		{
			if($type == 1 && empty($_POST['field_'. $id_field]) && ($id_cat == 0 || $id_cat == $cat))
			$error['field_'. $id_field] = 1;
			
			elseif($type == 2 && (empty($_POST['field_'. $id_field]) || preg_match("#^[0-9]+$#", $_POST['field_'. $id_field]) != true) && ($id_cat == 0 || $id_cat == $cat))
			$error['field_'. $id_field] = 1;
			
			elseif($type == 3 && (empty($_POST['field_'. $id_field]) || preg_match("#^https?://#", $_POST['field_'. $id_field]) != true) && ($id_cat == 0 || $id_cat == $cat))
			$error['field_'. $id_field] = 1;
		}
		else
		{
			if($type == 2 && !empty($_POST['field_'. $id_field]) && preg_match("#^[0-9]+$#", $_POST['field_'. $id_field]) != true)
			$error['field_'. $id_field] = 1;
			
			elseif($type == 3 && !empty($_POST['field_'. $id_field]) && preg_match("#^https?://#", $_POST['field_'. $id_field]) != true)
			$error['field_'. $id_field] = 1;
		}
	}
	
	if($_POST['status'] == 2)
	{
		if(empty($_POST['comp_name']))
		$error['comp_name'] = 1;
		
		if($cache_param_fields['act_comp_num'] == 1)
		{
			if (!isset($_SESSION['connect_id']) && empty($_POST['comp_num']))
			$error['comp_num'] = 1;
		}
	}

	if($cache_param_fields['act_postcode'] == 1)
	{
		if (empty($_POST['postcode']))
		$error['postcode'] = 1;
	}
	
	if($cache_param_fields['act_city'] == 1)
	{
		if (empty($_POST['city']))
		$error['city'] = 1;
	}
	
	if (empty($_POST['name']))
	$error['name'] = 1;
	
	if(!valid_email($_POST['email']))
	$error['email'] = 1;
	
	if(!isset($_SESSION['connect_id']) && check_email($_POST['email']) && $param_gen['active_acc'] != 1)
	$error['email_duplicate'] = 1;
	
	foreach($blacklist as $v)
	{
		if($v == $_POST['email'])
		$error['ban'] = 1;
	}
	
	if($cache_param_fields['act_phone'] == 1)
	{
		if (empty($_POST['phone']))
		$error['phone'] = 1;
	}
	
	if (empty($_POST['title']))
	$error['title'] = 1;
	
	elseif(preg_match('/([0-9#][\x{20E3}])|[\x{00ae}\x{00a9}\x{203C}\x{2047}\x{2048}\x{2049}\x{3030}\x{303D}\x{2139}\x{2122}\x{3297}\x{3299}][\x{FE00}-\x{FEFF}]?|[\x{2190}-\x{21FF}][\x{FE00}-\x{FEFF}]?|[\x{2300}-\x{23FF}][\x{FE00}-\x{FEFF}]?|[\x{2460}-\x{24FF}][\x{FE00}-\x{FEFF}]?|[\x{25A0}-\x{25FF}][\x{FE00}-\x{FEFF}]?|[\x{2600}-\x{27BF}][\x{FE00}-\x{FEFF}]?|[\x{2900}-\x{297F}][\x{FE00}-\x{FEFF}]?|[\x{2B00}-\x{2BF0}][\x{FE00}-\x{FEFF}]?|[\x{1F000}-\x{1F6FF}][\x{FE00}-\x{FEFF}]?/u', $_POST['title']))
	$error['title'] = 2;
	
	if (empty($_POST['text']))
	$error['text'] = 1;
	
	elseif(preg_match('/([0-9#][\x{20E3}])|[\x{00ae}\x{00a9}\x{203C}\x{2047}\x{2048}\x{2049}\x{3030}\x{303D}\x{2139}\x{2122}\x{3297}\x{3299}][\x{FE00}-\x{FEFF}]?|[\x{2190}-\x{21FF}][\x{FE00}-\x{FEFF}]?|[\x{2300}-\x{23FF}][\x{FE00}-\x{FEFF}]?|[\x{2460}-\x{24FF}][\x{FE00}-\x{FEFF}]?|[\x{25A0}-\x{25FF}][\x{FE00}-\x{FEFF}]?|[\x{2600}-\x{27BF}][\x{FE00}-\x{FEFF}]?|[\x{2900}-\x{297F}][\x{FE00}-\x{FEFF}]?|[\x{2B00}-\x{2BF0}][\x{FE00}-\x{FEFF}]?|[\x{1F000}-\x{1F6FF}][\x{FE00}-\x{FEFF}]?/u', $_POST['text']))
	$error['text'] = 2;
	
	if(!empty($_POST['video']) && !preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $_POST['video']) && !preg_match('%(?:dailymotion\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|video/|.*[?&]v=)|dai\.ly/)([^"&?/ ]*)%i', $_POST['video'], $matches) && !preg_match('%(?:vimeo\.com/(?:[^/]+/.+/|(?:video/)?|.*[?&]v=))([^"&?/ ]*)%i', $_POST['video'], $matches) && !preg_match("%(?:yahoo\.com/video/)%i", $_POST['video']))
	$error['video'] = 1;
	
	if($cache_param_fields['act_price'] == 1)
	{
		if(!empty($_POST['price']) && (preg_match("#^[0-9]+?[,.]?([0-9]+)?$#", $_POST['price']) != true))
		$error['price'] = 1;
	}
	
	if(isset($_POST['pas']))
	{
		if(!empty($_POST['pas']) && preg_match('#^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).{8,}#', $_POST['pas']) == false)
		$error['str_pas'] = 1;
		
		if(empty($_POST['pas']) OR $_POST['pas'] != $_POST['pas2'])
		$error['pas'] = 1;
	}
	
	if(!empty($_POST['discount_code']))
	{
		$error_code = 0;
		$code = htmlspecialchars($_POST['discount_code']);
		
		foreach($cache_discount_code as $v)
		{
			if($v['code'] == $code && $v['val1'] == 1)
			{
				$error_code = 1;
			}
		}
		
		if($error_code == 0)
		$error['code'] = 1;
	}
	
	if($param_api_gg['activ_gg_map'] == 1 && (empty($_POST['lat']) || empty($_POST['lng'])) && is_allowed_cookie('googlemap'))
	$error['geolocation'] = 1;
	
	if(!isset($_POST['gtc']))
	$error['gtc'] = 1;
	
	if(strlen($blacklist_keywords['keywords']) > 0)
	{
		$keywords = explode(',', str_replace(' ', '', $blacklist_keywords['keywords']));
	
		foreach($keywords as $v) {
			if(preg_match('#^'. rewriting($v) .' #', str_replace('-', ' ', rewriting($_POST['text']))) || preg_match('# '. rewriting($v) .'$#', str_replace('-', ' ', rewriting($_POST['text']))) || preg_match('# '. rewriting($v) .' #', str_replace('-', ' ', rewriting($_POST['text']))))
			$error['keywords'] = 1;
		}
	}
	
	$errors_module = pool::execute('validFormAd', $error);
	if(is_array($errors_module) && !empty(array_filter($errors_module))) $error['module'] = $errors_module;
	
	if(isset($_POST['photo']) || isset($_POST['remove_photo'])) {
		$images = isset($_POST['photo']) ? $_POST['photo'] : array();
		$new_images = array();
		foreach($images as $key => $img) $new_images[$key] = is_array($img) ? $img : str_replace('/upload/photos/', '', $img);
		$images = $new_images;	
	}
	if(isset($_POST['file']) || isset($_POST['remove_file'])) {
		$files = isset($_POST['file']) ? $_POST['file'] : array();
		$new_files = array();
		$keys = array();
		foreach($files as $key => $file) $new_files[$key] = is_array($file) ? $file : str_replace('/upload/files/', '', $file);
		$files = $new_files;

	}
}

///////////////////////////////////
//Variables of elements
//////////////////////////////////

$index = 0;
$account = 0;

///////////////////////////////////
//Registration of the ad
//////////////////////////////////

if(isset($_POST['name']) && empty($error))
{
	$price = 0;
	$pack_photo = 0;
	
	if($cache_global_pay['valid'] == 1)
	{
		//Price of the photo pack
		
		$price_photo = 0;
		
		if(!empty($_POST['photo']))
		{
			if(sizeof($_POST['photo']) > $cache_photo_opt['nb_photo_free'])
			{
				$price_photo = $cache_photo_opt['price_pack'];
				$pack_photo = 1;
			}
			
		}
		
		//Price of the ad
		
		$price_ad = 0;
		
		if($pack == 0)
		{
			foreach($cache_cat as $v)
			{
				if($v['id_cat'] == $cat)
				{
					if($_POST['status'] == 1)
					$price_ad = (float) $v['price_par'];
					
					else $price_ad = (float) $v['price_pro'];
				}
			}
		}
		
		//Price of the vidéo
		
		$price_video = 0;
		
		if(!empty($_POST['video']))
		$price_video = (float) $cache_video_opt['price_video'];
		
		//Price of options
		
		$price_options = 0;
		
		if(!empty($_POST['opt_type1']))
		{
			foreach($cache_visual_opts as $v)
			{
				if($v['id_visual_opt'] == $_POST['opt_type1'])
				$price_options = (float) $v['price'];
			}
		}
		
		if(!empty($_POST['opt_type2']))
		{
			foreach($cache_visual_opts as $v)
			{
				if($v['id_visual_opt'] == $_POST['opt_type2'])
				$price_options = (float) $v['price'] + $price_options;
			}
		}
		
		if(!empty($_POST['opt_type3']))
		{
			foreach($cache_visual_opts as $v)
			{
				if($v['id_visual_opt'] == $_POST['opt_type3'])
				$price_options = (float) $v['price'] + $price_options;
			}
		}
		
		if(!empty($_POST['opt_type4']))
		{
			foreach($cache_visual_opts as $v)
			{
				if($v['id_visual_opt'] == $_POST['opt_type4'])
				$price_options = (float) $v['price'] + $price_options;
			}
		}
		
		//Total price
		
		$price = $price_photo + $price_ad + $price_options + $price_video;
	}
	
	//Discount
	
	if(!empty($_POST['discount_code']))
	{
		$code = htmlspecialchars($_POST['discount_code']);
		
		$price_code = '';
		$type_code = '';
		
		foreach($cache_discount_code as $v)
		{
			if($v['code'] == $code)
			{
				$price_code = (float) $v['price'];
				$type_code = (int) $v['type'];
			}
		}
		
		if($type_code == 1)
		$price = $price - $price_code;
		
		else
		{
			$price_red = $price * $price_code / 100;
			$price = $price - $price_red;
		}
		
		$str_type_code = ($type_code == 1) ? $param_gen['currency'] : '%';
		
		$_SESSION['discount_code'] = '-'. $price_code .' '. $str_type_code;
	}
	else $_SESSION['discount_code'] = '';
	
	//State of the ad
	
	if($price > 0)
	$state = 5;
	
	elseif($param_gen['auto_ads'] == 1)
	$state = 2;
	
	elseif(isset($_SESSION['connect_id']) || $param_gen['not_confirm_ads'] == 1)
	$state = 1;
	
	else $state = 0;
	
	//Password of the ad
	
	if(isset($_POST['pas']))
	$password = $_POST['pas'];

	else $password = generate_password();
	
	//Registration of the ad
	
	if(empty($error) && (isset($_POST['photo']) || isset($_POST['remove_photo']))) {
		if(isset($_POST['photo']) && !empty($_POST['photo'])) {
			$upload = new uploadManager();
			$images = $upload->moveFile(array('move_file' => $_POST['photo'], 'context' => 'ad_photo'));
		}
		if(isset($_POST['remove_photo']) && !empty($_POST['remove_photo'])) {
			@unlink(__DIR__.'/..'.str_replace(URL, '', $_POST['remove_photo']));
		}
		$new_images = array();
		foreach($images as $img) {
			if(strpos($img, '/upload/photos/') > -1) $new_images[] = str_replace('/upload/photos/', '', $img);
			else continue;
		}
		$images = $new_images;
	}
	
	if(empty($error) && (isset($_POST['file']) || isset($_POST['remove_file']))) {
		$files = isset($_POST['file']) ? $_POST['file'] : array();
		if(isset($_POST['file']) && !empty($_POST['file'])) {
			$upload = new uploadManager();
			$files = $upload->moveFile(array('move_file' => $_POST['file'], 'context' => 'ad_file'));
		}
		if(isset($_POST['remove_file']) && !empty($_POST['remove_file'])) {
			@unlink(__DIR__.'/..'.str_replace(URL, '', $_POST['remove_file']));
		}
		$new_files = array();
		foreach($files as $file) $new_files[] = str_replace('/upload/files/', '', $file);
		$files = $new_files;
	}
	
	$id_ad = register_ad($_POST, $password, $state, $pack_photo, $images, $files, $price);
	
	if(isset($_POST['address']))
	$_SESSION['ad_address'] = $_POST['address'];
	
	//Redirection vers la page de paiement ou de confirmation
	
	if($price > 0)
	{
		//Destroying the calendar session
		
		if(isset($_SESSION['cal_period']))
		unset($_SESSION['cal_period']);
		
		$_SESSION['item'] = $language['ad_page_payment'] .'<br />';
		
		if($param_invoice['excl_vat'] == 1)
		$price_vat = (!empty($param_invoice['vat_rate'])) ? $price * $param_invoice['vat_rate'] / 100 : 0;
		
		else
		{
			$price_vat = $price / (1 + ($param_invoice['vat_rate'] / 100));
			$price_vat = $price - round($price_vat, 2);
			
			$price =  $price - $price_vat;
		}
		
		$_SESSION['price'] = $price;
		$_SESSION['price_vat'] = $price_vat;
		
		$id_pursh = register_purchase(1, $id_ad, 0, 0, 0, 0, 0, 0, time(), $price, $price_vat);
		$conn = null;
		
		$_SESSION['id_purch'] = $id_pursh;
		
		redirect('payment.php');
	}
	else
	{
		//Registration of sessions
		
		$_SESSION['ad_reg'] = $_POST['reg'];
		
		if(isset($_POST['county']))
		$_SESSION['ad_county'] = $_POST['county'];
		
		if($_POST['status'] == 2)
		{
			$_SESSION['ad_status'] = $_POST['status'];
			$_SESSION['ad_comp_name'] = $_POST['comp_name'];
			
			if(isset($_POST['comp_num']))
			$_SESSION['ad_comp_num'] = $_POST['comp_num'];
		}
		
		if(isset($_POST['postcode']))
		$_SESSION['ad_postcode'] = $_POST['postcode'];
		
		if(isset($_POST['city']))
		$_SESSION['ad_city'] = $_POST['city'];
		
		$_SESSION['ad_name'] = $_POST['name'];
		$_SESSION['ad_email'] = $_POST['email'];
		
		if(isset($_POST['phone']))
		$_SESSION['ad_phone'] = $_POST['phone'];
		
		if(!empty($_POST['phone_hidden']))
		$_SESSION['ad_phone_hidden'] = $_POST['phone_hidden'];
		
		//Destroying the calendar session
		
		if(isset($_SESSION['cal_period']))
		unset($_SESSION['cal_period']);
		
		//Envoi du mail de notification

		if($param_gen['notif'] == 1 && $state == 1)
		{
			$nb_ads = count_ad_mail();

			if($nb_ads == 1)
			send_notif_ad();
		}
		
		//Check action deposit
		
		if($param_gen['auto_ads'] == 1)
			get_nb_ads();
	
		elseif(!isset($_SESSION['connect_id']) && $param_gen['not_confirm_ads'] == 0)
			send_confirm($id_ad, $_POST, $_SESSION['code_lang']);
		
		$conn = null;
		
		redirect('ad_deposit.php?action=SuccesDeposit');
	}
}

///////////////////////////////////
//Deposit confirmation
//////////////////////////////////

elseif(isset($_GET['action']) && $_GET['action'] == 'SuccesDeposit')
{
	//Title and Meta
		
	$title = $language['title_deposit_conf'];
	$description = $language['description_deposit_conf'];
	$words = $language['keywords_deposit_conf'];
	$info_page = $language['info_page_deposit_conf'];
	$text = $param_gen['auto_ads'] == 1 ? $language['txt_info_page_conf2'] : (isset($_SESSION['connect_id']) || $param_gen['not_confirm_ads'] == 1 ? $language['account_ad_page_conf'] : $language['txt_info_page_conf1']);

	///////////////////////////////////
	//Display view
	//////////////////////////////////
	
	pool::execute('beforestart');
	
	$view = array();
	$view[] = 'template/tpl_txt.php';
	
	require_once __DIR__.'/template/tpl_layout.php';
}
else
{
	///////////////////////////////////
	//Title and Meta
	//////////////////////////////////
	
	$title = $language['title_deposit_form'];
	$description = $language['description_deposit_form'];
	$words = $language['keywords_deposit_form'];
	$info_page = $language['info_page_deposit_form'];
		
	///////////////////////////////////
	//Display view
	//////////////////////////////////
	
	pool::execute('beforestart');
	
	$view = array();
	$view[] = 'template/tpl_form_deposit.php';
	
	require_once __DIR__.'/template/tpl_layout.php';
}