<?php 
include_once realpath(dirname(__FILE__) . '/admin-class.php');
$admin = new itg_admin();
$pushTosend = array();
$offlineUsers = $admin->getOfflineUsers();
$allUsers = $admin->getAllUsers();
$androidToken = array();
foreach ($allUsers as $alluser) {
    foreach ($offlineUsers as $offline) {
        if (in_array(strtoupper($offline['username']), $alluser)) {
            $pushTosend[] = $alluser;
        }
    }
}
foreach ($pushTosend as $value) {
    if ($value['is_on_track'] == 1) {
        if ($value['devicetype'] == 'ios') {
            iosPush($value['token']);
        }
        if ($value['devicetype'] == 'android') {
            $androidToken[] = $value['token'];
        }
    }
}
sendPushNotification($androidToken);
function iosPush($token)
{
    try {
        $deviceToken = $token;
Esempio n. 2
0
<?php

include_once 'admin-class.php';
$admin = new itg_admin();
if ($_SESSION['is_super'] == 0) {
    $adminUser = $admin->getActiveUsers();
} elseif ($_SESSION['is_super'] == 1) {
    $adminUser = $admin->getAllUsers();
} else {
    header("Location: dashboard.php?msg=Not authorized to view users");
}
if (count($adminUser) <= 0) {
    header("Location: dashboard.php?msg=No users found");
}
if ($_GET['op'] == "delete") {
    $admin->deleteUser();
}
if ($_POST) {
    $admin->addMultipleSession($_POST);
}
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <title>Tracker | Users</title>
        <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">