示例#1
0
        if (strlen($password) > MAX_PASSWORD_LENGTH) {
            $message = 'Password must not be more than ' . MAX_PASSWORD_LENGTH . ' chars.';
            $password = '';
        }
        //check if user exists
        if ($dbh_user->check_user($username)->user_exists) {
            //Good
        } else {
            $message = 'Specified username does not exist.';
        }
        if ($message == "") {
            require 'password_crypto.php';
            $hashed_password = cobalt_password_hash('NEW', $password, $username, $new_salt, $new_iteration, $new_method);
            $data_con = new data_abstraction();
            $data_con->set_query_type('UPDATE');
            $data_con->set_table('user');
            $data_con->set_update("`password`='{$hashed_password}', `salt`='{$new_salt}', `iteration`='{$new_iteration}', `method`='{$new_method}'");
            $data_con->set_where("username='******'");
            $data_con->make_query();
            $message = 'The password has been successfully reset.';
            $message_type = 'SYSTEM';
            $password = '';
        }
    }
}
require 'subclasses/user_html.php';
$html = new user_html();
$html->draw_header('Reset Password', $message, $message_type);
$html->fields['password']['control_type'] = 'password';
$html->fields['password']['label'] = 'Temporary Password';
$html->exception = array('person_id', 'role_id', 'skin_id');
示例#2
0
<?php

require 'path.php';
init_cobalt();
$page_title = 'Barangay System';
$stylesheet_link = 'style';
require 'header.php';
$data_con = new data_abstraction();
$data_con->set_fields('skin_name, header, footer, master_css, colors_css, fonts_css, override_css, icon_set');
$data_con->set_table('system_skins');
$data_con->set_where("skin_id=1");
$data_con->exec_fetch('single');
if ($data_con->num_rows == 1) {
    extract($data_con->dump);
    $_SESSION['header'] = $header;
    $_SESSION['footer'] = $footer;
    $_SESSION['skin'] = $skin_name;
    $_SESSION['master_css'] = $master_css;
    $_SESSION['colors_css'] = $colors_css;
    $_SESSION['fonts_css'] = $fonts_css;
    $_SESSION['override_css'] = $override_css;
    $_SESSION['icon_set'] = $icon_set;
    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);
示例#3
0
    $IPAddressOptions = cobalt_htmlentities($IPAddressOptions);
    $TimeStart = cobalt_htmlentities($TimeStart);
    $TimeEnd = cobalt_htmlentities($TimeEnd);
    $Username = cobalt_htmlentities($Username);
    $Module = cobalt_htmlentities($Module);
    $Keyword = cobalt_htmlentities($Keyword);
    $IPAddress = cobalt_htmlentities($IPAddress);
}
if (!isset($start)) {
    $start = 0;
}
//Pagination ****************************
//->Query to get total number of records.
$data_con = new data_abstraction();
$data_con->set_fields("entry_id, ip_address, user, datetime, action, module");
$data_con->set_table("`system_log`");
$data_con->set_where("{$TimeFilter} AND {$UserFilter} AND {$ModuleFilter} AND {$KeywordFilter} AND {$IPAddressFilter}");
$data_con->set_order("entry_id");
if ($result = $data_con->make_query()->result) {
    $total_records = $data_con->num_rows;
} else {
    die("Error getting log entries: " . $data_con->QUERY);
}
//-> Now instantiate the pagination class and feed it the necessary information.
require 'paged_result_class.php';
$results_per_page = 50;
$pager = new paged_result($total_records, $results_per_page);
$pager->get_page_data($result_pager, $current_page);
$current_page = $pager->current_page;
$data_con->set_limit($pager->offset, $pager->records_per_page);
$html_writer = new html();
示例#4
0
 function check_if_unique($db, $table, $where, $errMsg)
 {
     $error_message = '';
     $data_con = new data_abstraction();
     $data_con->set_database($db);
     $data_con->set_table($table);
     $data_con->set_where($where);
     $data_con->make_query();
     if ($data_con->Num_Rows > 0) {
         $error_message = $errMsg;
     }
     return $error_message;
 }
示例#5
0
     $data_con->set_fields('username');
     $data_con->set_table('user_passport');
     $data_con->set_where("username='******' AND link_id='{$link_id}'");
     $data_con->make_query();
     $checked = '';
     if ($data_con->num_rows == 1) {
         $checked = 'checked';
     }
     echo "<TR class={$class}><td class=\"listCell\"><label style=\"display: block;\" for='checkfield[{$a}]'><input type=checkbox ID='checkfield[{$a}]' name=\"link[]\" value='{$link_id}' {$checked}> {$Module_Name}</label></td>";
     $data_con->close_db();
     if ($a + 1 < $numrows) {
         $info = $result->fetch_assoc();
         extract($info);
         $data_con = new data_abstraction();
         $data_con->set_fields('username');
         $data_con->set_table('user_passport');
         $data_con->set_where("username='******' AND link_id='{$link_id}'");
         $data_con->make_query();
         if ($data_con->num_rows == 0) {
             echo "<td class='listCell'><label style=\"display: block;\" for=\"checkfield[" . ($a + 1) . "]\"><input type=checkbox ID='checkfield[" . ($a + 1) . "]' name=\"link[]\" value='{$link_id}'> {$Module_Name}</label></td></tr>";
         } elseif ($data_con->num_rows == 1) {
             echo "<td class='listCell'><label style=\"display: block;\" for=\"checkfield[" . ($a + 1) . "]\"><input type=checkbox ID='checkfield[" . ($a + 1) . "]' name=\"link[]\" value='{$link_id}' checked> {$Module_Name}</label></td></tr>";
         }
         $data_con->close_db();
     } else {
         echo "<td class='listCell'> &nbsp; </td></tr>";
     }
 }
 if ($numrows > 0) {
     echo '<tr><td colspan=2 align=center>
             <br />
示例#6
0
            $dbh->set_update("role_id='0'");
            $dbh->set_where("username='******'");
            $dbh->make_query();
            $dbh->close_db();
            //Get the role permissions
            require_once 'subclasses/user_role_links.php';
            $obj_role = new user_role_links();
            $obj_role->get_user_role_links($role);
            $arrLink = $obj_role->dump['link_id'];
            $numLinks = $obj_role->num_rows;
            $obj_role->close_db();
            //Assign permissions to user
            $dbh = new data_abstraction();
            foreach ($arrLink as $link_id) {
                $dbh->set_query_type('SELECT');
                $dbh->set_table('user_passport');
                $dbh->set_fields('username, link_id');
                $dbh->set_where("username='******' AND link_id='" . quote_smart($link_id) . "'");
                $dbh->make_query();
                if ($dbh->num_rows == 0) {
                    $dbh->set_query_type('INSERT');
                    $dbh->set_values("'" . quote_smart($Username) . "','" . quote_smart($link_id) . "'");
                    $dbh->make_query();
                }
            }
            $dbh->close_db();
        }
        $message = 'Success! User passport has been updated.';
        $message_type = 'system';
    }
}
示例#7
0
$html->display_tip('You have: ' . $res . ' documents to process');
require_once 'subclasses/citizen.php';
$dbh_citizen = new request();
$dbh_citizen->execute_query("SELECT status FROM validate WHERE status = 'wait list'");
$result2 = $dbh_citizen->result;
$hi = array();
while ($row2 = $result2->fetch_assoc()) {
    extract($row2);
    $hi[] = $row1['status'];
}
$results = count($hi);
$html->display_tip('There are: ' . $results . '  Wait listed citizen');
$menu_links = '';
$data_con = new data_abstraction();
$data_con->set_fields('a.link_id, a.descriptive_title, a.target, a.description, c.passport_group, a.icon as link_icon, c.icon as `group_icon`');
$data_con->set_table('user_links a, user_passport b, user_passport_groups c');
$data_con->set_where("a.link_id=b.link_id AND b.username='******'user']) . "' AND a.passport_group_id=c.passport_group_id AND a.show_in_tasklist='Yes' AND a.status='On'");
$data_con->set_order('c.priority DESC, c.passport_group, a.priority DESC, a.descriptive_title');
if ($result = $data_con->make_query()->result) {
    while ($data = $result->fetch_assoc()) {
        extract($data);
        $menu_links[$passport_group]['title'][] = $descriptive_title;
        $menu_links[$passport_group]['target'][] = $target;
        $menu_links[$passport_group]['link_id'][] = $link_id;
        $menu_links[$passport_group]['description'][] = $description;
        $menu_links[$passport_group]['link_icon'][] = $link_icon;
        $menu_links[$passport_group]['group_icon'][] = $group_icon;
    }
    $result->close();
} else {
    die("Fatal error: cannot retrieve modules");
示例#8
0
function log_action($action, $module = '')
{
    if (isset($_SESSION['user'])) {
        $username = quote_smart($_SESSION['user']);
    } else {
        $username = '******';
    }
    if ($module == '') {
        $module = $_SERVER['SCRIPT_NAME'];
    }
    $date = date("m-d-Y");
    $real_time = date("G:i:s");
    $new_date = explode("-", $date);
    $new_time = explode(":", $real_time);
    $timestamp = mktime($new_time[0], $new_time[1], $new_time[2], $new_date[0], $new_date[1], $new_date[2]);
    $date_time = date("l, F d, Y -- h:i:s a");
    $ip_address = get_ip();
    $action = quote_smart($action);
    $data_con = new data_abstraction();
    $data_con->set_query_type('INSERT');
    $data_con->set_table('system_log');
    $data_con->set_fields('ip_address, user, datetime, action, module');
    $data_con->set_values("'{$ip_address}', '{$username}', '{$timestamp}', '{$action}', '{$module}'");
    $data_con->make_query(TRUE, FALSE);
}
         }
         $message = 'Report saved successfully!';
         $message_type = 'system';
     } else {
         $message = 'Please enter a Report Name in order to save the report';
     }
 }
 if ($_POST['btn_delete']) {
     if (trim($_POST['chosen_report']) != '') {
         log_action('Pressed delete button');
         $reporter_mod_name = $reporter->session_array_name;
         $chosen_report = $_POST['chosen_report'];
         //Delete any existing report with the same report_name + module_name in order to effectively overwrite similarly named reports
         $dbh = new data_abstraction();
         $dbh->set_query_type('DELETE');
         $dbh->set_table('cobalt_reporter');
         $dbh->set_where('module_name = ? AND report_name = ?');
         $bind_params = array('ss', $reporter_mod_name, $chosen_report);
         $dbh->stmt_prepare($bind_params);
         $dbh->stmt_execute();
     } else {
         $message = 'Please choose a saved report to delete';
     }
 }
 if ($_POST['btn_submit']) {
     log_action('Pressed submit button');
     if (!isset($_POST['show_field']) || !is_array($_POST['show_field'])) {
         $message = 'Please check at least one column to be used for the report.';
         $show_field = array();
     } else {
         $show_field = $_POST['show_field'];
示例#10
0
function cobalt_password_must_rehash($username)
{
    $must_rehash = FALSE;
    $dbh = new data_abstraction();
    $dbh->set_table('user');
    $dbh->set_fields('`iteration`, `method` AS `current_method`');
    $dbh->set_where("`username`= ?");
    $bind_params = array('s', $username);
    $dbh->stmt_prepare($bind_params);
    $dbh->stmt_fetch('single');
    if ($dbh->num_rows == 1) {
        extract($dbh->dump);
    }
    $method = cobalt_password_set_method();
    if ($method == $current_method) {
        if ($method == 'blowfish') {
            $blowfish_cost_factor = AUTH_BLOWFISH_COST_FACTOR;
            if ((int) $iteration != (int) $blowfish_cost_factor) {
                $must_rehash = TRUE;
            }
        } else {
            $min = constant('AUTH_' . strtoupper($method) . '_MIN_ROUNDS');
            $max = constant('AUTH_' . strtoupper($method) . '_MAX_ROUNDS');
            if ($max < $min) {
                $max = $min;
            }
            if ($iteration < $min || $iteration > $max) {
                $must_rehash = TRUE;
            }
        }
    } else {
        $must_rehash = TRUE;
    }
    return $must_rehash;
}
示例#11
0
     $data_con->set_fields('role_id');
     $data_con->set_table('user_role_links');
     $data_con->set_where("role_id='{$role_id}' AND link_id='{$link_id}'");
     $data_con->make_query();
     $checked = '';
     if ($data_con->num_rows == 1) {
         $checked = 'checked';
     }
     echo "<TR class={$class}><TD class=\"listCell\"><label style=\"display: block;\" for='checkfield[{$a}]'><input type=checkbox ID='checkfield[{$a}]' name=\"link[]\" value='{$link_id}' {$checked}> {$Module_Name}</label></TD>";
     $data_con->close_db();
     if ($a + 1 < $numrows) {
         $info = $result->fetch_assoc();
         extract($info);
         $data_con = new data_abstraction();
         $data_con->set_fields('role_id');
         $data_con->set_table('user_role_links');
         $data_con->set_where("role_id='{$role_id}' AND link_id='{$link_id}'");
         $data_con->make_query();
         if ($data_con->num_rows == 0) {
             echo "<TD class='listCell'><label style=\"display: block;\" for=\"checkfield[" . ($a + 1) . "]\"><input type=checkbox ID='checkfield[" . ($a + 1) . "]' name=\"link[]\" value='{$link_id}'> {$Module_Name}</label></TD></TR>";
         } elseif ($data_con->num_rows == 1) {
             echo "<TD class='listCell'><label style=\"display: block;\" for=\"checkfield[" . ($a + 1) . "]\"><input type=checkbox ID='checkfield[" . ($a + 1) . "]' name=\"link[]\" value='{$link_id}' checked> {$Module_Name}</label></TD></TR>";
         }
         $data_con->close_db();
     } else {
         echo "<TD class='listCell'> &nbsp; </TD></TR>";
     }
 }
 if ($numrows > 0) {
     echo "<TR><TD colspan=2 align=center>\n                <input type=submit name=btn_submit value='SUBMIT' class=submit>\n                <input type=submit name=btn_cancel value='BACK' class=cancel>";
 } else {