Hello i am trying here to get account id but i cant get it i don’t know where is the problem please help me
<?php
/* load system lib */
require_once( RL_LIBS . 'system.lib.php' );
/* redefine page path */
$page_info['Path'] = $pages['browse'];
$period = empty($_GET['nvar_1']) ? $_GET['period'] : $_GET['nvar_1'];
$type = empty($_GET['type']) ? 'sale_rent' : $_GET['type'];
//$disp_type = empty($_GET['type']) ? 'listings' : $_GET['type'];
$period = empty($period) ? 'new' : $period;
/* redefine page name/title */
$bread_crumbs[1]['name'] = $lang['new_'. $disp_type];
$bread_crumbs[1]['title'] = $lang['new_listings'];
$page_info['name'] = $lang['new_'. $disp_type];
if ( $period == 'today' )
{
$page_info['name'] = $lang['today_'. $disp_type];
$bread_crumbs[] = array(
'name' => $lang['today_listings'],
'title' => $lang['today_'. $disp_type]
);
if ( !empty($_GET['type']) )
{
$bread_crumbs[1]['vars'] .= "type=" . $_GET['type'];
}
}
if ( array_key_exists($type, $l_listing_types) )
{
/* fields for sorting */
$sorting = array(
'category' => array(
'phrase' => $lang['category'],
'field' => 'Kind_ID'
),
'date' => array(
'phrase' => $lang['date'],
'field' => 'Pay_date'
)
);
$rlSmarty -> assign_by_ref( 'sorting', $sorting );
/* define sort field */
$sort_by = empty($_GET['sort_by']) ? $_SESSION['ml_sort_by'] : $_GET['sort_by'];
if ( !empty($sorting[$sort_by]) )
{
$order_field = $sorting[$sort_by]['field'];
}
$_SESSION['ml_sort_by'] = $sort_by;
$rlSmarty -> assign_by_ref( 'sort_by', $sort_by );
/* define sort type */
$sort_type = empty($_GET['sort_type']) ? $_SESSION['ml_sort_type'] : $_GET['sort_type'] ;
$sort_type = in_array( $sort_type, array('asc', 'desc') ) ? $sort_type : false ;
$_SESSION['ml_sort_type'] = $sort_type;
$rlSmarty -> assign_by_ref( 'sort_type', $sort_type );
/* get listings */
$reefless -> loadClass('Listings');
$pInfo['current'] = (int)$_GET['pg'];
if ( $pInfo['current'] > 1 )
{
$bc_page = str_replace('{page}', $pInfo['current'], $lang['title_page_part']);
/* add bread crumbs item */
$bread_crumbs[1]['title'] .= $bc_page;
}
$listings = $rlListings -> getListingsByAccount($account_id, $order_field, $sort_type, $pInfo['current'], $config['listings_per_page']);
$rlSmarty -> assign_by_ref('listings', $listings);
/* get current account */
$account_info = $rlAccount -> getAccountInfo( $_SESSION['id'] );
$rlSmarty -> assign_by_ref( 'aInfo', $account_info );
/* get dealer accounts */
if ($config['mod_rewrite'])
{
$var = $_GET['nvar_1'];
preg_match( '/(.*)-d([0-9]+)/', $var, $id );
$dealer_id = (int)$id[2];
}
else
{
$dealer_id = (int)$_GET['id'];
}
$dealer_id = $listings['Account_ID'];
$dealer = $rlAccount -> getDealerInfo($dealer_id);
$rlSmarty -> assign_by_ref('dealer', $dealer);
/* get seller information */
/*$start = $start > 1 ? ($start - 1) * $limit : 0;
$seller_id = $listings[$start]['Account_ID'];
$seller_info = $rlAccount -> getProfileInfo( $seller_id );
$rlSmarty -> assign_by_ref( 'seller_info', $seller_info );*/
if ( $seller_info['Account_type'] == 'dealer' )
{
$dealer_path = (!empty($seller_info['First_name']) || !empty($seller_info['Last_name'])) ? $seller_info['First_name'].' '.$seller_info['Last_name'] : $seller_info['Username'];
$dealer_path = $rlSmarty -> str2path($dealer_path) . '-d' . $seller_info['ID'];
$rlSmarty -> assign_by_ref( 'dealer_path', $dealer_path );
$sql = "SELECT COUNT(`T1`.`ID`) AS `count` FROM `" . RL_DBPREFIX . "listings` AS `T1` ";
$sql .= "LEFT JOIN `" . RL_DBPREFIX . "categories` AS `T2` ON `T1`.`Kind_ID` = `T2`.`ID` ";
$sql .= "LEFT JOIN `" . RL_DBPREFIX . "listing_plans` AS `T3` ON `T1`.`Plan_ID` = `T3`.`ID` ";
$sql .= "WHERE `T1`.`Account_ID` = '{$seller_info['ID']}' AND `T1`.`Status` = 'active' AND `T2`.`Type` <> 'advertising'";
$sql .= "AND UNIX_TIMESTAMP(DATE_ADD(`T1`.`Pay_date`, INTERVAL `T3`.`Days` DAY)) > UNIX_TIMESTAMP(NOW()) ";
$listing_count = $rlDb -> getRow($sql);
$seller_info['listings'] = $listing_count['count'];
}
/* get additional account fields */
$additional = $rlAccount -> getAdditional( $seller_id );
$additional['ID'] = $seller_id;
$additional_fields = $rlAccount -> getAccountFields( $seller_info['Type_ID'], 'display', $additional);
$rlSmarty -> assign_by_ref( 'additional_fields', $additional_fields );
$reefless -> loadClass( 'Message' );
if ( !empty($listings) )
{
/* build rss */
/*$rss['item'] = 'listings';
if ($type != 'sale_rent')
$rss['type'] = $type;
if ($period != 'new')
$rss['period'] = $period;
$rss['title'] = $category['name'];
$rlSmarty -> assign_by_ref( 'rss', $rss );
/* enable print page */
/*$print['item'] = 'listings';
if ($type != 'sale_rent')
$print['type'] = $type;
if ($period != 'new')
$print['period'] = $period;
$rlSmarty -> assign_by_ref('print', $print);*/
}
$pInfo['calc'] = $rlListings -> calc;
$rlSmarty -> assign_by_ref( 'pInfo', $pInfo );
/* register ajax methods */
$rlXajax -> registerFunction( array( 'addToFavorite', $rlListings, 'ajaxAddToFavorite' ) );
if ( defined('IS_LOGIN') )
{
$rlXajax -> registerFunction( array( 'restoreFavorite', $rlListings, 'ajaxRestoreFavorite' ) );
}
$rlHook -> load('listingsBottom');
}
else
{
$sError = true;
}