<?php include_once '../inc/config.inc.php'; $page_title = 'Login'; $msg = deQueueMsg(); if (!empty($_POST)) { extract($_POST); if (empty($username)) { enqueueMsg("Enter Username", "error"); } else { $res = Query("SELECT * FROM admin_user WHERE user_name = '" . Encode($username) . "' AND password = '******' AND is_deleted = 'N'"); if (Num($res) > 0) { $o = GetObj($res); if ($o->is_active == 'N') { enqueueMsg("This is not an active user, please contact system administrator to activate!", "error"); } else { $_SESSION["S_login"] = "******"; $_SESSION["S_ID"] = $o->id; $_SESSION["S_username"] = $o->user_name; $_SESSION["S_full_name"] = $o->full_name; $_SESSION["S_email"] = $o->email; header("location:dashboard.php"); exit; } } else { enqueueMsg("Invalid User Name/Password!", "error"); } } } if ($msg == '') { //$msg = displayMsg('Please login with your Username and Password.');
function GetCount($from, $where = '') { if (!empty($where)) { $where = " where {$where}"; } //echo "select count(*) as rows from $from $where"; $r = Query("select count(*) as rows from {$from} {$where}"); $o = GetObj($r); return $o->rows; }
function _tree_dropdown($table_name, $o_name, $selected, $where, $sort_order, $no_include, $parent_id, $level = 0) { $output = ""; $where2 = " WHERE parent_id = '{$parent_id}'"; $where2 .= $where != "" ? " AND {$where}" : ""; $sort_order2 = $sort_order != "" ? " ORDER BY {$sort_order}" : ""; $sql = "select * from {$table_name} {$where2} {$sort_order2}"; $r = Query($sql); while ($o = GetObj($r)) { $select_str = ""; $indent = str_repeat('-', $level * 3); if ($o->id == $selected) { $select_str = 'selected="selected"'; } if ($o->id != $no_include) { $output .= "<option {$select_str} value=\"{$o->id}\" >" . $indent . $o->{$o_name} . "</option>"; $output .= _tree_dropdown($table_name, $o_name, $selected, $where, $sort_order, $no_include, $o->id, $level + 1); } } return $output; }