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

///////////////////////////////////
//Check if the member or PRO is logged in
//////////////////////////////////

if(!isset($_SESSION['connect_id']))
redirect('acc_connexion.php');

///////////////////////////////////
//Variables of search engine
//////////////////////////////////

$type_search = 6;
$listing_search = 4;
$count_adv = 0;
$is_acc_search = true;
$page_number = isset($_GET['page']) && $_GET['page'] <= 0 ? 1 : (isset($_GET['page']) ? (int) $_GET['page'] : 1);

///////////////////////////////////
//Get number of search
//////////////////////////////////

$_SESSION['nb_acc_search'] = get_acc_search_count($_SESSION['connect_id']);
$total = $_SESSION['nb_acc_search'];

///////////////////////////////////
//Get number of search
//////////////////////////////////

$_SESSION['nb_acc_search'] = get_acc_search_count($_SESSION['connect_id']);
$total = $_SESSION['nb_acc_search'];

$limit_page = 0;
$start_ads = 1;
$end_ads = $total;

if($_SESSION['nb_acc_search'] > 0) {
	$search_array = get_acc_searches($_SESSION['connect_id']);
} else {
	$search_array = array();
	$text = $language['page_no_acc_search'];
}

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

$account = 0;
$index = 0;

///////////////////////////////////
//Title and meta 
//////////////////////////////////

$title = $language['title_page_acc_search'];
$description = $language['description_page_acc_search'];
$words = $language['keywords_page_acc_search'];
$title_listing_infos = $language['info_page_acc_search'];

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

pool::execute('beforestart');

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

if(!isset($_POST['is_ajax'])) require_once __DIR__.'/template/tpl_layout.php';
else require_once __DIR__.'/template/tpl_acc_search.php';