<?php
/**
 * @package		Ad Platform
 * @author		Uta Marian - Alexandru ( -uMarian- )
 * @license		http://codecanyon.net/licenses
 * @link		http://www.uta-marian.com
 * @version		Version 1.0
 */

require_once(dirname(__FILE__).'/../../config.php');
require_once(DIR_SYSTEM.'/users/session.user.php');

//** CHECK IF ADVERTISER IS ON or OFF **//
if ( ADVERTISER != 'ON' ) { header ( 'Location: '.HTTP_SERVER_WEBSITE.'dashboard' ); exit; }
//** END CHECK **//

$USER_ID	=	$_SESSION[USER_SESSION]['0']['user_id'];
$ID			=	$prepare->sanitize($_GET['id'],'input');

$view->countries = $db->Query("SELECT `country_id`, `country_name` FROM countries");
$view->campaigns = $db->Query("SELECT `adv_campaign_id`, `adv_campaign_user_id`, `adv_campaign_title`, `adv_campaign_daily_budget`, `adv_campaign_status` FROM advertisers_campaigns where adv_campaign_user_id=?","i",$USER_ID);




$view->ad	=	$ad = $db->Query("SELECT `aau_id`, `aau_campaign`, `aau_user_id`, `aau_type`, `aau_size`, `aau_target_device`, `aau_target_country`, `aau_language_id`, `aau_adult`, `aau_title`, `aau_summary`, `aau_summary_2`, `aau_url`, `aau_target_url`, `aau_file`, `aau_status` FROM advertisers_ad_units where aau_user_id=? and aau_id=?","ii",$USER_ID,$ID);

if ( empty( $ad ) && !empty( $ID ) ) { 
	header ( 'Location: '.HTTP_SERVER_WEBSITE.'dashboard/advertiser/campaigns' ); exit;
}







/* set page title */
$view->title = $LANG["WBS_DB_NEW_ADV_AD"];
$view->description = $LANG["WBS_DB_NEW_ADV_AD"];
$view->keywords = $LANG["WBS_DB_NEW_ADV_AD"];

//**DEFINE CUSTOM CSS/JS FILLES**//
$view->customCode = '<link href="'.HTTP_SERVER_WEBSITE.'templates/'.WEBSITE_TEMPLATE.'/assets/css/dashboard.css" rel="stylesheet">';

$view->advertiser_menu = 'on';
$view->header = $view->render(DIR_TEMPLATE.WEBSITE_TEMPLATE.'/header.php');
$view->footer = $view->render(DIR_TEMPLATE.WEBSITE_TEMPLATE.'/footer.php');

echo $view->render(DIR_TEMPLATE.WEBSITE_TEMPLATE.'/plugins/advertiser/ad.php');
?>