<?php
include("inc.top.php");
$q2 = new CDb();
$ord='';
$search='';

$t->set_file("content","member.area.customban.html");
$t->set_file("menu","member.area.view_customban.html");
$t->set_file("emailrow","member.area.customban_row.html");

get_logged_info();
$member_id=$q->f("id");

if ($_GET['search_name'] != '') $search = " AND ban_word LIKE '%".$_GET['search_name']."%'";
if ($_GET['ban_word'] == 'up') $ord=' ORDER BY ban_word ASC';
if ($_GET['ban_word'] == 'down') $ord=' ORDER BY ban_word DESC';
if ($_GET['campaign'] == 'up') $ord=' ORDER BY campaign_id ASC';
if ($_GET['campaign'] == 'down') $ord=' ORDER BY campaign_id DESC';
if ($ord == '') $ord = ' ORDER BY campaign_id DESC';
$t->parse("email_content","menu",true);
$query = " SELECT custom_ban.id AS id,campaigns.name as nume_camp,ban_word,campaign_id,ban FROM custom_ban,campaigns WHERE campaigns.id=campaign_id ".$member_.$search.$ord;

$q->query($query);
while ($q->next_record()) {
	$t->set_var("ban_word",$q->f("ban_word"));
	
	$campaign = "<select name='campaign_id_".$q->f('id')."'>";
	
	$q2->query("SELECT id,name FROM campaigns");
	while($q2->next_record()){
		$campaign .= "<option value='".$q2->f('id')."' ".($q->f('campaign_id') == $q2->f('id') ? 'selected' : '').">".$q2->f('name')."</option>";
	}
	$campaign .= "</select>";
	$t->set_var("campaign",$campaign);
	$t->set_var("ban","<input type='checkbox' value=1 name='ban_".$q->f('id')."' ".($q->f('ban') ? "checked" : "").">");
	$t->set_var("id",$q->f("id"));
	
	$t->parse("email_ban_row","emailrow",true);
}

$t->set_file("menu_html", "member.area.menu.html");

$t->parse("menu", "menu_html");
		FFileRead("config/version",$version);
		$t->set_var("ver", $version);
$t->pparse("out", "content");	
		
//include("inc.bottom.php");
?>