<?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';

///////////////////////////////////
//Validation of ad ID
//////////////////////////////////

if(!empty($_GET['id_ad']))
$id_ad = (int) $_GET['id_ad']; 	

else redirect('index.php');

///////////////////////////////////
//Validation of email
//////////////////////////////////

if(!empty($_GET['email']))
$email = $_GET['email']; 	

else redirect('index.php');

///////////////////////////////////
//Ad confirmation
//////////////////////////////////

if(confirm_ad($id_ad, $email))
$text = $language['confirmation_ad_msg1'];

else $text = $language['confirmation_ad_msg2'];

///////////////////////////////////
//Send the notification email
//////////////////////////////////

if($param_gen['notif'] == 1)
{
	$nb_ad = count_ad_mail();

	if($nb_ad == 1)
	send_notif_ad();
}

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

$index = 0;
$account = 0;

///////////////////////////////////
//Title and Meta 
//////////////////////////////////

$title = $language['title_confirmation_ad'];
$description = $language['description_confirmation_ad'];
$words = $language['keywords_confirmation_ad'];
$info_page = $language['info_confirmation_ad'];

///////////////////////////////////
//Display view
//////////////////////////////////

pool::execute('beforestart');

$view = array();
$view[] = 'template/tpl_txt.php';

require_once __DIR__.'/template/tpl_layout.php';