<?php
include_once('include/functions.php');
include_once('smarty_survey.php');
include_once('pear/DB.php');
// Define Barangay Name Page
$SMARTY = new Smarty_Survey;
session_start();
is_Logged($_SESSION['login']);
if ($_SESSION['rights'] != 'S'){
header("Location: login.php");
}
if (isset($_REQUEST['brgy_name']) && $_REQUEST['brgy_name']!="") {
$filename = "./include/brgy_name.txt";
$brgy_name = stripslashes($_REQUEST['brgy_name']);
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'w+')) {
$SMARTY->assign("msg", "Cannot open file");
} else {
// Write brgy_name to our opened file.
if (fwrite($handle, addslashes($brgy_name)) === FALSE) {
$SMARTY->assign("msg", "Cannot write to file");
}
$SMARTY->assign("msg", "Barangay ". stripslashes($brgy_name) ." was successfully defined in the system !!!");
fclose($handle);
}
}
$SMARTY->assign("brgy_name", getBrgyName($SMARTY));
$SMARTY->assign("user_rights",$_SESSION['rights']);
$SMARTY->display("brgyname.html");
?>