$_SESSION["login_code"]]);
if ($uidinfo["status"] == "ERROR") {
throw new Exception();
}
if (is_numeric($uidinfo['uid'])) {
$user = new User($uidinfo['uid'] * 1);
$addpassresp = AccountHubApi::get(
"addapppassword",
[
"desc" => $SETTINGS["app_name"],
"username" => $user->getUsername()
],
true
);
$_SESSION["login_code"] = null;
$redirecturl = "https://apploginhelper.netsyms.net/?user:" . htmlentities($user->getUsername()) . "&password:" . htmlentities($addpassresp["pass"]);
header("Location: $redirecturl");
showHTML("Continue", "Click Here", $redirecturl);
} else {
throw new Exception();
}
} catch (Exception $ex) {
$redirecttologin = true;
}
}
if ($redirecttologin) {
try {
$codedata = AccountHubApi::get("getloginkey", ["appname" => $SETTINGS["app_name"], "appicon" => $iconurl], true);
if ($codedata['status'] != "OK") {
throw new Exception("There was a problem. Try again later.");
}
$_SESSION["login_code"] = $codedata["code"];
$locationurl = $codedata["loginurl"] . "?code=" . htmlentities($codedata["code"]) . "&redirect=" . htmlentities($thisurl);
header("Location: $locationurl");
showHTML("Continue", "Continue", $locationurl);
die();
} catch (Exception $ex) {
showHTML("Error", "", "", $ex->getMessage());
}
}