Exemplo n.º 1
0
 public static function create($username, $password)
 {
     global $db;
     if (citizen::username_exists($username)) {
         return array("status" => "username_exists");
     }
     $db->query("insert into citizen (username,password) values('" . $db->real_escape_string($username) . "', ENCRYPT('" . $db->real_escape_string($password) . "'))");
     return new citizen($db->insert_id);
 }
Exemplo n.º 2
0
    if (trim($_SESSION['icon_set'] == '')) {
        $_SESSION['icon_set'] = 'cobalt';
    }
}
$data_con->close_db();
require 'components/get_listview_referrer.php';
init_var($arr_error);
init_var($first_field);
init_var($goto_region);
init_var($goto_skill);
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_submit']);
    require 'components/query_string_standard.php';
    require 'subclasses/citizen.php';
    $dbh_citizen = new citizen();
    $object_name = 'dbh_citizen';
    require 'components/create_form_data_with_upload.php';
    extract($arr_form_data);
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("main.php");
    }
    $file_upload_control_name = "cf_validate_proof_of_id";
    $mf_upload_counter_name = "validate_count";
    require 'components/upload_generic_mf.php';
    $file_upload_control_name = "cf_validate_proof_of_address";
    $mf_upload_counter_name = "validate_count";
    require 'components/upload_generic_mf.php';
    if ($_POST['btn_submit']) {
        log_action('Pressed submit button');
Exemplo n.º 3
0
//Generated by Cobalt, a rapid application development framework. http://cobalt.jvroig.com
//Cobalt developed by JV Roig (jvroig@jvroig.com)
//****************************************************************************************
require 'path.php';
init_cobalt('Edit citizen');
if (isset($_GET['citizen_id'])) {
    $citizen_id = urldecode($_GET['citizen_id']);
    require 'form_data_citizen.php';
}
debug("HELLO");
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_submit']);
    require 'components/query_string_standard.php';
    require 'subclasses/citizen.php';
    $dbh_citizen = new citizen();
    $object_name = 'dbh_citizen';
    require 'components/create_form_data.php';
    extract($arr_form_data);
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_citizen.php?{$query_string}");
    }
    if ($_POST['btn_submit']) {
        log_action('Pressed submit button');
        $message .= $dbh_citizen->sanitize($arr_form_data)->lst_error;
        extract($arr_form_data);
        if ($dbh_citizen->check_uniqueness_for_editing($arr_form_data)->is_unique) {
            //Good, no duplicate in database
        } else {
            $message = "Record already exists with the same primary identifiers!";
Exemplo n.º 4
0
<?php

$page_title = 'Barangay System';
$stylesheet_link = 'style';
require 'path.php';
init_cobalt();
require 'header1.php';
require 'components/get_listview_referrer.php';
$username = $_SESSION['user'];
require_once 'subclasses/citizen.php';
$dbh_citizen1 = new citizen();
$citizen = $dbh_citizen1->execute_query("SELECT city FROM citizen WHERE username='******'")->result;
extract($citizen->fetch_assoc());
$city_citizen = $city;
require_once 'subclasses/school.php';
$dbh_school = new school();
$dbh_school->execute_query("SELECT * FROM school WHERE city = {$city_citizen} && is_evacuation = 'Yes'");
$result1 = $dbh_school->result;
?>
<main>
<div class="block-body">
<div class="fold-2">
	<h3 class="fold-2-head center-obj fold-head">Mga lugar sa Ating Barangay</h3>
	<hr class="hr"/>
<?php 
//echo $city_citizen;
while ($row1 = $result1->fetch_assoc()) {
    extract($row1);
    echo '<li>';
    echo $school_name;
    echo '</li>';
Exemplo n.º 5
0
<?php

if (isset($_POST["username"]) && isset($_POST["password"])) {
    $response = citizen::login($_POST["username"], $_POST["password"], gf::getClientIP());
    if ($response instanceof citizen) {
        $_SESSION["user"] = serialize($response);
        die(json_encode(array("status" => "success", "params" => array("displayname" => $response->displayname, "type" => "citizen"))));
    } elseif ($response["status"] == "username_error") {
        $response = iwatchadmin::login($_POST["username"], $_POST["password"], gf::getClientIP());
        if ($response instanceof iwatchadmin) {
            $_SESSION["user"] = serialize($response);
            die(json_encode(array("status" => "success", "params" => array("displayname" => $response->displayname, "type" => "iwatchadmin"))));
        } elseif ($response["status"] == "username_error") {
            $response = elected::login($_POST["username"], $_POST["password"], gf::getClientIP());
            if ($response instanceof elected) {
                $_SESSION["user"] = serialize($response);
                die(json_encode(array("status" => "success", "params" => array("displayname" => $response->displayname, "type" => "elected"))));
            } else {
                die(json_encode($response));
            }
        } else {
            die(json_encode($response));
        }
    } else {
        die(json_encode($response));
    }
} else {
    die(json_encode(array("status", "parameter_required")));
}
Exemplo n.º 6
0
<?php

if (isset($_POST["username"]) && isset($_POST["password"]) && isset($_POST["email"]) && isset($_POST["tel"])) {
    $new_user = citizen::create($_POST["username"], $_POST["password"]);
    if ($new_user instanceof citizen) {
        $_SESSION["user"] = serialize($new_user);
        die(json_encode(array("status" => "success", "params" => array("displayname" => $new_user->displayname, "type" => "citizen"))));
    } else {
        die(json_encode($new_user));
    }
} else {
    die(json_encode(array("status", "parameter_required")));
}
Exemplo n.º 7
0
<?php

$page_title = 'Barangay System';
$stylesheet_link = 'style';
require 'path.php';
init_cobalt();
require 'header1.php';
require 'components/get_listview_referrer.php';
$username = $_SESSION['user'];
require_once 'subclasses/citizen.php';
$dbh_citizen = new citizen();
$citizen = $dbh_citizen->execute_query("SELECT citizen_id,birth_date,birth_place,weight,height,civil_status FROM citizen WHERE username='******'")->result;
extract($citizen->fetch_assoc());
?>

<main>
<div class="fold-body">
    <h3 class="fold-complain-head">Mag-Request ng Barangay ID</h3>
    <hr class="hr"/>
    <p class="complain-desc">Patunayang ikaw ay isang mamamayan sa ating barangay.</p>

<?php 
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_submit']);
    require 'components/query_string_standard.php';
    require 'subclasses/cedula.php';
    $dbh_cedula = new cedula();
    $object_name = 'dbh_cedula';
    require 'components/create_form_data.php';
    extract($arr_form_data);
Exemplo n.º 8
0
//Generated by Cobalt, a rapid application development framework. http://cobalt.jvroig.com
//Cobalt developed by JV Roig (jvroig@jvroig.com)
//****************************************************************************************
require 'path.php';
init_cobalt('View citizen');
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_submit']);
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_citizen.php");
    }
    if ($_POST['btn_submit']) {
        log_action('Pressed submit button');
        require 'subclasses/citizen.php';
        $dbh_citizen = new citizen();
        if ($message == "") {
            log_action('Exported table data to CSV');
            $timestamp = date('Y-m-d');
            $token = generate_token(0, 'fs');
            $csv_name = $token . $_SESSION['user'] . '_citizen_' . $timestamp . '.csv';
            $filename = TMP_DIRECTORY . '/' . $csv_name;
            $csv_contents = $dbh_citizen->export_to_csv();
            $csv_file = fopen($filename, "wb");
            fwrite($csv_file, $csv_contents);
            fclose($csv_file);
            chmod($filename, 0755);
            $csv_name = urlencode($csv_name);
            $message = 'CSV file successfully generated: <a href="/' . BASE_DIRECTORY . '/download_generic.php?filename=' . $csv_name . '">Download the CSV file.</a>';
            $message_type = 'system';
        }
Exemplo n.º 9
0
<?php

require 'components/get_listview_referrer.php';
require 'subclasses/citizen.php';
$dbh_citizen = new citizen();
$dbh_citizen->set_where("citizen_id='" . quote_smart($citizen_id) . "'");
if ($result = $dbh_citizen->make_query()->result) {
    $data = $result->fetch_assoc();
    extract($data);
    $data = explode('-', $birth_date);
    if (count($data) == 3) {
        $birth_date_year = $data[0];
        $birth_date_month = $data[1];
        $birth_date_day = $data[2];
    }
    $data = explode('-', $date_registered);
    if (count($data) == 3) {
        $date_registered_year = $data[0];
        $date_registered_month = $data[1];
        $date_registered_day = $data[2];
    }
}
require_once 'subclasses/validate.php';
$dbh_citizen = new validate();
$dbh_citizen->set_fields('proof_of_id, proof_of_address, status');
$dbh_citizen->set_where("citizen_id='" . quote_smart($citizen_id) . "'");
if ($result = $dbh_citizen->make_query()->result) {
    $num_validate = $dbh_citizen->num_rows;
    for ($a = 0; $a < $num_validate; $a++) {
        $data = $result->fetch_row();
        $cf_validate_proof_of_id[$a] = $data[0];
Exemplo n.º 10
0
require 'path.php';
init_cobalt('Delete citizen');
if (isset($_GET['citizen_id'])) {
    $citizen_id = urldecode($_GET['citizen_id']);
    require_once 'form_data_citizen.php';
}
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_delete']);
    require 'components/query_string_standard.php';
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_citizen.php?{$query_string}");
    } elseif ($_POST['btn_delete']) {
        log_action('Pressed delete button');
        require_once 'subclasses/citizen.php';
        $dbh_citizen = new citizen();
        $object_name = 'dbh_citizen';
        require 'components/create_form_data.php';
        $dbh_citizen->delete($arr_form_data);
        redirect("listview_citizen.php?{$query_string}");
    }
}
require 'subclasses/citizen_html.php';
$html = new citizen_html();
$html->draw_header('Delete Citizen', $message, $message_type);
$html->draw_listview_referrer_info($filter_field_used, $filter_used, $page_from, $filter_sort_asc, $filter_sort_desc);
$html->draw_hidden('citizen_id');
$html->detail_view = TRUE;
$html->draw_controls('delete');
$html->draw_footer();