Location: PHPKode > projects > Ads Exchange Server > estigi_0.1.1_RC2/countries.php
<?php

/***************************************************************************
 *                             countries.php
 *                            -------------------
 *   begin                : lun, dec 31, 2007
 *   copyright            : (C)
 *   email                : hide@address.com
 *   Desc                 : Get a list of all the countries, and if they are in the current list will let you know
 *
 *
 ***************************************************************************/


define('IN_ADSERVER', true);

include_once("./inc/common.inc.php");

//Restricted Access
get_User_Settings($session['id_User'], "restrict_Countries", $web_address);

if(!isset($_GET['id_Ad'])){
	refrescar($web_address, 0, 1);
}

// Declare the TPL
$countries_Tpl = new tpl($s_path_Tpl . "/countries.tpl");

//Get his countries settings
$q = "
	SELECT countries
	FROM ads_ads
	WHERE id_Ads = ".$_GET['id_Ad']."
	AND id_User = ".$session['id_User']."
	";

$q_Get_Countries = mysql_query($q) or die("Unable to Get countries: " . mysql_error());

/*
if(mysql_num_rows($q_Get_Countries) == 0){
	refrescar($web_address, 0, 1);
}
*/

$row = mysql_fetch_array($q_Get_Countries, MYSQL_ASSOC);
	$countries = $row['countries'];

//Get all countries
$q = "
	SELECT *
	FROM  ".$db_Pre."countries
	ORDER BY country
	";

$q_Get_Countries = mysql_query($q) or die("Unable to Get countries: " . mysql_error());

while($row = mysql_fetch_array($q_Get_Countries, MYSQL_ASSOC)){

	$countries_Values[] = array(
		$row['ctry'],
		$row['country'],
		(strpos($countries, $row['ctry']) !== FALSE ? $_lang['COUNTRIES_YES'] : "-")
	);

}

$countries_Keys = array("{COUNTRIES_CTRY}", "{COUNTRIES_NAME}", "{COUNTRIES_SELECTED}");

$countries_Tpl->rBlock_Several($countries_Keys, $countries_Values, "COUNTRIES");

$countries_Array = array(
	"{COUNTRIES_TYPE_V}" => (strpos($countries, "0:") !== FALSE ? $_lang['COUNTRIES_TYPE_REST'] : $_lang['COUNTRIES_TYPE_ALLOW'])
);

include_once("./header.inc.php");
$countries_Tpl->parse_Tpl($countries_Array, "", $_lang);
include_once("./footer.inc.php");

?>
Return current item: Ads Exchange Server