Example #1
0
 *  @license   http://www.gnu.org/licenses   GNU General Public License
 */
require_once '../../../config/config.inc.php';
include_once 'functions.php';
$key = Tools::getValue('key');
$function = Tools::getValue('call_function');
$push_ids = Tools::getValue('push_ids');
$value = Tools::getValue('value');
if (!isAuthenticated($key)) {
    die(Tools::jsonEncode('Authentication error'));
}
if ($function && function_exists($function)) {
    if ($function == 'changeStatus') {
        echo changeStatus($push_ids, $value);
    } elseif ($function == 'deleteDevice') {
        echo deleteDevice($push_ids);
    } else {
        echo call_user_func($function);
    }
} else {
    die(Tools::jsonEncode('error'));
}
function isAuthenticated($key)
{
    $login_data = unserialize(Configuration::get('MOBASSISTANTCONNECTOR'));
    if (hash('sha256', $login_data['login'] . $login_data['password'] . _COOKIE_KEY_) == $key) {
        return true;
    }
    return false;
}
function getDevices()
Example #2
0
<?php

include 'include/config.php';
include 'include/db.php';
include 'include/gcm.php';
dbconnect();
include 'include/checklogin.php';
if (isset($_GET["id"])) {
    $id = $_GET["id"];
    deleteDevice($id, $_COOKIE['user_id']);
}
dbclose();
header("Location: index.php");