<?php require_once '../../common.php'; require_once './auth.php'; $_SESSION = array(); session_unset(); session_destroy(); // force to "unregister" on client side auth_request($_SERVER['SERVER_NAME']);
<?php require_once './commonAPI.php'; require_once './constantAPI.php'; require_once './auth.php'; require_once './phpError.php'; $realm = $_SERVER['SERVER_NAME']; $authError = ""; if (!$myUser && !($myUser = auth_check($realm))) { auth_request($realm); } else { header('Cache-Control: no-cache, must-revalidate'); header('Expires:' . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 3600)); header('Content-type: application/json'); $jsonOutput = "{\"error\":{\"id\":\"0\",\"message\":\"no error\"}}\n"; } $_SESSION['currentUser'] = serialize($myUser); if ($isErrorPHP == true) { echo $msgErrorPHP; $_SESSION = array(); session_unset(); session_destroy(); } else { echo $jsonOutput; }
<?php define('INVALID_REMOTE', 1); define('INC_DIR', dirname(__DIR__)); require_once INC_DIR . '/inc/remotes.inc.php'; require_once INC_DIR . '/inc/db.inc.php'; require_once INC_DIR . '/inc/httpjson.inc.php'; require_once INC_DIR . '/inc/auth.inc.php'; // if !auth return $req = hj_request(); hj_log('req', $req); $acc = $req->userinfo; auth_request($req); $remote = $req->remote; $det = $req->remote->details; $user_id = get_id($acc->username); $db = get_db(); $st = $db->prepare('INSERT INTO remotes' . '(user_id, manufacturer, model, device_type) VALUES(?,?,?,?)'); $type_string = get_type_string($req->remote); $st->bind_param("isss", $user_id, $det->manufacturer, $det->model, $type_string); $st->execute(); $remote_id = $st->insert_id; $st->close(); $st = $db->prepare('INSERT INTO buttons' . '(remote_id, function, frequency, pattern) VALUES(?,?,?,?)'); $b_func = $b_freq = $b_patt = ''; $st->bind_param("isis", $remote_id, $b_func, $b_freq, $b_patt); $i = 0; foreach ($remote->buttons as $ignored => $b_json) { hj_log("b" . $i, $b_json); $i++; $b = new Button($b_json);