set_include_path(dirname(__FILE__) . '/lib' . PATH_SEPARATOR . dirname(__FILE__) . '/lib/smarty/libs/' . PATH_SEPARATOR . dirname(__FILE__) . '/lib/smartyValidate/libs/' . PATH_SEPARATOR . dirname(__FILE__) . '/lib/rb/' . PATH_SEPARATOR . get_include_path()); include_once 'controllers/login_include.php'; include_once 'logintop.php'; include_once 'models/functions.php'; require 'SmartyValidate.class.php'; $obj = new Functions(); $page = $obj->getPageName(); if (!$obj->pageAccess($_SESSION['login'], $page)) { header('location: dashboard.php'); } //if ($user->group_id > 3) header ("Location: dashboard.php"); $view = $top; $smarty = new Smarty(); $info = ''; $o = new Functions(); $o->insertAuditTrail($_SESSION['login'], 'VIEW_SUBSCRIBER_DETAILS', 'User view subscriber'); if ($id = @$_REQUEST['item']) { $deleted = R::exec("delete from groups where id=" . $id); if ($deleted) { $info = "Role Deleted!"; } } if ($_POST) { if (array_key_exists('add', $_POST)) { $role = $_POST['role']; $insert = $obj->insertRole($role); if ($insert) { $info = 'New Role [' . ucfirst($role) . '] Added Successfully!'; } } }
//$obj->smsSender($user_number, $user_msg); //$specialist_msg = ""; //$specialist_number = $specialist->mobile_number; //$obj->smsSender($specialist_number, $specialist_msg); } elseif (@$_POST['report'] == 'admission') { $hospital_id = $_POST['hospital']; $ref_id = $obj->referenceIDGenerator(2, 4); $obj->insertAdmission($ref_id, $_SESSION['user_id'], $hospital_id); $user_msg = ""; $user_number = $_SESSION['user_phone']; //$obj->smsSender($user_number, $user_msg); //$hospital_msg = ""; //$hospital_number = $_SESSION['user_phone']; //$obj->smsSender($specialist_number, $specialist_msg); } $obj->insertAuditTrail($_SESSION['login'], 'DOCTOR_REPORT', 'Consultation'); } SmartyValidate::disconnect(); header("Location: report.php"); } else { $smarty->assign('title', 'mHealth Admin Registration'); $smarty->assign('topic', 'Doctor Report Failed'); $smarty->assign('view', $view); $smarty->assign('data', $data); $smarty->assign('category', $category); $smarty->assign('states', $states); $smarty->assign('specialists', $specialists); // error, redraw the form $smarty->assign($_POST); $smarty->display('write_report.tpl'); }
SmartyValidate::register_validator('v_email', 'email', 'isEmail'); SmartyValidate::register_validator('v_password', 'password', 'notEmpty'); SmartyValidate::register_validator('v_confirm_password', 'password:confirm_password', 'isEqual'); $smarty->display('add.tpl'); } else { SmartyValidate::connect($smarty); // validate after a POST if (SmartyValidate::is_valid($_POST)) { // no errors, done with SmartyValidate if (array_key_exists('submit', $_POST)) { //var_dump($_POST); exit; $_SESSION['firstname'] = $_POST['firstname']; $_SESSION['lastname'] = $_POST['lastname']; $_SESSION['mobile_number'] = $_POST['mobile_number']; $_SESSION['email'] = $_POST['email']; $_SESSION['password'] = $_POST['password']; $_SESSION['group'] = $_POST['role']; $obj->insertAuditTrail($_SESSION['login'], 'ADD_USER', $_SESSION['firstname'] . ' ' . $_SESSION['lastname'] . ' added as user'); } SmartyValidate::disconnect(); header("Location: controllers/regprocess.php"); } else { $smarty->assign('title', 'mHealth Admin Registration'); $smarty->assign('topic', 'Admin Registration Failed'); $smarty->assign('view', $view); $smarty->assign('category', $category); // error, redraw the form $smarty->assign($_POST); $smarty->display('add.tpl'); } }
$start = $_REQUEST['start']; $end = $_REQUEST['end']; $activity = $activity == 'Select Activity Type' ? '' : $activity; $activity_q = $activity == '' ? '' : "and a.activity_type= '" . $activity . "' "; $start_q = $start == '' ? '' : " and a.date > '" . date('Y-m-d', strtotime($start)) . "' "; $end_q = $end == '' ? '' : " and a.date <= '" . date('Y-m-d', strtotime($end)) . "' "; $starty = "select * from audit_trails a where a.user_id = '" . $user . "' " . $activity_q . $start_q . $end_q; /*echo $activity_q; echo '<br>'; echo $end; echo '<br>'; echo $starty; exit;*/ $o = new Functions(); $category = R::getAll("select * from audit_trails a join users u where u.id='" . $user . "' and a.user_id = '" . $user . "' " . $activity_q . $start_q . $end_q); //$category = R::getAll("select * from audit_trails a join users u where a.user_id = u.id ".$activity_q); $o->insertAuditTrail($_SESSION['login'], 'SEARCH_DOCTOR_HISTORY', 'User searched for doctors details '); ?> <div id="subscribers"> <table class="tips"> <thead> <td>Doctor's Name</td> <td>Activity</td> <td>description</td> <td>Time</td> <td>Actions</td> </thead> <tbody> <?php foreach ($category as $cat) { ?> <tr>
$obj->insertAuditTrail ($_SESSION['login'], 'DELETE_ROLE', 'A role deleted'); $info = "Role Deleted!"; } */ $group = R::findOne('groups', 'id = :id', array(':id' => $item)); $items = R::find('dashboard_item', 1); if ($_POST) { if (array_key_exists('add', $_POST)) { $role = $_POST['role']; $group = R::findOne('access', 'groups_id = :item and dashboard_item_id= :group', array(':item' => $item, ':group' => $role)); //echo $group; exit; if ($group) { $info = 'This Group Has This Item Already!'; } else { $insert = $obj->insertItem($item, $role); if ($insert) { $obj->insertAuditTrail($_SESSION['login'], 'ADD_ITEM', 'A new item added to ' . $group['name']); $info = 'New Item Added Successfully!'; } } } } $category = R::getAll("select *,a.id as aid from access a join dashboard_item d where a.dashboard_item_id = d.id and a.groups_id=" . $item); //= R::find('groups', '1'); //var_dump($group); exit; $_SESSION['url2'] = $obj->selfURL(); $smarty = new Smarty(); $smarty->assign('title', 'mHealth::Living Healthy goes mobile'); $smarty->assign('topic', 'mHealth Manage Role Item'); $smarty->assign('view', $view); $smarty->assign('group', $group); $smarty->assign('items', $items);
//$exist = in_array($new_role, $group); if ($group) { $info = 'User already has the role!'; } else { if ($new_role == '6') { $specialist = $_POST['specialist']; $specialist_exist = R::find('specialization_users', 'specialization_id = :role and users_id= :users', array(':role' => $specialist, ':users' => $user_id)); if ($specialist_exist) { $info = 'User already has the Specialist role!'; } else { $obj->addNewSpecialist($user_id, $specialist); } } $id = $obj->addNewRole($user_id, $new_role); if ($id) { $obj->insertAuditTrail($_SESSION['login'], 'ADD_ROLE', 'A user role added'); $info = 'New Role Added Successfully !'; header("Location: " . $_SESSION['url']); } else { $info = 'Role Added Failed!'; } } } $user = R::find('users', 'id =' . $user_id); $role = R::find('groups', 1); $specialists = R::find('specialization', 1); $view = $top; $user = array_shift($user); $smarty = new Smarty(); $smarty->assign('title', 'mHealth::Living Healthy goes mobile'); $smarty->assign('topic', 'mHealth Manage Role Item');
include_once 'controllers/login_include.php'; include_once 'logintop.php'; include_once 'lib/smartyValidate/libs/SmartyValidate.class.php'; include_once 'models/functions.php'; $obj = new Functions(); $page = $obj->getPageName(); if (!$obj->pageAccess($_SESSION['login'], $page)) { header('location: dashboard.php'); } //if ($user->group_id > 1) header ("Location: dashboard.php"); $obj = new Functions(); $info = ''; if ($id = @$_REQUEST['user']) { $deleted = R::exec("delete from users where id=" . $id); if ($deleted) { $obj->insertAuditTrail($_SESSION['login'], 'DELETE_PROFILE', 'A user deleted'); $info = "User Profile Deleted!"; } } if ($_POST) { if (array_key_exists('submit', $_POST)) { $fname = $_POST['firstname']; $lname = $_POST['lastname']; $number = $_POST['mobile_number']; $email = $_POST['email']; //$role = $_POST['role']; $hid = $_POST['hid']; $update = $obj->updateUser($fname, $lname, $number, $email, $hid); if ($update) { $obj->insertAuditTrail($_SESSION['login'], 'UPDATE_PROFILE', $fname . ' ' . $lname . ' profile updated'); $info = $lname . ' ' . $fname . ' \'s Profile Updated';
<?php include_once 'controllers/login_include.php'; include_once 'models/functions.php'; $obj = new Functions(); if (@($id = $_REQUEST['item'])) { $deleted = R::exec("delete from users_groups where id= {$id}"); if ($deleted) { $obj->insertAuditTrail($_SESSION['login'], 'DELETE_ROLE', 'A user role deleted'); $info = "User Role Deleted!"; header("Location: " . $_SESSION['url']); exit; } else { $info = 'Role Delete Failed!'; header("Location: " . $_SESSION['url']); exit; } } if (@($id = $_REQUEST['item2'])) { $deleted = R::exec("delete from access where id= {$id}"); if ($deleted) { $obj->insertAuditTrail($_SESSION['login'], 'DELETE_ITEM', 'A user role deleted'); $info = "User Role Deleted!"; header("Location: " . $_SESSION['url2']); exit; } else { $info = 'Role Delete Failed!'; header("Location: " . $_SESSION['url2']); exit; } }
include_once 'models/functions.php'; require 'SmartyValidate.class.php'; $obj = new Functions(); $page = $obj->getPageName(); if (!$obj->pageAccess($_SESSION['login'], $page)) { header('location: dashboard.php'); } //if ($user->group_id > 2) header ("Location: dashboard.php"); $view = $top . $feedy; $smarty = new Smarty(); $info = ''; $obj = new Functions(); if ($id = @$_REQUEST['item']) { $deleted = R::exec("delete from feeds where id=" . $id); if ($deleted) { $obj->insertAuditTrail($_SESSION['login'], 'DELETE_FEED_SITE', 'A feed url deleted'); } $info = "Item Deleted!"; } if ($_POST) { if (array_key_exists('submit', $_POST)) { $url = $_POST['url']; $cat = $_POST['category']; $insert = $obj->insertFeed($cat, $url); if ($insert) { $obj->insertAuditTrail($_SESSION['login'], 'ADD_FEED_SITE', 'New feed url added: ' . $url); } $info = 'URL Uploaded Successfully!'; } elseif (array_key_exists('add', $_POST)) { $cat = $_POST['cat']; //var_dump($cat); exit;
<?php session_start(); include_once '../lib/rb/rb.php'; include 'db.php'; include '../models/functions.php'; $var = $_REQUEST['id']; $o = new Functions(); $category = R::getAll("select * from subscription p join users u where p.user_phone = u.mobile_number and u.subscriber_id = '" . $var . "'"); //var_dump($_SESSION['login']); exit; $o->insertAuditTrail($_SESSION['login'], 'SEARCH_SUBSCRIBER_DETAILS', 'User searched for subscriber with ID: ' . $var); ?> <h2> Subscription Details For Subscriber ID [<?php echo $var; ?> ] </h2><hr/> <table class="tips"> <thead> <td>Category</td> <td>Expiring Date</td> <td>Subscription ID</td> <td>Status </td> </thead> <tbody> <?php foreach ($category as $item) { ?> <tr> <td><?php echo $o->selectcategory($item['category_id']);
include_once 'logintop.php'; include_once 'lib/smartyValidate/libs/SmartyValidate.class.php'; include_once 'lib/smartyPaginate/libs/SmartyPaginate.class.php'; require 'models/functions.php'; $obj = new Functions(); //$smarty = new Smarty; $page = $obj->getPageName(); if (!$obj->pageAccess($_SESSION['login'], $page)) { header('location: dashboard.php'); } //if ($user->group_id > 3) header ("Location: dashboard.php"); $info = ''; if ($id = @$_REQUEST['item']) { $obj = new Functions(); $deleted = R::exec("delete from tip where id=" . $id); $obj->insertAuditTrail($_SESSION['login'], 'DELETE_TIP', 'Health tip deleted'); if ($deleted) { $info = "Item Deleted!"; } } $smarty = new Smarty(); /*$smarty ->template_dir = './templates'; $smarty ->compile_dir = './templates_c'; $smarty ->cache_dir = './cache'; $smarty ->config_dir = '.configs'; */ // required connect SmartyPaginate::connect(); // set items per page SmartyPaginate::setLimit(200); //$smarty->assign('tips', $tips); $link = mysql_connect('197.253.10.27:3306', 'm_health', 'm_health') or die("Impossible to connect");
include_once 'controllers/login_include.php'; include_once 'logintop.php'; include_once 'lib/smartyValidate/libs/SmartyValidate.class.php'; include_once 'models/functions.php'; $obj = new Functions(); $page = $obj->getPageName(); if (!$obj->pageAccess($_SESSION['login'], $page)) { header('location: dashboard.php'); } //if ($user->group_id > 1) header ("Location: dashboard.php"); $obj = new Functions(); $info = ''; if ($id = @$_REQUEST['user']) { $deleted = R::exec("delete from users where id=" . $id); if ($deleted) { $obj->insertAuditTrail($_SESSION['login'], 'DELETE_PROFILE', 'A user deleted'); $info = "User Profile Deleted!"; } } $users = R::getAll("SELECT *, u.id as uid FROM users u\nWHERE u.id NOT\nIN (SELECT g.users_id FROM users_groups g)\nAND u.group_id !=10"); $category = R::find('groups', '1'); $view = $top; //array_shift($users); //var_dump($users); exit; $smarty = new Smarty(); $smarty->assign('title', 'mHealth::Living Healthy goes mobile'); $smarty->assign('topic', 'Confirm Users'); $smarty->assign('view', $view); $smarty->assign('category', $category); $smarty->assign('users', $users); $smarty->assign('info', $info);
include_once 'logintop.php'; include_once 'models/functions.php'; require 'SmartyValidate.class.php'; $obj = new Functions(); $page = $obj->getPageName(); if (!$obj->pageAccess($_SESSION['login'], $page)) { header('location: dashboard.php'); } //if ($user->group_id > 2) header ("Location: dashboard.php"); $view = $top; $smarty = new Smarty(); $info = ''; if ($id = @$_REQUEST['item']) { $deleted = R::exec("delete from category where id=" . $id); if ($deleted) { $obj->insertAuditTrail($_SESSION['login'], 'DELETE_CATEGORY', 'A category deleted'); } $info = "Category Deleted!"; } if (array_key_exists('add', $_POST)) { $cat = $_POST['cat']; //var_dump($cat); exit; $insert = $obj->insertCategory($cat); if ($insert) { $obj->insertAuditTrail($_SESSION['login'], 'ADD_CATEGORY', 'New category added named: ' . $cat); } $info = 'Category Added Successfully!'; } $category = R::find('category', 1); //$category = R::getAll("select * from users u join subscription p where p.user_phone = u.mobile_number and group_id = 10"); //var_dump($category); exit;
<?php session_start(); set_include_path(dirname(__FILE__) . '/lib' . PATH_SEPARATOR . dirname(__FILE__) . '/lib/smarty/libs/' . PATH_SEPARATOR . dirname(__FILE__) . '/lib/smartyValidate/libs/' . PATH_SEPARATOR . dirname(__FILE__) . '/lib/rb/' . PATH_SEPARATOR . get_include_path()); include_once 'models/functions.php'; include_once 'rb.php'; $o = new Functions(); $o->insertAuditTrail($_SESSION['login'], 'LOGOUT', 'User logged out from mHealth application'); R::exec("update users set online = 0 where id = " . $_SESSION['login']); unset($_SESSION['login']); $_SESSION['error'] = "You have been successfully logged out!"; header("Location: login.php");
include_once 'controllers/login_include.php'; include_once 'logintop.php'; include_once 'models/functions.php'; if ($_POST) { $password = $_POST['password']; $password2 = $_POST['confirm_password']; if ($password != $password2) { $_SESSION['result'] = 'Password entered did not match!'; header("Location: user.php"); } elseif (empty($password) || empty($password2)) { $_SESSION['result'] = 'Password field empty!'; header("Location: user.php"); } else { $obj = new Functions(); $update = $obj->updatePassword($password); $obj->insertAuditTrail($_SESSION['login'], 'CHANGE_PASSWORD', 'User changed the account password'); if ($update) { $_SESSION['result'] = 'Password Change Successfully!'; } header("Location: user.php"); } } $view = $top . '<span class="error-message">' . @$_SESSION["result"] . '</span> <ul> <li> <strong>Firstname</strong> : ' . ucfirst($user->first_name) . ' </li> <li> <strong>Lastname</strong> : ' . ucfirst($user->last_name) . '
include_once 'models/functions.php'; require 'SmartyValidate.class.php'; $obj = new Functions(); $page = $obj->getPageName(); if (!$obj->pageAccess($_SESSION['login'], $page)) { header('location: dashboard.php'); } //if ($user->group_id > 2) header ("Location: dashboard.php"); $view = $top; $smarty = new Smarty(); $info = ''; $obj = new Functions(); if ($id = @$_REQUEST['item']) { $deleted = R::exec("delete from groups where id=" . $id); if ($deleted) { $obj->insertAuditTrail($_SESSION['login'], 'DELETE_ROLE', 'A role deleted'); } $info = "Role Deleted!"; } if ($_POST) { if (array_key_exists('add', $_POST)) { $role = $_POST['role']; $insert = $obj->insertRole($role); if ($insert) { $obj->insertAuditTrail($_SESSION['login'], 'ADD_ROLE', 'A new role added named: ' . $role); } $info = 'New Role [' . ucfirst($role) . '] Added Successfully!'; } } $category = R::find('groups', '1'); //var_dump($category); exit;