function download_pub_file()
{
$url = check_url($_GET['file']);
$pub_id = $_GET['pub_id'];
$first_last = $_GET['first_last'];
$cookie_name = "pub_".$pub_id;
/**
* Step-3: check if the url is valid or not
*/
if (is_valid_file_url(htmlspecialchars($url)) && $first_last=='ok' && !isset($_COOKIE[$cookie_name])) {
/**
* Step-4: update counter data (only if the URL is valid and file exists)
*/
update_num_of_download($pub_id);
setcookie($cookie_name, "downloaded", time()+9000);
}
/**
* Step-5: redirect to the original URL of the file
*/
header('Location: ' . $url);
exit;
}
function update_num_of_download($pub_id)
{
$sql_query = sprintf("INSERT INTO tbldownloadcount VALUES (%d,1) ON DUPLICATE KEY UPDATE download_times=download_times+1;", $pub_id);
db_pub_query($sql_query);
}
function is_valid_file_url($url)
{
// replace space characters in the URL with '%20' to support file name
// with space characters
$url = preg_replace('/\s/', '%20', $url);
if (!valid_url($url, true)) {
return false;
}
if (!url_exists($url)) {
return false;
}
return true; // it seems that the file URL is valid
}
function url_exists($url)
{
if (@fopen($url,"r")) {
return true;
} else {
return false;
}
}
?>
Multipurpose agroforestry as a climate change resiliency option for farmers: an example of local adaptation in Vietnam
Author
Quan Nguyen, Hoang Minh Ha, Ingrid Oborn and Meine van Noordwijk
Year
2012
Journal Title
Climatic Change
Institution
Springer Science+Business Media B.V.
Pages
1-17
Call Number
JA0452-12
Abstract:
Increasing frequency, intensity and duration of severe weather events are posing
major challenges to global food security and livelihoods of rural people. Agriculture has
evolved through adaptation to local circumstances for thousands of years. Local experience
in responding to severe weather conditions, accumulated over generations and centuries, is
valuable for developing adaptation options to current climate change. This study aimed to:
(i) identify tree species that reduce vulnerability of cropping systems under climate variability;
and (ii) develop a method for rapidly assessing vulnerability and exploring strategies
of smallholder farmers in rural areas exposed to climate variability. Participatory Rural
Appraisal methods in combination with Geographical Information Systems tools and statistical
analysis of meteorological data were used to evaluate local vulnerability to climate
change and to investigate local adaptation measures in two selected villages in Vietnam, one
of the countries most vulnerable to climate change. The low predictability of severe weather
events makes food crops, especially grain production, insecure. This study shows that while
rice and rain-fed crops suffered over 40 % yield losses in years of extreme drought or flood,
tree-based systems and cattle were less affected. 13 tree species performed well under the
harsh local climate conditions in home and forest gardens to provide income, food, feed and
other environmental benefits. Thus, this research suggests that maintenance and enhancement
of locally evolved agroforestry systems, with high resilience and multiple benefits, can
contribute to climate change adaptation.
GRP 5 : Improving the ability of farmers, ecosystems & governments to cope with climate change